Adversaries may obfuscate content during command execution to impede detection. Command-line obfuscation is a method of making strings and patterns within commands and scripts more difficult to signature and analyze. This type of obfuscation can be included within commands executed by delivered payloads (e.g., Phishing and Drive-by Compromise) or interactively via Command and Scripting Interpreter.[1][2]
For example, adversaries may abuse syntax that utilizes various symbols and escape characters (such as spacing, ^
, +
. $
, and %
) to make commands difficult to analyze while maintaining the same intended functionality.[3] Many languages support built-in obfuscation in the form of base64 or URL encoding.[4] Adversaries may also manually implement command obfuscation via string splitting ("Wor"+"d.Application"
), order and casing of characters (rev <<<'dwssap/cte/ tac'
), globing (mkdir -p '/tmp/:&$NiA'
), as well as various tricks involving passing strings through tokens/environment variables/input streams.[5][6]
Adversaries may also use tricks such as directory traversals to obfuscate references to the binary being invoked by a command (C:\voi\pcw\..\..\Windows\tei\qs\k\..\..\..\system32\erool\..\wbem\wg\je\..\..\wmic.exe shadowcopy delete
).[7]
Tools such as Invoke-Obfuscation
and Invoke-DOSfucation
have also been used to obfuscate commands.[8][9]
ID | Name | Description |
---|---|---|
G0073 | APT19 | |
G0050 | APT32 |
APT32 has used the |
G0143 | Aquatic Panda |
Aquatic Panda has encoded PowerShell commands in Base64.[14] |
S0373 | Astaroth |
Astaroth has obfuscated and randomized parts of the JScript code it is initiating.[15] |
S0475 | BackConfig |
BackConfig has used compressed and decimal encoded VBS scripts.[16] |
S1081 | BADHATCH |
BADHATCH malicious PowerShell commands can be encoded with base64.[17] |
C0018 | C0018 |
During C0018, the threat actors used Base64 to encode their PowerShell scripts.[18][19] |
C0021 | C0021 |
During C0021, the threat actors used encoded PowerShell commands.[20][21] |
S0462 | CARROTBAT |
CARROTBAT has the ability to execute obfuscated commands on the infected host.[22] |
G0114 | Chimera | |
G0080 | Cobalt Group |
Cobalt Group obfuscated several scriptlets and code used on the victim’s machine, including through use of XOR and RC4.[24][25] |
S0126 | ComRAT |
ComRAT has used encryption and base64 to obfuscate its orchestrator code in the Registry. ComRAT has also used encoded PowerShell scripts.[26][27] |
S0492 | CookieMiner |
CookieMiner has used base64 encoding to obfuscate scripts on the system.[28] |
S0673 | DarkWatchman |
DarkWatchman has used Base64 to encode PowerShell commands.[29] |
S0354 | Denis | |
S0367 | Emotet |
Emotet has obfuscated macros within malicious documents to hide the URLs hosting the malware, CMD.exe arguments, and PowerShell scripts. [30][31][32][33] |
S0363 | Empire |
Empire has the ability to obfuscate commands using |
G0037 | FIN6 | |
G0046 | FIN7 |
FIN7 has used fragmented strings, environment variables, standard input (stdin), and native character-replacement functionalities to obfuscate commands.[6][36][37] |
G0061 | FIN8 |
FIN8 has used environment variables and standard input (stdin) to obfuscate command-line arguments. FIN8 also obfuscates malicious macros delivered as payloads.[6][38][39] |
G0117 | Fox Kitten |
Fox Kitten has base64 encoded scripts to avoid detection.[40] |
C0001 | Frankenstein |
During Frankenstein, the threat actors ran encoded commands from the command line.[41] |
S0277 | FruitFly | |
G0047 | Gamaredon Group |
Gamaredon Group has used obfuscated or encrypted scripts.[43][44] |
G0115 | GOLD SOUTHFIELD |
GOLD SOUTHFIELD has executed base64 encoded PowerShell scripts on compromised hosts.[45] |
G1001 | HEXANE | |
S1022 | IceApple |
IceApple can use Base64 and "junk" JavaScript code to obfuscate information.[47] |
S0669 | KOCTOPUS |
KOCTOPUS has obfuscated scripts with the BatchEncryption tool.[48] |
G0140 | LazyScripter |
LazyScripter has leveraged the BatchEncryption tool to perform advanced batch script obfuscation and encoding techniques.[48] |
G0077 | Leafminer |
Leafminer obfuscated scripts that were used on victim machines.[49] |
S0451 | LoudMiner | |
S0409 | Machete |
Machete has used pyobfuscate, zlib compression, and base64 encoding for obfuscation. Machete has also used some visual obfuscation techniques by naming variables as combinations of letters to hinder analysis.[51][52] |
G0059 | Magic Hound |
Magic Hound has used base64-encoded commands.[53][54] |
G0069 | MuddyWater |
MuddyWater has used Daniel Bohannon’s Invoke-Obfuscation framework and obfuscated PowerShell scripts.[55][12] The group has also used other obfuscation methods, including Base64 obfuscation of VBScripts and PowerShell commands.[55][56][57][58][59][60][61] |
S0457 | Netwalker |
Netwalker's PowerShell script has been obfuscated with multiple layers including base64 and hexadecimal encoding and XOR-encryption, as well as obfuscated PowerShell functions and variables.[62][63] |
C0012 | Operation CuckooBees |
During Operation CuckooBees, the threat actors executed an encoded VBScript file.[64] |
C0014 | Operation Wocao |
During Operation Wocao, threat actors executed PowerShell commands which were encoded or compressed using Base64, zlib, and XOR.[65] |
G0040 | Patchwork |
Patchwork has obfuscated a script with Crypto Obfuscator.[66] |
G1040 | Play |
Play has used Base64-encoded PowerShell scripts for post exploit activities on compromised hosts.[67] |
S0428 | PoetRAT | |
S0685 | PowerPunch |
PowerPunch can use Base64-encoded scripts.[44] |
S0194 | PowerSploit |
PowerSploit contains a collection of ScriptModification modules that compress and encode scripts and payloads.[69][70] |
S0223 | POWERSTATS |
POWERSTATS uses character replacement, PowerShell environment variables, and XOR encoding to obfuscate code. POWERSTATS's backdoor code is a multi-layer obfuscated, encoded, and compressed blob. [56][71] POWERSTATS has used PowerShell code with custom string obfuscation [72] |
S0650 | QakBot | |
S0269 | QUADAGENT |
QUADAGENT was likely obfuscated using |
S0270 | RogueRobin |
The PowerShell script with the RogueRobin payload was obfuscated using the COMPRESS technique in |
G0034 | Sandworm Team |
Sandworm Team has used ROT13 encoding, AES encryption and compression with the zlib library for their Python-based backdoor.[77] |
S1085 | Sardonic |
Sardonic PowerShell scripts can be encrypted with RC4 and compressed using Gzip.[78] |
S0450 | SHARPSTATS |
SHARPSTATS has used base64 encoding and XOR to obfuscate PowerShell scripts.[72] |
S0589 | Sibot | |
G0121 | Sidewinder |
Sidewinder has used base64 encoding for scripts.[80][81] |
G0091 | Silence |
Silence has used environment variable string substitution for obfuscation.[82] |
S0390 | SQLRat |
SQLRat has used a character insertion obfuscation technique, making the script appear to contain Chinese characters.[83] |
G0092 | TA505 | |
G0127 | TA551 |
TA551 has used obfuscated variable names in a JavaScript configuration file.[86] |
G0010 | Turla |
Turla has used encryption (including salted 3DES via PowerSploit's |
S0386 | Ursnif |
Ursnif droppers execute base64 encoded PowerShell commands.[88] |
G0102 | Wizard Spider |
Wizard Spider used Base64 encoding to obfuscate an Empire service and PowerShell commands.[89][90] |
S0330 | Zeus Panda |
Zeus Panda obfuscates the macro commands in its initial payload.[91] |
ID | Mitigation | Description |
---|---|---|
M1049 | Antivirus/Antimalware |
Consider utilizing the Antimalware Scan Interface (AMSI) on Windows 10+ to analyze commands after being processed/interpreted. |
M1040 | Behavior Prevention on Endpoint |
On Windows 10+, enable Attack Surface Reduction (ASR) rules to block execution of potentially obfuscated scripts.[92] |
ID | Data Source | Data Component | Detects |
---|---|---|---|
DS0017 | Command | Command Execution |
Monitor executed commands and arguments for indicators of obfuscation and potentially suspicious syntax such as uninterpreted escape characters (e.g., Also monitor command-lines for syntax-specific signs of obfuscation, such as variations of arguments associated with encoding. |
DS0022 | File | File Metadata |
Scripts containing obfuscated content may have higher entropy of characters/strings. |
DS0012 | Script | Script Execution |
Monitor executed scripts for indicators of obfuscation and potentially suspicious command syntax, such as uninterpreted escape characters (e.g., Also monitor commands within scripts for syntax-specific signs of obfuscation, such as encoded or otherwise unreadable blobs of characters. |