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): anchor approval-bypass -rf/-fr flags to rm-like binary basename
AnandSundar29bdb56f1645
diff --git a/rules/approval-abuse/approval-bypass-via-renamed-binary.rule.yaml b/rules/approval-abuse/approval-bypass-via-renamed-binary.rule.yamlindex 22585d6b..a101ee7a 100644--- a/rules/approval-abuse/approval-bypass-via-renamed-binary.rule.yaml+++ b/rules/approval-abuse/approval-bypass-via-renamed-binary.rule.yaml@@ -10,9 +10,13 @@ description: >indicates the operator blocked the canonical path and the agent re-issued theaction through a wrapper or copy to evade the gate. The rule is acorrelation between an approval.denied event in the same session and a- dangerous-class command that is not the literal denied path. Negative fixtures- cover denials with no follow-up, follow-ups in a different session, and- follow-ups that are unrelated benign commands.+ dangerous-class command that is not the literal denied path. The `-rf`/`-fr`+ flag patterns are anchored to a preceding rm-like binary basename+ (e.g. `myrm`, `crm`, `rm`) so that legitimate tar-archive operations like+ `tar -rf /tmp/myarchive.tar /var/data` do not correlate after a denied+ `rm -rf`. Negative fixtures cover denials with no follow-up, follow-ups in a+ different session, follow-ups that are unrelated benign commands, and the+ legitimate-tar-archive shape.severity: criticalstatus: experimentalposture: detect@@ -32,7 +36,7 @@ correlation:match: >e.event.action == "command.executed" &&e.command.command.matches("(?i)(/tmp/|/var/tmp/|\\$\\(mktemp\\))") &&- e.command.command.matches("(?i)(\\s+if\\s*=|\\s+of\\s*=/dev/sd|\\s+-[a-z]*r[a-z]*f\\b|\\s+-[a-z]*f[a-z]*r\\b|\\bmkfs\\b|\\|\\s*(ba)?sh\\b|\\bchmod\\s+-R\\s+777\\b|\\bsudo\\s+-s\\b)")+ e.command.command.matches("(?i)(\\s+if\\s*=|\\s+of\\s*=/dev/sd|(?:^|[;&|]\\s*|/)[^;&|]*?[a-z]*rm\\b[^;&|]*\\s+-[a-z]*r[a-z]*f\\b|(?:^|[;&|]\\s*|/)[^;&|]*?[a-z]*rm\\b[^;&|]*\\s+-[a-z]*f[a-z]*r\\b|\\bmkfs\\b|\\|\\s*(ba)?sh\\b|\\bchmod\\s+-R\\s+777\\b|\\bsudo\\s+-s\\b)")emit:reason: "Denied dangerous command re-invoked via a renamed or shimmed binary in the same session"@@ -93,3 +97,39 @@ tests:event: { action: command.executed }command: { command: "cp /bin/rm /tmp/myrm && /tmp/myrm -rf /var/data" }session: { id: s1 }+ - name: denied_rm_then_tar_with_rf_flag+ verdict: no_match+ events:+ - timestamp: "2026-06-23T10:00:00Z"+ event: { action: approval.denied }+ command: { command: "rm -rf /var/data" }+ approval: { decision: "denied", required: true }+ session: { id: s1 }+ - timestamp: "2026-06-23T10:00:45Z"+ event: { action: command.executed }+ command: { command: "tar -rf /tmp/myarchive.tar /var/data" }+ session: { id: s1 }+ - name: denied_rm_then_renamed_myrm+ verdict: match+ events:+ - timestamp: "2026-06-23T10:00:00Z"+ event: { action: approval.denied }+ command: { command: "rm -rf /var/data" }+ approval: { decision: "denied", required: true }+ session: { id: s1 }+ - timestamp: "2026-06-23T10:00:45Z"+ event: { action: command.executed }+ command: { command: "cp /bin/rm /tmp/myrm && /tmp/myrm -rf /var/data" }+ session: { id: s1 }+ - name: denied_dd_then_renamed_dd_still_fires+ verdict: match+ events:+ - timestamp: "2026-06-23T10:00:00Z"+ event: { action: approval.denied }+ command: { command: "dd if=/dev/zero of=/dev/sda" }+ approval: { decision: "denied", required: true }+ session: { id: s1 }+ - timestamp: "2026-06-23T10:00:45Z"+ event: { action: command.executed }+ command: { command: "cp /bin/dd /var/tmp/.x && /var/tmp/.x if=/dev/zero of=/dev/sda" }+ session: { id: s1 }