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 crontab file loads followed by another command (#1048)
Rudy Mizrahi Celeklie3250c64675f
diff --git a/rules/risky-command/crontab-modification.rule.yaml b/rules/risky-command/crontab-modification.rule.yamlindex 54324bed..e3a15feb 100644--- a/rules/risky-command/crontab-modification.rule.yaml+++ b/rules/risky-command/crontab-modification.rule.yaml@@ -21,7 +21,8 @@ taxonomy:match: >(e.event.action == "command.executed" && (- e.command.command.matches("(?i)(^|[;&|]\\s*|\\bsudo\\s+)\\s*crontab\\b[^;&|]*(\\s-e\\b|\\s-[a-z]*r\\b|\\s-\\s+[a-zA-Z0-9_./-]+|\\s-\\s*$|\\s+[a-zA-Z0-9_./]+\\s*$|\\b[^;&|]*\\|\\s*crontab\\b)")+ e.command.command.matches("(?i)(^|[;&|]\\s*|\\bsudo\\s+)\\s*crontab\\b[^;&|]*(\\s-e\\b|\\s-[a-z]*r\\b|\\s-\\s+[a-zA-Z0-9_./-]+|\\s-\\s*$|\\b[^;&|]*\\|\\s*crontab\\b)") ||+ e.command.command.matches("(?i)(^|[;&|(]\\s*|\\bsudo\\s+)\\s*crontab(\\s+-u\\s*[^\\s;&|]+)?\\s+[a-zA-Z0-9_./~][a-zA-Z0-9_./~-]*\\s*($|[;&|)])"))) || (e.event.action in ["file.modified", "file.created", "file.edited"] && (e.file.path.matches("(?i)(^|/)etc/crontab$") ||@@ -47,6 +48,30 @@ tests:- event: { action: command.executed }command: { command: "crontab /tmp/payload.cron" }session: { id: s1 }+ - name: crontab_load_then_cleanup+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "crontab /tmp/payload.cron && rm /tmp/payload.cron" }+ session: { id: s1 }+ - name: crontab_load_from_home+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "crontab ~/jobs.cron" }+ session: { id: s1 }+ - name: crontab_list_then_command+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "crontab -l && echo done" }+ session: { id: s1 }+ - name: crontab_backup_then_command+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "crontab -l > ~/crontab.bak && echo saved" }+ session: { id: s1 }- name: pipe_into_crontabverdict: matchevents: