CVE-2026-107290
Denial‑of‑service via crafted page causing event‑loop block in Pydantic AI.
- CVSS 6.5
- CWE-1333
- 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.6 and 2.44.0, the local web_fetch_tool and the WebFetch local fallback process server-controlled responses with quadratic title extraction, whitespace normalization, and ordered-list numbering. An attacker-controlled page of modest size can therefore block the event loop for an extended period, stalling other agent runs and requests, while unsupported codecs or excessive HTML or JSON nesting can abort an individual run. This issue is fixed in versions 1.107.6 and 2.44.0.
- CWE
- CWE-1333
- CVSS base score
- 6.5
- Published
- 2026-10-08
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- 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.6 (or later) or to version 2.44.0 (or later).
Vulnerable code sample
import re
from typing import List
def extract_titles(html: str) -> List[str]:
# VULNERABLE: quadratic title extraction can be abused to stall the event loop
titles = []
# naive split and strip loop causing O(n^2) behavior on large inputs
lines = html.splitlines()
for i in range(len(lines)):
line = lines[i].strip()
if line.lower().startswith("<title>"):
# strip tags in a costly way
title = line
while not title.endswith("</title>"):
i += 1
title += " " + lines[i].strip()
title = re.sub(r"</?title>", "", title)
titles.append(title)
return titlesPatched code sample
import re
from typing import List
def extract_titles(html: str) -> List[str]:
# FIX: use a single-pass regex to avoid quadratic processing
pattern = re.compile(r"<title>(.*?)</title>", re.IGNORECASE | re.DOTALL)
return [m.group(1).strip() for m in pattern.finditer(html)]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.
- Decode `web_fetch` response bodies in a worker thread and treat non-text charsets as failed fetches (v1 backport) (#8434) (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__ - Decode `web_fetch` response bodies in a worker thread and treat non-text charsets as failed fetches (#8433) (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__ - Extract the `web_fetch` page title with a linear scan and convert HTML in linear time in a worker thread (v1 backport) (#8399) (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 · _extract_title - Extract the `web_fetch` page title with a linear scan and convert HTML in a worker thread (#8397) (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__ - Normalize whitespace and number lists in linear time in `web_fetch`'s markdown conversion (#8418) (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 · _convert_html
Cite this entry
@misc{vaitp:cve2026107290,
title = {{Denial‑of‑service via crafted page causing event‑loop block in Pydantic AI.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-107290},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-107290/}}
}
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 ::
