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-107288 Overview
CVE-2026-107288 is a Server-Side Request Forgery (SSRF) vulnerability [CWE-918] in Pydantic AI, a Python agent framework for building Generative AI applications and workflows. The flaw affects the web_fetch_tool and the WebFetch local fallback across versions 1.77.0 through 1.107.5 and 2.0.0 through 2.43.x. The tool compares blocked_domains entries against the URL hostname before both values are normalized to the form used by getaddrinfo. An attacker-influenced model can supply an equivalent IDNA spelling, a non-ASCII label separator, a case variation, or a trailing root label that resolves to a blocked host without matching the configured string.
Critical Impact
An attacker-controlled model can cause the application to fetch arbitrary blocked hosts using the application's own privileges, bypassing blocked_domains controls. Private-IP and cloud-metadata protections remain effective.
Affected Products
- Pydantic AI versions 1.77.0 through 1.107.5
- Pydantic AI versions 2.0.0 through 2.43.x
- The web_fetch_tool and the WebFetch local fallback components
Discovery Timeline
- 2026-10-08 - CVE-2026-107288 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-107288
Vulnerability Analysis
The vulnerability resides in the hostname comparison logic used by the web_fetch_tool in pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py and the related SSRF guard in pydantic_ai_slim/pydantic_ai/_ssrf.py. The framework compared raw hostnames supplied by the model against blocked_domains entries using string equality. However, DNS resolution via getaddrinfo applies IDNA encoding, case folding, and trailing dot removal before resolving the name.
Because the pre-normalization comparison does not account for these transformations, multiple distinct string representations resolve to the same destination host. An allowed_domains list fails closed under this bug, since unmatched spellings are rejected. A blocked_domains list fails open, because an equivalent but non-matching spelling slips past the filter and is then resolved and fetched.
Root Cause
The root cause is inconsistent normalization between the policy enforcement point and the resolver. The hostname passed to getaddrinfo is lowercased, IDNA-encoded, and stripped of trailing root labels, but the hostname compared against blocked_domains is not. The patch introduces a shared normalization routine that case-folds the address portion, converts non-ASCII label separators to ., applies IDNA encoding, and strips the trailing dot before comparison.
Attack Vector
Exploitation requires an attacker to influence the URL argument passed to the web_fetch_tool, typically via prompt injection against the underlying model. The attacker crafts a hostname using an IDNA-equivalent spelling, mixed case, a non-ASCII Unicode label separator (such as U+3002 or U+FF0E), or a trailing . to bypass the blocklist. The application then issues the HTTP request with its own credentials, headers, and network position.
# Security patch — pydantic_ai_slim/pydantic_ai/_ssrf.py
# Fold only the address, not the zone, in the web_fetch_tool domain-list key (#8421)
for separator in _IDNA_LABEL_SEPARATORS:
host = host.replace(separator, '.')
address, separator, zone = _normalized_host(host).partition('%')
# Only the address is case-folded. A zone identifier names an interface and is
# case-sensitive, so `fe80::1%25eth0` and `fe80::1%25ETH0` are different destinations
# and must not collapse to one key -- an `allowed_domains` entry for one would
# otherwise authorize the other.
host = address.lower() + separator + zone
try:
return host.encode('idna').decode('ascii').rstrip('.')
except UnicodeError:
...
# Source: https://github.com/pydantic/pydantic-ai/commit/490335f8e2322e143a79337ddca9410e0176c812
# Security patch — pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py
# Compare web_fetch_tool domain lists in the form the resolver uses (#8407)
allowed_domains: list[str] | None = field(default=None)
"""Only fetch from these domains (exact hostname match, ignoring case, a trailing dot, and IDNA spelling).
Raises `ModelRetry` on violation.
"""
blocked_domains: list[str] | None = field(default=None)
"""Never fetch from these domains (exact hostname match, ignoring case, a trailing dot, and IDNA spelling).
Raises `ModelRetry` on violation.
"""
# Source: https://github.com/pydantic/pydantic-ai/commit/c1f212a084cbfa0012f2044cdb4731d214b3b983
Detection Methods for CVE-2026-107288
Indicators of Compromise
- Outbound HTTP(S) requests originating from Pydantic AI agent processes to hostnames containing non-ASCII characters, Punycode (xn--) labels, or trailing dots.
- Agent-initiated requests to hosts that match a configured blocked_domains entry when compared after IDNA and case normalization.
- ModelRetry exceptions absent from logs despite model-generated URLs targeting restricted hosts.
Detection Strategies
- Instrument the HTTP client used by web_fetch_tool to log the pre-resolution hostname and the resolved IP address for every outbound request.
- Compare logged hostnames against the configured blocked_domains list after applying .encode('idna').decode('ascii').rstrip('.').lower() normalization, and alert on matches.
- Review model prompt and tool-call telemetry for URLs containing Unicode label separators (U+3002, U+FF0E, U+FF61) or mixed-case internationalized domain names.
Monitoring Recommendations
- Monitor egress from hosts running Pydantic AI agents and baseline the expected destination domains per workload.
- Enforce DNS logging on agent hosts and correlate resolution events with application tool-call logs to identify blocklist bypass attempts.
- Track the installed version of the pydantic-ai and pydantic-ai-slim packages across environments and flag any instance below 1.107.6 or 2.44.0.
How to Mitigate CVE-2026-107288
Immediate Actions Required
- Upgrade pydantic-ai and pydantic-ai-slim to version 1.107.6 or 2.44.0 on every host that runs the web_fetch_tool or the WebFetch local fallback.
- Audit all agent configurations that rely on blocked_domains and treat the control as bypassable until the patch is deployed.
- Rotate any credentials or tokens that the agent process could have forwarded to an unintended host during the exposure window.
Patch Information
The fix is published in Pydantic AI releases v1.107.6 and v2.44.0. The relevant changes land in pull requests #8407, #8409, and #8421. Full technical context is available in the GHSA-22h6-qm39-v87j advisory.
Workarounds
- Prefer allowed_domains over blocked_domains, since the allowlist fails closed for unmatched IDNA and case variants on unpatched versions.
- Restrict outbound network access from agent hosts at the firewall or egress proxy layer so that only approved destinations are reachable.
- Disable the web_fetch_tool and WebFetch fallback in agent configurations where web retrieval is not strictly required.
# Upgrade to a patched release
pip install --upgrade 'pydantic-ai>=1.107.6,<2' \
|| pip install --upgrade 'pydantic-ai>=2.44.0'
pip install --upgrade 'pydantic-ai-slim>=1.107.6,<2' \
|| pip install --upgrade 'pydantic-ai-slim>=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

