VAITP Dataset

← Back to the dataset

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.

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.

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/}}
}

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.