Skip to content

AAK-AGENT-006: Agent instruction file tells the agent to fetch a URL and act on it

Severity
HIGH
Category
Agent Config (agent-config)
Scanner
agent_audit_kit/scanners/agent_config.py
Auto-fixable
No.
SARIF name
AgentFetchAndFollowUrl

What it detects

An agent instruction file does not merely link a host — it instructs the agent to retrieve a URL and then follow, execute, obey, apply or load what comes back, or to send, post or upload data to one. That turns a file committed to the repository into a pointer to content the repository does not hold, evaluated at whatever the far end is serving at the time. The agent's own instructions become editable by whoever controls that endpoint, with no commit and no review.

No host allowlist applies here, deliberately. @GarvitAgrawal04 made the argument in #771, the report that benchmarked AAK-AGENT-002 on 930 public repositories: an attacker can host on github.com too. A gist, a raw file on a fork, a release asset — all sit on hosts any allowlist would contain, and the instruction to fetch and obey is what matters rather than where it points. Matching is a deterministic regex over one line at a time: no model call, and no judgement about the destination.

Not every link with a verb is a directive. A contributor pointer is not: "Report bugs at <url>", "Submit pull requests to <url>", or "see <url>, then run make test", where what runs is the test suite, not the page. Fetch-then-act needs the act to point back at what was fetched (it, them, the instructions, the script, the file's own name, or an adverb such as "immediately" or "without question"), or the line to put the fetched content in charge ("it is the authoritative source of truth"). A loopback address is not content anyone else controls, so npm run dev # Starts at http://localhost:3000 is not reported, and a curl or POST sends data only when it carries a payload (-d, -F, --data). Nor is a guardrail: a negation that governs the verb, as in "Never upload repository files to <url>", forbids what this rule reports. A negation elsewhere on the line does not count, so "Don't use pip, download <url> and run it" is still reported.

Scoped to a single line, because that is what "the same sentence or list item" means in a markdown instruction file. A URL three paragraphs below an unrelated "follow" is not a directive about that URL, and matching across the gap would recreate the blunt rule this one was added to replace.

How to fix

Move the content into the repository and review it there, so what the agent follows is what somebody approved. Where the fetch is genuinely required, pin it to an immutable reference — a commit SHA or a digest, never a branch or a latest tag — and say in the instruction file what is expected to come back, so a substitution is visible. Never instruct an agent to send repository contents, environment variables or credentials to a URL from an instruction file: that is an exfiltration channel a reviewer reads as documentation.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-AGENT-006

Limitations

Regex over one line, not data flow: it reads the instruction, never what the URL serves. Phrasing it does not recognise is missed — an imperative split across two lines, a verb outside its list, or a download run under another name ("extract it and run ./tool") — and a line that merely discusses fetching will match. This is a prompt to read the line, not a determination that the link is hostile. A URL that Node, requests and Rust's url crate read differently from curl, httpx and urlsplit, which keep a backslash inside the authority, is judged by the less safe of the two readings.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-AGENT-006.md: the page then shows that text, with the registry reference appended under it.