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] |
| G1052 | Contagious Interview |
Contagious Interview has obfuscated JavaScript code using Base64 and variable substitutions.[28][29][30][31] |
| S0492 | CookieMiner |
CookieMiner has used base64 encoding to obfuscate scripts on the system.[32] |
| S0673 | DarkWatchman |
DarkWatchman has used Base64 to encode PowerShell commands.[33] |
| S0354 | Denis | |
| S0367 | Emotet |
Emotet has obfuscated macros within malicious documents to hide the URLs hosting the malware, CMD.exe arguments, and PowerShell scripts. [34][35][36][37] |
| 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][40][41] |
| 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][42][43] |
| G0117 | Fox Kitten |
Fox Kitten has base64 encoded scripts to avoid detection.[44] |
| C0001 | Frankenstein |
During Frankenstein, the threat actors ran encoded commands from the command line.[45] |
| S0277 | FruitFly | |
| G0047 | Gamaredon Group |
Gamaredon Group has used obfuscated or encrypted scripts.[47][48][49][50] |
| G0115 | GOLD SOUTHFIELD |
GOLD SOUTHFIELD has executed base64 encoded PowerShell scripts on compromised hosts.[51] |
| G1001 | HEXANE | |
| S1022 | IceApple |
IceApple can use Base64 and "junk" JavaScript code to obfuscate information.[53] |
| G0094 | Kimsuky |
Kimsuky has encoded malicious PowerShell scripts using Base64.[54] |
| S0669 | KOCTOPUS |
KOCTOPUS has obfuscated scripts with the BatchEncryption tool.[55] |
| G0140 | LazyScripter |
LazyScripter has leveraged the BatchEncryption tool to perform advanced batch script obfuscation and encoding techniques.[55] |
| G0077 | Leafminer |
Leafminer obfuscated scripts that were used on victim machines.[56] |
| 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.[58][59] |
| G0059 | Magic Hound |
Magic Hound has used base64-encoded commands.[60][61] |
| G1051 | Medusa Group |
Medusa Group has obfuscated PowerShell scripts with Base64 encoding.[62] Medusa Group has also obfuscated the code of dropped kernel drivers using a software known as Safengine Shielden which randomized the code through code mutations and then leveraged an embedded virtual machine interpreter to execute the code.[63] |
| G0069 | MuddyWater |
MuddyWater has used Daniel Bohannon’s Invoke-Obfuscation framework and obfuscated PowerShell scripts.[64][12] The group has also used other obfuscation methods, including Base64 obfuscation of VBScripts and PowerShell commands.[64][65][66][67][68][69][70] |
| 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.[71][72] |
| C0012 | Operation CuckooBees |
During Operation CuckooBees, the threat actors executed an encoded VBScript file.[73] |
| C0014 | Operation Wocao |
During Operation Wocao, threat actors executed PowerShell commands which were encoded or compressed using Base64, zlib, and XOR.[74] |
| G0040 | Patchwork |
Patchwork has obfuscated a script with Crypto Obfuscator.[75] |
| G1040 | Play |
Play has used Base64-encoded PowerShell scripts for post exploit activities on compromised hosts.[76] |
| S0428 | PoetRAT | |
| S0685 | PowerPunch |
PowerPunch can use Base64-encoded scripts.[48] |
| S0194 | PowerSploit |
PowerSploit contains a collection of ScriptModification modules that compress and encode scripts and payloads.[78][79] |
| 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. [65][80] POWERSTATS has used PowerShell code with custom string obfuscation [81] |
| S0650 | QakBot | |
| S0269 | QUADAGENT |
QUADAGENT was likely obfuscated using |
| S1240 | RedLine Stealer |
RedLine Stealer has obfuscated scripts within text files used in execution.[85] |
| 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.[87] |
| S1085 | Sardonic |
Sardonic PowerShell scripts can be encrypted with RC4 and compressed using Gzip.[88] |
| C0058 | SharePoint ToolShell Exploitation |
During SharePoint ToolShell Exploitation, threat actors executed Base64-encoded PowerShell commands.[89][90][91][92][93] |
| S0450 | SHARPSTATS |
SHARPSTATS has used base64 encoding and XOR to obfuscate PowerShell scripts.[81] |
| S0589 | Sibot | |
| G0121 | Sidewinder |
Sidewinder has used base64 encoding for scripts.[95][96] |
| G0091 | Silence |
Silence has used environment variable string substitution for obfuscation.[97] |
| S0390 | SQLRat |
SQLRat has used a character insertion obfuscation technique, making the script appear to contain Chinese characters.[98] |
| G0092 | TA505 | |
| G0127 | TA551 |
TA551 has used obfuscated variable names in a JavaScript configuration file.[101] |
| G0010 | Turla |
Turla has used encryption (including salted 3DES via PowerSploit's |
| S0386 | Ursnif |
Ursnif droppers execute base64 encoded PowerShell commands.[103] |
| G0102 | Wizard Spider |
Wizard Spider used Base64 encoding to obfuscate an Empire service and PowerShell commands.[104][105] |
| S1248 | XORIndex Loader |
XORIndex Loader has obfuscated strings using ASCII buffers and TextDecoder.[106] |
| S0330 | Zeus Panda |
Zeus Panda obfuscates the macro commands in its initial payload.[107] |
| 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.[108] |
| ID | Name | Analytic ID | Analytic Description |
|---|---|---|---|
| DET0505 | Detection Strategy for Command Obfuscation | AN1394 |
Detection of command-line activity exhibiting syntactic obfuscation patterns, such as excessive escape characters, base64 encoding, command concatenation, or outlier command length and entropy. |
| AN1395 |
Detection of shell commands that leverage encoded execution, command chaining, excessive piping, or unusual token patterns indicative of obfuscation. |
||
| AN1396 |
Detection of obfuscated commands via shell, osascript, or AppleScript interpreters using unusual tokens, encoding, variable substitution, or runtime string reconstruction. |