CVE-2026-107294: Pydantic AI: Unbounded memory use when downloading remote content via web_fetch or FileUrl
Summary
Several remote-content download paths in Pydantic AI buffered the entire HTTP response body into memory before enforcing any size limit. An application that exposes the local web-fetch tool (webfetchtool, or the WebFetch capability's local fallback) to untrusted prompts can be driven to fetch an attacker-chosen URL that streams a very large body, exhausting process memory and crashing the worker. The same unbounded buffering applied to FileUrl media downloads (ImageUrl, DocumentUrl, VideoUrl, AudioUrl).
This is an availability issue only. SSRF protections (scheme allowlist, private-IP and cloud-metadata blocking) are unaffected; there is no confidentiality or integrity impact.
Details
The download helpers read the full response body before applying content-size controls, so an existing text-length limit only truncated after the whole body was already in memory, and media downloads had no wire-level cap at all. A single large response could grow process memory without bound .
Who Is Affected
You are affected if your application registers the local web-fetch tool (or relies on the WebFetch capability's local fallback) and exposes the agent to untrusted prompts, or if it downloads large remote FileUrls influenced by untrusted input. Applications that only fetch developer-controlled URLs are not exposed to the model-chosen attack path.
Remediation
Upgrade to 2.24.0 or later (v2) or 1.107.2 or later (v1). Patched versions enforce a default 50 MiB cap on web-fetch and FileUrl downloads while streaming; pass None to the limit to restore the previous unbounded behavior.
Credits
Identified during internal review of media-download hardening.
Other sources
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 1.77.0 until 1.107.2 and 2.24.0, webfetchtool, the WebFetch local fallback, and remote FileUrl media downloads buffer the complete HTTP response body before enforcing content-size controls. An attacker-influenced URL can stream an arbitrarily large response that exhausts process memory and crashes the worker; affected media types include ImageUrl, DocumentUrl, VideoUrl, and AudioUrl. SSRF protections remain effective, and the impact is limited to availability. This issue is fixed in versions 1.107.2 and 2.24.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pydantic-ai-slimto a version that resolves this vulnerability.Fixed in 2.24.0 - Upgrade
Upgrade
pip/pydantic-ai-slimto a version that resolves this vulnerability.Fixed in 1.107.2 - Upgrade
Upgrade
pip/pydantic-aito a version that resolves this vulnerability.Fixed in 2.24.0 - Upgrade
Upgrade
pip/pydantic-aito a version that resolves this vulnerability.Fixed in 1.107.2 - Upgrade
Upgrade
Pydantic AI v1to a version that resolves this vulnerability.Fixed in 1.107.2 - Upgrade
Upgrade
Pydantic AI v2to a version that resolves this vulnerability.Fixed in 2.24.0
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Applications are affected when they register the local web-fetch tool or use the WebFetch capability's local fallback and expose the agent to untrusted prompts. FileUrl media download paths are also affected for ImageUrl, DocumentUrl, VideoUrl, and AudioUrl.
What does an attacker need to trigger the issue?
An attacker needs the ability to cause the application to fetch an attacker-chosen URL. A URL serving a very large streaming response can cause the worker's memory use to grow until the process crashes.
Does an existing text-length limit prevent memory exhaustion?
No. The affected download helpers buffered the complete HTTP response before applying the text-length limit, so truncation occurred only after the response had already been held in memory.
Does this vulnerability bypass SSRF protections or expose data?
No. Scheme allowlisting and private-IP and cloud-metadata blocking are unaffected, and the reported impact is availability only; there is no stated confidentiality or integrity impact.