Curl pipe to shell
What it detects
Detects a remote script piped straight into a shell (curl/wget ... | sh|bash|zsh) — a one-liner download-and-execute that runs attacker-controlled code without touching disk.
MITRE ATT&CK mapping
False positives and triage
Developer install scripts (Homebrew, some vendors) use this pattern legitimately. Judge by the source domain and whether the URL is attacker-controlled or newly seen in the estate.
The rule
Declarative YAML read by the detection engine — data, never executed. Confidence 70%. Source: rules/macos/curl_pipe_to_shell.yaml, licensed under the Apache License 2.0.
id: macos.execution.curl_pipe_to_shell
version: 1.0.0
status: stable
severity: high
confidence: 0.7
platforms: [macos]
mitre_techniques: [T1059.004, T1105]
description: |
Detects a remote script piped straight into a shell (curl/wget ... | sh|bash|zsh) — a
one-liner download-and-execute that runs attacker-controlled code without touching disk.
match:
command_line_regex: '(?i)(curl|wget)[^|]*\|\s*(bash|zsh|sh)\b'
false_positive_guidance: |
Developer install scripts (Homebrew, some vendors) use this pattern legitimately. Judge by
the source domain and whether the URL is attacker-controlled or newly seen in the estate.
Related detections
Run this rule on your own logs — offline
KIROSEC runs this rule and the rest of the library over Windows, Linux, macOS and cloud audit logs on the analyst's own machine. Every alert links to the events that raised it, and nothing leaves the device.
