Detection rules › Sigma

Python One-Liners with Base64 Decoding

Severity
high
Author
Hugh Ryan (HueCodes), Swachchhanda Shrawan Poudel (Nextron Systems)
Source
upstream

Detects Python one-liners that use base64 decoding functions in command line executions. Malicious scripts or attackers often use python one-liners to decode and execute base64-encoded payloads, which is a common technique for obfuscation and evasion.

MITRE ATT&CK coverage

TacticTechniques
ExecutionT1059.006 Command and Scripting Interpreter: Python
Defense EvasionT1027.010 Obfuscated Files or Information: Command Obfuscation

Event coverage

ProviderEvent IDTitle
Sysmon1Process creation

Stages and Predicates

Stage 1: all of selection_img

or:
Image|contains: '\python'
OriginalFileName|contains: python

Stage 2: all of selection_cli

or:
CommandLine|contains: .decode
CommandLine|contains: b16decode
CommandLine|contains: b32decode
CommandLine|contains: b32hexdecode
CommandLine|contains: b64decode
CommandLine|contains: b85decode
CommandLine|contains: z85decode
CommandLine|contains: ' -c'
CommandLine|contains: base64
CommandLine|contains: import

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -c corpus 4 (sigma 4)
  • .decode
  • b16decode
  • b32decode
  • b32hexdecode
  • b64decode
  • b85decode
  • base64
  • import corpus 2 (sigma 2)
  • z85decode
Imagematch
  • \python corpus 2 (sigma 2)
OriginalFileNamematch
  • python