Linux Process Creation: Shell Command Piped Into Another Shell

Flags Linux processes that start with sh/bash -c and pipe execution into a subsequent shell.

FreeReviewedSigma · Medium · v2
Product
linux
Category
process_creation
Author
Florian Roth (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2022-03-14
Updated
2026-07-31
title: "Linux Process Creation: Shell Command Piped Into Another Shell"
id: 71bad6b0-f3e0-43b9-96ba-44336c4c8502
status: test
description: This rule flags Linux processes whose command line begins with a shell wrapper (sh -c or bash -c) and includes piping that results in execution by another shell. Attackers commonly use this chaining to execute staged commands while preserving interactive or script-driven behavior across multiple shells. The detection relies on process creation telemetry capturing the full CommandLine for the spawned process.
references:
  - Internal Research
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_susp_pipe_shell.yml
author: Florian Roth (Nextron Systems), Huntrule Team
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
license: DRL-1.1
related:
  - id: 880973f3-9708-491c-a77b-2a35a1921158
    type: derived