Skip to content

No model strike for a user agent alone; payload signatures it exposed - #13

Merged
FMXExpress merged 2 commits into
mainfrom
agent-only-guard
Nov 15, 2026
Merged

FMXExpress merged 2 commits into
mainfrom
agent-only-guard

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Fixes the false ban found in iteration 9. Flash 9B banned an uptime monitor (Go-http-client, GET / every five minutes, status 200): it scored five separate requests at 0.80–0.84, and each fresh verdict counted as a strike of its own.

The guard

If a request's only signature hits come from user-agent rules and it was answered below 400, a model verdict on it is at most REVIEW, never a strike. The log marks these user agent only: no strike. A user agent says who a client is, not what it's doing.

Unchanged:

  • hard rules: scanner agents still ban at once;
  • rules mode;
  • requests with evidence of their own: a 4xx, a login, a known-bad path, or a payload a signature knows.
Benign banned Attackers Attack requests through
Flash 9B, static site, before 1 / 72 49 / 52 164
Flash 9B, static site, with the guard 0 / 72 49 / 52 160
Gemini, WordPress / static / web app 0 / 0 / 0 46 / 49 / 44 (unchanged) unchanged
Gemini, LogarX (real) 0 / 789 126 / 126 457 → 458

What evaluating it turned up

On LogarX, the guard first held back a real SQL injection attacker. Its payloads (" AND 1=1-- and " AND 1=(SELECT ...) in a search query) slipped the sqli signature, which only knew the single-quote form. So those requests looked like a Go client and nothing else, and Gemini's 0.99 became REVIEW.

Narrowing the guard, for example to requests without a query string, would expose benign API clients polling /api/stock?id= that Gemini scores 0.52–0.58. So the guard stays, and the signatures are the fix:

  • sqli: now matches double quotes and and n=(select (also without quotes, for numeric parameters).
  • shell-inject: adds id, whoami, uname, hostname, ifconfig, ping.
  • template-inject (new, weight 10): {{7*7}}, ${7*7}, <%= 7*7 %>, {{config}}-style probes.

Rules-only results: unchanged on every synthetic split. On LogarX, 438 → 440 attack requests caught, still 0 benign banned. The one extra request through on LogarX is that attacker's ordinary page view (/p/8), which carries no evidence of its own.

Also fixed

The strike label counted strikes that had already expired, logging "strike 3/3" with no ban. It now counts only strikes inside findtime.

Tests

  • Deterministic guard test, in CI: tests/guard_access.log run against the mock at MOCK_P=0.95 (a model sure of everyone). main bans the monitor, the password guesser and the curl prober; this branch bans the last two and logs the monitor as REVIEW.
  • Unit tests: 216 checks, 0 failed. 14 are new: the new payloads, benign lookalikes (a quoted search phrase, |identity, a {{name}} placeholder), and the user agent's share of the score.
  • Notes: bench/results/iter10-agent-guard/README.md.

Generated by Claude Code

A request whose only signature hits come from user-agent rules and that was
answered below 400 gets at most REVIEW from a model verdict, never a strike.
A user agent is an identity, not an act. On the static benchmark, Flash 9B
banned an uptime monitor (Go-http-client, GET / 200 every five minutes) on
five separate verdicts at 0.80-0.84. Hard rules, rules mode and anything
with its own evidence (a 4xx, a login, a known path) are unchanged.

tests/guard_access.log with the mock at MOCK_P=0.95 (a model sure of
everyone): main bans the monitor, the password guesser and the prober; this
branch bans the last two and logs the monitor as REVIEW. CI runs it.

Also: the strike label counts only strikes inside findtime (it said 3/3
for strikes that had expired, with no ban).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJFY41846T15QqxmGW2
Evaluating the user-agent guard on LogarX showed a real SQL injection
attacker whose payloads (" AND 1=1--, " AND 1=(SELECT ...)) no signature
knew, so the guard held back the model's 0.99. Narrowing the guard would
expose benign API polling (Gemini 0.52-0.58); the signatures are the fix:
sqli takes double quotes and and n=(select; shell-inject takes id, whoami,
uname, hostname, ifconfig, ping; template-inject (weight 10) is new. Rules
alone: synthetic splits unchanged, LogarX 438 -> 440 caught, 0 benign.

Flash 9B on the static split with the guard: 0 benign banned (was 1), same
attackers. 216 checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJFY41846T15QqxmGW2
@FMXExpress
FMXExpress merged commit 83e3ced into main Nov 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants