Repository navigation
feat(detection): repeated-denials rule — guardrail probing burst (fixes #1) - #486
Conversation
blitzcrieg1
left a comment
There was a problem hiding this comment.
Thanks for taking on #1. The paired corpus cases and the test that excludes human approval responses give us a good basis for the rule.
Could you make two changes on this PR before we merge?
- Make the default engine report a single finding for repeated denials. The shipped
rapid-tool-denialsrule also counts deniedtool_calledevents, so five denials currently match both rules. Please add an engine-level check for zero denial findings at three events and exactly one at both four and five. I’d prefer to preserve the existing rule ID where practical, since downstream rules may match it. Please check the Sigma export for the approach you choose. - Keep the current Sponsors paragraph from
master. CI on this head collected 2,987 tests across Linux, Windows, and macOS. Please rerun collection after the revision and use that measured number in the README.
Please push the revision here so we can keep the review and credit on your PR.
There was a problem hiding this comment.
Thanks for the revision and the engine-level three-, four-, and five-denial tests. I approved CI and CodeQL for this commit.
Before merge, please preserve rapid-tool-denials as the ID of the default finding, or propose a migration for downstream rules that already match it. The new filter currently drops any finding with that ID when the built-in rule fires, including a custom manifest rule that may use different conditions. Please add a custom-manifest regression and check the Sigma export with the chosen behavior.
The Sponsors paragraph still differs from master. Please keep the current paragraph. CI on cc56e16c collected 2,990 tests on Linux, Windows, and macOS. The README’s 2,986 was the only test failure on each platform. Use the count measured on the final revision. CI run
There was a problem hiding this comment.
Thanks for restoring the Sponsors copy and adding the custom-manifest regression. I started CI and CodeQL on this revision.
Let's keep rapid-tool-denials as the single default alert ID so existing SIEM filters keep working. The proposed Python rule can still report one high finding at four denials and include all the event IDs. Run it with the packaged manifest and remove the duplicate packaged YAML entry. Let replacement manifests keep their own rule, threshold, and severity, including the choice to omit it.
Please keep the existing three-, four-, and five-denial tests, cover a custom manifest both with and without the rule, and regenerate the Sigma rule for rapid-tool-denials. Keep the shipped ATT&CK mapping where the rule semantics support it. The high-severity Sigma rule should also match the event's severity so it doesn't elevate a custom low-severity alert with the same ID. Please update the PR description and the README from the final test collection.
The corpus on this head has 107 cases (54 attack, 53 benign) after #490. CI found that the README still lists 106. Please refresh the benchmark block on the final revision. CI run
Report the packaged denial burst under rapid-tool-denials, keep replacement manifests independent, and regenerate the high-severity Sigma rule. Refresh measured corpus and test counts for blitzcrieg1#486.
Fixes #1. Thanks to rumangsanya for the detector and paired corpus fixtures.
Current behavior
rapid-tool-denialsfinding at four deniedtool_calledevents and includes the supporting event IDs. Existing consumers keep the same rule ID and ATT&CK mapping.rapid-tool-denialsat high severity. This preserves lower-severity routing for custom manifests.Validation on
3218c7ab8902cf12243cc36to0fe872d176eddd56.Original contribution description and earlier validation
Fixes #1. Contributed under the bounty program in #454 — happy with the current terms (recognition + priority review now, cash when a funding round lands); no amount is being asked for.
What this adds
rule_repeated_denialsindetection/rules.py, exactly as #1 specifies: a pure function that fires when a session has ≥4tool_calledevents withaction.outcome == "denied", aggregated into oneDetection(severityhigh) listing all offendingevent_ids. Registered inREGISTRYandBUILTIN_RULE_IDSasrepeated-denials.Scope choices, stated openly:
tool_calleddenials count.approval_responsedenials are a human answering a prompt —approval-denied-then-executedalready covers that shape with a stronger claim, and counting both would double-report those sessions. A test pins this.manifest.yamlis on the frozen list, so the ≥4 from New detection rule: repeated-denials (agent probing a guardrail) #1 lives in the rule asREPEATED_DENIALS_MINinstead of a new tunable.rapid-tool-denials(analyst count rule,min_count: 5, medium) already covers this shape at a higher bar. This PR is the built-in New detection rule: repeated-denials (agent probing a guardrail) #1 asks for, at ≥4/high. The attack corpus case sits at exactly 4 denials so it pins the built-in's bar alone; at 5 both fire. If you'd rather retire one of them, say which and I'll fold that into this PR.Corpus (#454 requirements)
attack_repeated_denials.jsonl— 4 denied tool calls in under a minute, ask varying between shell and file tools. Expect[repeated-denials].benign_denied_retries_below_threshold.jsonl— 3 denials while an agent retries a gated write, then back to reading. Expect[].agentmetry_rule_repeated_denials.yml), rule added todocs/detection-rules.mdand the Sentinel page, README "Checked claims" block refreshed.Validation
The 8 failures are
test_forwarder.py/test_trail_chain.pyand fail identically on the unmodified tree (verified by stashing this change and re-running them) — they are not touched by this PR.New tests: fires at 4 denials (one detection, high, 4 event ids), silent at 3, silent on
approval_responsedenials.