Detection rules › Sigma

Indirect Inline Command Execution Via Bash.EXE

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
frack113
Source
github.com/SigmaHQ/sigma

Detects execution of Microsoft bash launcher with the "-c" flag. This can be used to potentially bypass defenses and execute Linux or Windows-based binaries directly via bash.

MITRE ATT&CK coverage

TacticTechniques
StealthT1202 Indirect Command Execution

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Indirect Inline Command Execution Via Bash.EXE
id: 5edc2273-c26f-406c-83f3-f4d948e740dd
related:
    - id: 2d22a514-e024-4428-9dba-41505bd63a5b
      type: similar
status: test
description: |
    Detects execution of Microsoft bash launcher with the "-c" flag.
    This can be used to potentially bypass defenses and execute Linux or Windows-based binaries directly via bash.
references:
    - https://lolbas-project.github.io/lolbas/Binaries/Bash/
author: frack113
date: 2021-11-24
modified: 2023-08-15
tags:
    - attack.stealth
    - attack.t1202
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith:
              - ':\Windows\System32\bash.exe'
              - ':\Windows\SysWOW64\bash.exe'
        - OriginalFileName: 'Bash.exe'
    selection_cli:
        CommandLine|contains: ' -c '
    condition: all of selection_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    - Image|endswith:
          - ':\Windows\System32\bash.exe'
          - ':\Windows\SysWOW64\bash.exe'
    - OriginalFileName: 'Bash.exe'

Stage 2: selection_cli

selection_cli:
    CommandLine|contains: ' -c '

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 14 (sigma 13, elastic 1)
Imageends_with
  • :\Windows\SysWOW64\bash.exe corpus 2 (sigma 2)
  • :\Windows\System32\bash.exe corpus 2 (sigma 2)
OriginalFileNameeq
  • Bash.exe corpus 4 (sigma 3, elastic 1)