Skip to main content
Vulnerability Database/CVE-2026-107290

CVE-2026-107290: Pydantic AI DoS Vulnerability

CVE-2026-107290 is a denial of service vulnerability in Pydantic AI that allows attackers to block the event loop through quadratic title extraction and whitespace normalization. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107290 Overview

CVE-2026-107290 is a denial-of-service vulnerability in Pydantic AI, a Python agent framework for building Generative AI applications and workflows. The flaw affects the local web_fetch_tool and the WebFetch local fallback, which process server-controlled responses using quadratic title extraction, whitespace normalization, and ordered-list numbering. An attacker-controlled page of modest size can block the event loop for extended periods, stalling other agent runs and requests. Unsupported codecs or excessive HTML or JSON nesting can also abort an individual run. The issue is classified under CWE-1333 (inefficient regular expression complexity) and fixed in versions 1.107.6 and 2.44.0.

Critical Impact

A single malicious web response can stall the agent event loop, causing cascading availability failures across concurrent agent runs and dependent requests.

Affected Products

  • Pydantic AI versions 1.77.0 through 1.107.5
  • Pydantic AI versions 2.0.0 through 2.43.x
  • Any Python application using web_fetch_tool or WebFetch local fallback in the affected versions

Discovery Timeline

  • 2026-10-08 - CVE-2026-107290 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-107290

Vulnerability Analysis

The vulnerability resides in the local web_fetch_tool and the WebFetch fallback within pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py. When Pydantic AI processes an HTTP response, it performs three operations with poor algorithmic complexity: HTML title extraction, whitespace normalization, and ordered-list numbering. Each operation exhibits quadratic time complexity relative to input length. An attacker who controls a page the agent fetches can craft modest-sized content that disproportionately consumes CPU time. Because these operations run on the asyncio event loop, they block all other coroutines in the same process. Concurrent agent runs, pending model calls, and inbound requests stall until the handler returns. Separately, unsupported text codecs (such as idna or rot_13) and deeply nested HTML or JSON structures raise exceptions that terminate the individual run.

Root Cause

Two defects combine to produce the issue. First, synchronous CPU-bound string processing executes directly on the event loop instead of in a worker thread. Second, the parsing routines use non-linear algorithms that amplify input size into disproportionate processing time. The response decoding step also lacked handling for LookupError, allowing non-text codec labels to crash the run.

Attack Vector

Exploitation requires an agent to issue a web_fetch or WebFetch call against an attacker-controlled URL. This commonly occurs when a prompt instructs the agent to summarize or analyze an external resource. The attacker returns a response whose title tag, whitespace patterns, or ordered-list markup triggers the quadratic parsers. No authentication to Pydantic AI itself is required beyond the ability to influence which URL the agent fetches.

python
         title = ''
 
         if not media_type or is_text_like_media_type(media_type):
+            # The server picks the charset, and decoding costs time proportional to the body, or
+            # worse for some codecs, so run it in a worker thread rather than on the event loop.
             try:
-                text = response.text
-            except UnicodeError as e:
-                # The server picks the charset, and not every registered codec can decode a
-                # document (`idna`, say), so don't let a bad label take the run down.
+                text = await run_in_executor(_decode_text, response)
+            except (UnicodeError, LookupError) as e:
+                # Not every registered codec can decode a document (`idna`, say), and some aren't
+                # text encodings at all (`rot_13`), so don't let a bad label take the run down.
                 raise ModelRetry(f'Failed to decode {url}: {e}') from e
 
             if media_type in ('text/markdown', 'text/x-markdown'):

Source: Pydantic AI Commit 2faa6181. The patch moves response decoding into a worker thread via run_in_executor and catches LookupError alongside UnicodeError.

Detection Methods for CVE-2026-107290

Indicators of Compromise

  • Agent processes showing extended CPU saturation on a single thread while handling web_fetch requests
  • Pydantic AI logs containing ModelRetry errors referencing failed decoding of fetched URLs
  • Repeated outbound requests from agent workers to the same low-reputation host returning oversized or malformed HTML
  • Event loop lag warnings or timeouts in asyncio-based agent services

Detection Strategies

  • Monitor Python agent processes for sustained single-core CPU usage correlated with outbound HTTP fetches
  • Instrument the asyncio event loop to log tasks exceeding a bounded wall-clock duration
  • Review application logs for UnicodeError or LookupError exceptions raised from web_fetch.py
  • Correlate agent run failures with the domains supplied in user prompts to identify attacker-controlled sources

Monitoring Recommendations

  • Track Pydantic AI version strings across deployed services and flag any instance below 1.107.6 or 2.44.0
  • Alert on agent run durations that exceed a baseline for the specific tool, especially web_fetch_tool
  • Capture egress HTTP response sizes and content types for agent workers to spot anomalous payloads

How to Mitigate CVE-2026-107290

Immediate Actions Required

  • Upgrade Pydantic AI to version 1.107.6 or 2.44.0 across all agent deployments
  • Audit agent tool configurations and disable web_fetch_tool where it is not required
  • Restrict agent outbound HTTP access to an allowlist of trusted domains until patches are applied
  • Review recent agent run logs for failed decodings or unusually long tool invocations

Patch Information

The maintainers released fixes in Pydantic AI v1.107.6 and Pydantic AI v2.44.0. The relevant pull requests include PR #8397, PR #8399, PR #8418, and PR #8434. Full details are documented in the GHSA-fpf4-vwcp-v4hp advisory.

Workarounds

  • Replace the built-in web_fetch_tool with a custom tool that enforces strict response size limits and timeouts
  • Place an HTTP proxy in front of agent workers to cap response bodies and reject unsupported content encodings
  • Run agent instances with per-task CPU and wall-clock quotas to contain the impact of a stalled event loop
bash
# Upgrade Pydantic AI to a patched release
pip install --upgrade 'pydantic-ai>=1.107.6'
# or for the 2.x line
pip install --upgrade 'pydantic-ai>=2.44.0'

# Verify installed version
python -c "import pydantic_ai; print(pydantic_ai.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.