Linux: Detect env-based shell invocation using common interactive shells

Flags Linux executions of /env that invoke common shells like /bin/bash, /bin/sh, /bin/zsh, /bin/dash, or /bin/fish.

FreeUnreviewedSigmahighv1
title: "Linux: Detect env-based shell invocation using common interactive shells"
id: 10b27514-c9df-4e1f-b8e6-2eebc7970dcf
status: test
description: This rule catches process executions where the binary path ends with /env and the command line contains references to common shells (e.g., /bin/bash, /bin/sh, /bin/dash, /bin/zsh, /bin/fish). Attackers may use env to launch a shell in contexts where direct shell execution is restricted. It relies on Linux process creation telemetry including the executed image path and command-line arguments.
references:
  - https://gtfobins.github.io/gtfobins/env/#shell
  - https://www.elastic.co/guide/en/security/current/linux-restricted-shell-breakout-via-linux-binary-s.html
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_env_shell_invocation.yml
author: Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.), Huntrule Team
date: 2024-09-02
modified: 2026-01-08
tags:
  - attack.execution
  - attack.t1059.004
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    Image|endswith: /env
    CommandLine|contains:
      - /bin/bash
      - /bin/dash
      - /bin/fish
      - /bin/sh
      - /bin/zsh
  condition: selection
falsepositives:
  - Github operations such as ghe-backup
level: high
license: DRL-1.1
related:
  - id: bed978f8-7f3a-432b-82c5-9286a9b3031a
    type: derived

What it detects

This rule catches process executions where the binary path ends with /env and the command line contains references to common shells (e.g., /bin/bash, /bin/sh, /bin/dash, /bin/zsh, /bin/fish). Attackers may use env to launch a shell in contexts where direct shell execution is restricted. It relies on Linux process creation telemetry including the executed image path and command-line arguments.

Known false positives

  • Github operations such as ghe-backup

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.