Back to results

Windows Command Obfuscation with Environment Variable Substrings

Detects command obfuscation by using a technique to build a target command using character indexes from environment variables. This hides the true intent of the command by building it on the fly. In Windows command…

Description

Detects command obfuscation by using a technique to build a target command using character indexes from environment variables. This hides the true intent of the command by building it on the fly. In Windows command prompt, you can use the :~ format to extract substrings from environment variable values. This behavior has been observed in various malware families, including Cobalt Strike and Meterpreter.

Detection logic

Detection requirements

Platform
LinuxmacOSWindows

The rule states no platform. This is derived from the ATT&CK technique it maps to.

Known benign triggers

  • Some legitimate scripts and system maintenance tools may use substring extraction from environment variables for dynamic command construction. Review and whitelist authorized scripts to reduce false positives.

Detections can measure how the public catalogue is used — which detections people look for, and which pages bring them here. It sets a cookie that recognises this browser for 180 days. It is never linked to an account and never follows you to other sites. Privacy notice