The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
fix(rules): match /bin/bash and /usr/bin/sh in base64-decode-piped-to-shell (#1032)
Rudy Mizrahi Celekli1f518e608908
diff --git a/rules/risky-command/base64-decode-piped-to-shell.rule.yaml b/rules/risky-command/base64-decode-piped-to-shell.rule.yamlindex 4395278d..fb158208 100644--- a/rules/risky-command/base64-decode-piped-to-shell.rule.yaml+++ b/rules/risky-command/base64-decode-piped-to-shell.rule.yaml@@ -1,10 +1,11 @@id: base64-decode-piped-to-shell-version: 2+version: 3title: Base64-decoded payload piped into a shelldescription: >A command base64-decodes content and pipes it straight into a shell — the classicobfuscated remote-code-execution shape that hides the payload from a casual review.- The pipe-to-shell match is case-insensitive so an uppercase shell name cannot evade.+ The pipe-to-shell match is case-insensitive so an uppercase shell name cannot evade,+ and accepts the shell by any path, through `env`, or under `sudo` with flags.severity: highstatus: stableposture: detect@@ -16,7 +17,7 @@ taxonomy:match: >e.event.action == "command.executed" &&e.command.command.matches("(?i)\\bbase64\\b\\s+(-d|-D|--decode)\\b") &&- e.command.command.matches("(?i)\\|\\s*(sudo\\s+)?(ba|z)?sh\\b")+ e.command.command.matches("(?i)\\|\\s*(sudo(\\s+-\\S+)*\\s+)?(\\S*/)?(env\\s+)?(ba|z|da|k)?sh\\b")emit:reason: "Base64-decoded payload piped directly into a shell"@@ -46,6 +47,42 @@ tests:- event: { action: command.executed }command: { command: "echo aGk= |base64 -d|zsh" }session: { id: s1 }+ - name: shell_by_absolute_path+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "echo ZWNobyBoaQ== | base64 -d | /bin/bash" }+ session: { id: s1 }+ - name: shell_by_usr_bin_path_under_sudo+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "echo aGk= | base64 --decode | sudo /usr/bin/sh" }+ session: { id: s1 }+ - name: shell_by_homebrew_path+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "echo aGk= | base64 -d | /opt/homebrew/bin/bash" }+ session: { id: s1 }+ - name: shell_through_env+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "echo aGk= | base64 -d | /usr/bin/env bash" }+ session: { id: s1 }+ - name: shell_under_sudo_with_flags+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "echo aGk= | base64 -d | sudo -E bash" }+ session: { id: s1 }+ - name: decode_piped_to_shasum+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "echo aGk= | base64 -d | /usr/bin/shasum -a 256" }+ session: { id: s1 }- name: base64_decode_to_fileverdict: no_matchevents: