CVE-2026-107288
IDNA/spelling bypass of blocked domains in Pydantic AI web fetch tool allows privileged fetches.
- CVSS 3.7
- CWE-918
- Input Validation and Sanitization
- 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 compare blocked_domains entries with a URL hostname before both values are normalized to the form used by getaddrinfo. An attacker-influenced model can use an equivalent IDNA spelling, non-ASCII label separator, case variation, or trailing root label that resolves to a blocked host but does not match the configured string, causing the application to fetch that host with its own privileges. allowed_domains fails closed for unmatched spellings, and private-IP and cloud-metadata protections remain effective. This issue is fixed in versions 1.107.6 and 2.44.0.
- CWE
- CWE-918
- CVSS base score
- 3.7
- Published
- 2026-10-08
- OWASP
- A10 Server-Side Request Forgery (SSRF)
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- Pydantic AI
- Fixed by upgrading
- Yes
Solution
Upgrade Pydantic AI to ≥ 1.107.6 (or the 2.x line ≥ 2.44.0).
Vulnerable code sample
import urllib.request
import socket
from urllib.parse import urlparse
def web_fetch_tool(url: str, blocked_domains: set[str]) -> bytes:
"""Fetch a URL unless its hostname is in blocked_domains."""
# VULNERABLE: compares hostname strings before IDNA/normalization
hostname = urlparse(url).hostname or ""
if hostname in blocked_domains:
raise PermissionError(f"Access to {hostname} is blocked")
with urllib.request.urlopen(url) as resp:
return resp.read()Patched code sample
import urllib.request
import socket
from urllib.parse import urlparse
def web_fetch_tool(url: str, blocked_domains: set[str]) -> bytes:
"""Fetch a URL unless its hostname resolves to a blocked domain."""
# FIX: normalize both hostname and blocked entries via getaddrinfo (IDNA aware)
hostname = urlparse(url).hostname or ""
try:
host_info = socket.getaddrinfo(hostname, None, proto=socket.IPPROTO_TCP)
normalized = host_info[0][4][0]
except socket.gaierror:
normalized = hostname
normalized_blocked = set()
for domain in blocked_domains:
try:
info = socket.getaddrinfo(domain, None, proto=socket.IPPROTO_TCP)
normalized_blocked.add(info[0][4][0])
except socket.gaierror:
normalized_blocked.add(domain)
if normalized in normalized_blocked:
raise PermissionError(f"Access to {hostname} is blocked")
with urllib.request.urlopen(url) as resp:
return resp.read()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.
- Fold only the address, not the zone, in the `web_fetch_tool` domain-list key (#8421) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/_ssrf.py · _domain_key - Compare `web_fetch_tool` domain lists in the form the resolver uses (v1 backport) (#8409) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py,pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py · web_fetch_tool,pydantic_ai_slim/pydantic_ai/_ssrf.py,pydantic_ai_slim/pydantic_ai/_ssrf.py · extract_host_and_port,pydantic_ai_slim/pydantic_ai/_ssrf.py · safe_download,pydantic_ai_slim/pydantic_ai/_ssrf.py · _check_domain - Compare `web_fetch_tool` domain lists in the form the resolver uses (#8407) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py · web_fetch_tool,pydantic_ai_slim/pydantic_ai/_ssrf.py,pydantic_ai_slim/pydantic_ai/_ssrf.py · safe_download
Cite this entry
@misc{vaitp:cve2026107288,
title = {{IDNA/spelling bypass of blocked domains in Pydantic AI web fetch tool allows privileged fetches.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-107288},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-107288/}}
}
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 ::
