Detection rules › Sigma

Shai-Hulud Malicious Bun Execution - Linux

Status
experimental
Severity
high
Log source
product linux, category process_creation
Author
Swachchhanda Shrawan Poudel (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects the execution of bun_environment.js via the Bun runtime, a behavior associated with the Shai-Hulud "Second Coming" NPM supply chain attack. The malware uses a setup_bun.js script to install the Bun runtime if not present, and then executes the malicious bun_environment.js payload.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Shai-Hulud Malicious Bun Execution - Linux
id: eb827bbd-670a-4d58-8446-c464d8ac2323
related:
    - id: 5299fadf-f228-4526-8274-251db1960be9
      type: similar
status: experimental
description: |
    Detects the execution of `bun_environment.js` via the Bun runtime, a behavior associated with the Shai-Hulud "Second Coming" NPM supply chain attack.
    The malware uses a `setup_bun.js` script to install the Bun runtime if not present, and then executes the malicious `bun_environment.js` payload.
references:
    - https://www.aikido.dev/blog/shai-hulud-strikes-again-hitting-zapier-ensdomains
    - https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack
    - https://github.com/asyncapi/cli/blob/2efa4dff59bc3d3cecdf897ccf178f99b115d63d/setup_bun.js
author: Swachchhanda Shrawan Poudel (Nextron Systems)
date: 2025-11-25
tags:
    - attack.t1195.002
    - attack.t1203
    - attack.execution
    - attack.initial-access
    - detection.emerging-threats
logsource:
    category: process_creation
    product: linux
detection:
    selection_parent:
        ParentImage|endswith: '/node'
    selection_child_bun:
        Image|endswith: '/bun'
        CommandLine|contains:
            - 'bun_environment.js'
            - 'https://github.com/actions/runner/releases/download/v2.330.0'
    selection_child_setup_curl:
        CommandLine|contains|all:
            - 'curl '
            - '-fsSL'
            - 'https://bun.sh/install'
            - 'bash'
    selection_child_path_reload:
        CommandLine|contains|all:
            - 'bash -c "source '
            - '&& echo'
    condition: selection_parent and 1 of selection_child_*
falsepositives:
    - Legitimate but uncommon use of files named `bun_environment.js` could trigger this rule.
level: high

Stages and Predicates

Stage 0: condition

selection_parent and 1 of selection_child_*

Stage 1: selection_parent

selection_parent:
    ParentImage|endswith: '/node'

Stage 2: selection_child_bun

selection_child_bun:
    Image|endswith: '/bun'
    CommandLine|contains:
        - 'bun_environment.js'
        - 'https://github.com/actions/runner/releases/download/v2.330.0'

Stage 3: selection_child_setup_curl

selection_child_setup_curl:
    CommandLine|contains|all:
        - 'curl '
        - '-fsSL'
        - 'https://bun.sh/install'
        - 'bash'

Stage 4: selection_child_path_reload

selection_child_path_reload:
    CommandLine|contains|all:
        - 'bash -c "source '
        - '&& echo'

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
  • && echo
  • -fsSL
  • bash
  • bash -c "source
  • bun_environment.js
  • curl
  • https://bun.sh/install
  • https://github.com/actions/runner/releases/download/v2.330.0
Imageends_with
  • /bun
ParentImageends_with
  • /node