AAK-MCP-MARKETPLACE-CONFIG-FETCH-001
MCP server config fetched from a marketplace URL and spawned
| Field | Value |
|---|---|
| Severity | CRITICAL |
| Category | SUPPLY_CHAIN |
| Shipped | v0.3.6 (2026-04-26) |
| Scanner | agent_audit_kit/scanners/mcp_marketplace_fetch.py |
| CWE | CWE-829 + CWE-78 |
| OWASP MCP | MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering); MCP05:2025 (Command Injection & Execution) |
| OWASP Agentic | ASI04 (Agentic Supply Chain Vulnerabilities); ASI05 (Unexpected Code Execution (RCE)) |
| AICM | AIS-08, STA-02 |
| Incidents | OX-MCP-2026-04-25, CLOUDFLARE-MCP-DEFENDER-2026-04-25 |
What it catches
A function fetches a remote URL (requests.get, httpx.get,
urllib.request.urlopen, fetch) and pipes the JSON / text return
value into StdioServerParameters(...) /
new StdioClientTransport({...}) in the same function or one frame
deep.
Cloudflare's MCP-defender reframe (2026-04-25) called this out as the highest-risk single-line bug in the wild. A marketplace compromise becomes client-side RCE on every consumer at the next refresh.
Detection
Python AST:
- For each function, collect calls sorted by source line.
- First fetch-call (
requests/httpx/urllib/urlopen) sets afetch_seenflag and captures the URL constant if any. - A subsequent
StdioServerParameters/StdioClientTransportcall in the same function fires the rule.
TypeScript: regex pass for await fetch(...) followed within 2KB by
new Stdio*Transport.
Suppression
Add to .aak-mcp-marketplace-trust.yml:
trust:
- url: "https://internal-registry.corp.example/mcp/manifest"
justification: "Internal artifact registry; signatures verified separately."
Trust entries without a non-empty justification: do not suppress.
Remediation
Cache the response, sign it, verify the signature on load, and pin
command to a constant binary path regardless of what the manifest
says:
def load_pinned() -> StdioServerParameters:
return StdioServerParameters(command="/usr/bin/server-a", args=[])
Registry reference
This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.
- Severity
- CRITICAL
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/mcp_marketplace_fetch.py- Auto-fixable
- No.
- SARIF name
McpMarketplaceConfigFetch
What it detects
A function fetches a remote URL (requests.get / httpx.get / urllib.request.urlopen / fetch) and pipes the JSON / text return value into StdioServerParameters(...) or new StdioClientTransport({...}) in the same function or one frame deep. The OX MCP April-2026 disclosure plus Cloudflare's MCP-defender reframe both call this out as the canonical supply-chain inversion: a marketplace compromise becomes client-side RCE on every consumer at the next refresh. Suppress with an entry in .aak-mcp-marketplace-trust.yml.
How to fix
Never feed a fetched marketplace manifest directly into StdioServerParameters. Cache the response, sign it, verify the signature on load, and pin command to a constant binary path regardless of what the manifest says. If the manifest URL is trusted (e.g. an internal artifact registry), add it to .aak-mcp-marketplace-trust.yml with a justification: field.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-MARKETPLACE-CONFIG-FETCH-001
Limitations
Python: reports a get, post, request or urlopen call on requests, httpx or urllib (or a bare urlopen) followed, in the same function, by a StdioServerParameters or StdioClientTransport call, without checking that the fetched value reaches it. A request made through a session object (session = requests.Session(); session.get(url)) or in a different function is not seen. TypeScript: needs await fetch( within 2 KB before a new Stdio*Transport, so axios.get and fetch(...).then(...) are not matched. A source file over 512 KB, or a trust file over 1 MB, is not read.
References
- OWASP MCP Top 10: MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering), MCP05:2025 (Command Injection & Execution)
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities), ASI05 (Unexpected Code Execution (RCE))
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-SUPPLY-03 (Unpinned MCP Package)
- Incidents and advisories: OX-MCP-2026-04-25, CLOUDFLARE-MCP-DEFENDER-2026-04-25
- CSA AI Controls Matrix (AICM): AIS-08, STA-02