Pydantic AI Shows How Message History Can Become Server-Side Fetch Authority
CVE-2026-25580 let untrusted Pydantic AI message history and URL-based attachments cause the application server to fetch attacker-selected addresses. A crafted file URL could reach internal services, link-local cloud metadata, or other destinations unavailable to the external caller. Two later IPv6-transition bypasses affected applications that explicitly allowed local downloads. The case shows that a serialized conversation is not passive history when replaying it invokes server-side I/O.
Threat Analysis
- The active input was a replayable conversation object. An application accepting untrusted message history could receive a URL-backed image, audio, video, or document. Pydantic AI's
download_item()then fetched that URL with the server's network access. - The original issue required attacker-controlled history or URL parts. A file URL could point to localhost, a private service, or cloud metadata. Applications using only hardcoded or developer-controlled URLs were not affected by this path. Version 1.56.0 added scheme, address, DNS, and redirect checks.
- Two narrower bypasses followed. CVE-2026-46678 and CVE-2026-48782 used IPv6 transition forms, but only when an application explicitly applied
force_download='allow-local'to attacker-influenced input. Bundled adapters did not propagate that option, and some forms also required NAT64 or ISATAP routing. Fixes arrived in 1.99.0, 1.102.0, and 2.0.0b3. - The advisories establish exploitability, not observed abuse. There is currently no public evidence that these attack paths have been used in actual attacks.
Applicable AIDEFEND Defenses (4)
force_download or an equivalent local-fetch override. This removes unsafe authority from the serialized request, but a syntactically valid URL still needs the dedicated safe-fetch checks in AID-H-019.001.What Defenders Should Do Now
- Upgrade
pydantic-aiandpydantic-ai-slimto the current supported release across every web, AG-UI, Vercel AI, and custom adapter deployment. Verify the effective package and image digest, not only a lockfile change. - Find every API that accepts serialized message history or URL-backed media and documents. Reject caller-controlled
force_download,allow-local, or equivalent policy overrides. - Test safe fetch with loopback, RFC1918, link-local metadata, IPv4-mapped IPv6, 6to4, NAT64, ISATAP, DNS rebinding, and redirect chains. Confirm the address checked is the address actually contacted.
- Apply workload-level default-deny egress and explicitly block cloud metadata routes. Permit only the external hosts the application needs, through a controlled proxy where practical.
- Review outbound and metadata-service logs for suspicious requests. Rotate a credential only when evidence shows that specific secret was returned or exposed; SSRF potential alone is not proof of credential loss.
Conclusion
The important boundary is not “chat text versus file upload.” It is whether untrusted conversation data can make the server perform I/O under its own network authority. AIDEFEND maps this path to supported-version remediation, strict message schemas, SSRF-safe URL handling, and independently enforced egress. Treat replayable history as active input whenever restoring it can fetch, open, execute, or otherwise act.