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 an uppercase rm in recursive-root-delete (#1225)
kyle-elliott-asymptotecc14145d0d3b
diff --git a/pkg/asymptoteobserve/rulestore/baseline/recursive-root-delete.rule.yaml b/pkg/asymptoteobserve/rulestore/baseline/recursive-root-delete.rule.yamlindex f1eed3b3..2b52ed93 100644--- a/pkg/asymptoteobserve/rulestore/baseline/recursive-root-delete.rule.yaml+++ b/pkg/asymptoteobserve/rulestore/baseline/recursive-root-delete.rule.yaml@@ -1,6 +1,6 @@id: recursive-root-deletespec: threat-rules/v1.2 # needed for e.command.parsed_commands-version: 3+version: 4title: Recursive delete targeting a sensitive root pathdescription: >A recursive or forced `rm` with an operand that is a filesystem root, home, or a@@ -21,7 +21,7 @@ taxonomy:match: >e.event.action == "command.executed" && (e.command.parsed_commands.exists(c,- c.argv.exists(a, a.matches("(^|/)rm$")) &&+ c.argv.exists(a, a.matches("(?i)(^|/)rm$")) &&c.argv.exists(a, a.matches("^-[a-zA-Z]*[rRfF][a-zA-Z]*$") || a in ["--recursive", "--force"]) &&c.argv_raw.exists(a, a == "*" ||a.matches("^([\"']?(~|\\$HOME|\\$\\{HOME\\})[\"']?/*|[\"']?/+[\"']?)\\*?$"))) ||@@ -39,6 +39,16 @@ tests:- event: { action: command.executed }command: { command: "rm -rf /" }session: { id: s1 }+ - name: rm_rf_root_uppercase_binary+ # The structured match's own binary-name regex was case-sensitive, so this parsed to a+ # non-empty parsed_commands list with argv[0]="RM" and was never caught by either branch: the+ # structured one required a literal lowercase "rm", and the text fallback (which does have+ # (?i)) only runs when parsed_commands is empty.+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "RM -rf /" }+ session: { id: s1 }- name: rm_rf_homeverdict: matchevents:diff --git a/rules/risky-command/recursive-root-delete.rule.yaml b/rules/risky-command/recursive-root-delete.rule.yamlindex f1eed3b3..2b52ed93 100644--- a/rules/risky-command/recursive-root-delete.rule.yaml+++ b/rules/risky-command/recursive-root-delete.rule.yaml@@ -1,6 +1,6 @@id: recursive-root-deletespec: threat-rules/v1.2 # needed for e.command.parsed_commands-version: 3+version: 4title: Recursive delete targeting a sensitive root pathdescription: >A recursive or forced `rm` with an operand that is a filesystem root, home, or a@@ -21,7 +21,7 @@ taxonomy:match: >e.event.action == "command.executed" && (e.command.parsed_commands.exists(c,- c.argv.exists(a, a.matches("(^|/)rm$")) &&+ c.argv.exists(a, a.matches("(?i)(^|/)rm$")) &&c.argv.exists(a, a.matches("^-[a-zA-Z]*[rRfF][a-zA-Z]*$") || a in ["--recursive", "--force"]) &&c.argv_raw.exists(a, a == "*" ||a.matches("^([\"']?(~|\\$HOME|\\$\\{HOME\\})[\"']?/*|[\"']?/+[\"']?)\\*?$"))) ||@@ -39,6 +39,16 @@ tests:- event: { action: command.executed }command: { command: "rm -rf /" }session: { id: s1 }+ - name: rm_rf_root_uppercase_binary+ # The structured match's own binary-name regex was case-sensitive, so this parsed to a+ # non-empty parsed_commands list with argv[0]="RM" and was never caught by either branch: the+ # structured one required a literal lowercase "rm", and the text fallback (which does have+ # (?i)) only runs when parsed_commands is empty.+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "RM -rf /" }+ session: { id: s1 }- name: rm_rf_homeverdict: matchevents: