VAITP Dataset

← Back to the dataset

CVE-2026-107294

Memory exhaustion via unbounded HTTP response buffering in web_fetch_tool.

  • CVSS 6.5
  • CWE-400
  • Resource Management
  • Remote

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, web_fetch_tool, 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.

CVSS base score
6.5
Published
2026-10-08
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Pydantic AI
Fixed by upgrading
Yes

Solution

Upgrade Pydantic AI to version 1.107.2 (or later) or 2.24.0 (or later).

Vulnerable code sample

import httpx
from pydantic_ai.tools.web_fetch import WebFetchTool

def fetch_media(url: str) -> bytes:
    # VULNERABLE: buffers entire response before size check
    response = httpx.get(url, timeout=30.0)
    data = response.content  # whole body in memory
    max_bytes = 5 * 1024 * 1024  # 5 MiB limit
    if len(data) > max_bytes:
        raise ValueError("Response exceeds allowed size")
    return data

Patched code sample

import httpx
from pydantic_ai.tools.web_fetch import WebFetchTool

def fetch_media(url: str) -> bytes:
    # FIX: enforce size limit while streaming
    max_bytes = 5 * 1024 * 1024  # 5 MiB limit
    with httpx.stream("GET", url, timeout=30.0) as response:
        response.raise_for_status()
        chunks = []
        total = 0
        for chunk in response.iter_bytes():
            total += len(chunk)
            if total > max_bytes:
                raise ValueError("Response exceeds allowed size")
            chunks.append(chunk)
        return b"".join(chunks)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Bound HTTP response body sizes for `web_fetch` and media URL downloads (#7141) (pydantic/pydantic-ai)
    pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py, pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py · WebFetchLocalTool.__call__, pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py · web_fetch_tool, pydantic_ai_slim/pydantic_ai/models/__init__.py, pydantic_ai_slim/pydantic_ai/models/__init__.py · download_item#3, pydantic_ai_slim/pydantic_ai/_ssrf.py, pydantic_ai_slim/pydantic_ai/_ssrf.py · safe_download
  • Bound HTTP response body sizes for `web_fetch` and media URL downloads (#7308) (pydantic/pydantic-ai)
    pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py · web_fetch_tool, pydantic_ai_slim/pydantic_ai/models/__init__.py, pydantic_ai_slim/pydantic_ai/_ssrf.py · safe_download

Cite this entry

@misc{vaitp:cve2026107294,
  title        = {{Memory exhaustion via unbounded HTTP response buffering in web_fetch_tool.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-107294},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-107294/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.