Detection rules › Sigma

Linux Shell Pipe to Shell

Status
test
Severity
medium
Log source
product linux, category process_creation
Author
Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects suspicious process command line that starts with a shell that executes something and finally gets piped into another shell

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Linux Shell Pipe to Shell
id: 880973f3-9708-491c-a77b-2a35a1921158
status: test
description: Detects suspicious process command line that starts with a shell that executes something and finally gets piped into another shell
references:
    - Internal Research
author: Florian Roth (Nextron Systems)
date: 2022-03-14
modified: 2022-07-26
tags:
    - attack.stealth
    - attack.t1140
logsource:
    product: linux
    category: process_creation
detection:
    selection:
        CommandLine|startswith:
            - 'sh -c '
            - 'bash -c '
    selection_exec:
        - CommandLine|contains:
              - '| bash '
              - '| sh '
              - '|bash '
              - '|sh '
        - CommandLine|endswith:
              - '| bash'
              - '| sh'
              - '|bash'
              - ' |sh'
    condition: all of selection*
falsepositives:
    - Legitimate software that uses these patterns
level: medium

Stages and Predicates

Stage 0: condition

all of selection*

Stage 1: selection

selection:
    CommandLine|startswith:
        - 'sh -c '
        - 'bash -c '

Stage 2: selection_exec

selection_exec:
    - CommandLine|contains:
          - '| bash '
          - '| sh '
          - '|bash '
          - '|sh '
    - CommandLine|endswith:
          - '| bash'
          - '| sh'
          - '|bash'
          - ' |sh'

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
CommandLineends_with
  • |sh
  • | bash
  • | sh
  • |bash
CommandLinematch
  • | bash
  • | sh
  • |bash
  • |sh
CommandLinestarts_with
  • bash -c
  • sh -c