feat(web-security): add frontend_honeypot_guard hook for agent-target… - #123
Open
GangGreenTemperTatum wants to merge 1 commit into
Open
Conversation
…ed lure detection
Some web applications deliberately embed instructions aimed at AI agents in
frontend HTML — hidden comments, display:none divs, JS strings, image alt
text, data-* attributes, SSE streams, or JSON payloads. The canonical lure
tells the agent to POST its prompt, current task, and local dev/setup
details to a "helper" endpoint and claims the page itself grants
permission. This hook detects those lures in tool output and denies the
follow-on exfiltration requests.
Two coordinated reactions:
- ToolEnd: scans external tool output for high-confidence honeypot shapes
and injects a corrective Continue reminder (URL-redacted excerpt, framed
as untrusted evidence). Deduped per digest; warns once per unique lure.
- ToolStart: denies side-effecting HTTP calls (POST/PUT/PATCH/DELETE, and
GET with data-carrying query strings) that target a previously detected
honeypot endpoint or independently match the exfiltration shape, across
execute_http, curl/wget/httpie, python requests/httpx, JS fetch/axios,
raw HTTP replay, and agent-browser run argument lists.
Detection model: composable signal categories gated on genuine agent
address (second-person, vocative, or labelled "note for AI agents" forms —
determiner-qualified third-person mentions do not count) or a contiguous
live exfiltration verb chain. Homoglyphs (Cyrillic/Greek/fullwidth),
zero-width characters, leet substitutions, and whitespace-split keywords
are folded before matching. Meta-discussion guards keep articles, payload
libraries (code-fenced), and reported speech ("telling the model to post
your prompt") silent.
Adversarial hardening from peer review:
- Endpoint tracking pins the lure's own primary URL so URL-flood pages
cannot evict it from the bounded tracking list.
- GET-based exfiltration via query-string carriers is blocked.
- The warning excerpt strips backticks (no feedback-string breakout) and
redacts URLs; attacker text is always framed as data.
- Malformed bracketed-host URLs no longer crash the scan (found by
scanning this capability's own skill corpus.
Performance: ~1.3ms for a typical 5KB tool result, ~43ms worst-case for a
160KB lure-laden page, with a capped tail-gate pass for lures buried deep
in oversized pages. State is per-agent, lock-guarded, cleared on AgentEnd.
Validated against a 25-case malicious mutation corpus and a 22-case benign
lookalike corpus (API docs, support pages, third-person articles, research
prose, quoted payloads, benign agent onboarding docs), plus a full sweep of
this capability's own 127 skill/agent/tool files: zero false positives.
EOF
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ed lure detection
Some web applications deliberately embed instructions aimed at AI agents in frontend HTML — hidden comments, display:none divs, JS strings, image alt text, data-* attributes, SSE streams, or JSON payloads. The canonical lure tells the agent to POST its prompt, current task, and local dev/setup details to a "helper" endpoint and claims the page itself grants permission. This hook detects those lures in tool output and denies the follow-on exfiltration requests.
Two coordinated reactions:
Detection model: composable signal categories gated on genuine agent address (second-person, vocative, or labelled "note for AI agents" forms — determiner-qualified third-person mentions do not count) or a contiguous live exfiltration verb chain. Homoglyphs (Cyrillic/Greek/fullwidth), zero-width characters, leet substitutions, and whitespace-split keywords are folded before matching. Meta-discussion guards keep articles, payload libraries (code-fenced), and reported speech ("telling the model to post your prompt") silent.
Adversarial hardening from peer review:
Performance: ~1.3ms for a typical 5KB tool result, ~43ms worst-case for a 160KB lure-laden page, with a capped tail-gate pass for lures buried deep in oversized pages. State is per-agent, lock-guarded, cleared on AgentEnd.
Validated against a 25-case malicious mutation corpus and a 22-case benign lookalike corpus (API docs, support pages, third-person articles, research prose, quoted payloads, benign agent onboarding docs), plus a full sweep of this capability's own 127 skill/agent/tool files: zero false positives. EOF
)