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-107289 Overview
CVE-2026-107289 is a Server-Side Request Forgery (SSRF) vulnerability in Pydantic AI, a Python agent framework for building Generative AI applications and workflows. The flaw affects versions 1.56.0 through 1.107.5 and 2.0.0 through 2.43.x. Applications that opt attacker-influenced URLs into local network access through FileUrl with force_download='allow-local' or web_fetch_tool with allow_local_urls=True can bypass the cloud-metadata blocklist. An attacker appends an IPv6 zone identifier to an IPv6 metadata address, defeating the equality check while the kernel still routes the request to the metadata service. The issue is tracked under [CWE-918] and resolved in versions 1.107.6 and 2.44.0.
Critical Impact
Successful exploitation can reach cloud instance metadata services (IMDS) and expose IAM credentials, enabling lateral movement into cloud accounts.
Affected Products
- Pydantic AI 1.56.0 through 1.107.5 (fixed in 1.107.6)
- Pydantic AI 2.0.0 through 2.43.x (fixed in 2.44.0)
- Python applications using FileUrl with force_download='allow-local' or web_fetch_tool with allow_local_urls=True in IPv6-enabled environments
Discovery Timeline
- 2026-10-08 - CVE-2026-107289 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-107289
Vulnerability Analysis
Pydantic AI maintains a blocklist of cloud metadata IP addresses, such as the AWS IMDS endpoint, to prevent SSRF attacks against instance metadata services. The guard uses Python's ipaddress.IPv6Address type to compare a requested host against known-dangerous destinations. However, IPv6Address equality and hashing include the RFC 4007 zone identifier (scope_id). An attacker who supplies a metadata address with a trailing zone like fd00:ec2::254%251 produces an object that does not equal the plain fd00:ec2::254 entry in the blocklist. The guard permits the request. The operating system's network stack ignores the zone identifier for non-link-local destinations and delivers the request to the metadata service.
Root Cause
The root cause is inconsistent address normalization between the security guard and the kernel. The blocklist comparison in pydantic_ai/_ssrf.py treats the zone-tagged address as distinct, while the socket layer discards the zone and routes to the base address. This classification mismatch allows the attacker-controlled input to pass validation while still reaching the restricted destination.
Attack Vector
Exploitation requires an IPv6-enabled environment and an application that has explicitly opted into local network access through force_download='allow-local' or allow_local_urls=True. These settings are disabled by default. A remote attacker who can influence a URL fetched by the agent supplies an IPv6 metadata address with an appended zone identifier. The SSRF guard clears the request, and the host reaches the cloud metadata endpoint, potentially returning IAM credentials in the response body consumed by the agent.
The following patch from the upstream fix introduces a _parse_ip helper that strips the zone identifier before any blocklist comparison, ensuring the guard evaluates the address the kernel will actually contact:
def _parse_ip(ip_str: str) -> ipaddress.IPv4Address | ipaddress.IPv6Address | None:
"""Parse an IP address for blocklist comparison, or return `None` if it is not one.
An IPv6 literal may carry a zone identifier (`fd00:ec2::254%251`, RFC 4007 §11), which
Python folds into address equality and hashing. A zone is only meaningful for a
link-local destination — the kernel ignores it for anything else and delivers the
request to the address regardless — so it must never change how a guard classifies
the address. Dropping it once, here, keeps every guard comparing the address itself,
whether it compares by set membership or by network containment.
"""
try:
ip = ipaddress.ip_address(ip_str)
except ValueError:
return None
if isinstance(ip, ipaddress.IPv6Address) and ip.scope_id is not None:
ip = ipaddress.IPv6Address(ip.packed)
return ip
def is_cloud_metadata_ip(ip_str: str) -> bool:
"""Check if an IP address is a cloud metadata/credential endpoint.
These are always blocked for security reasons, even with allow_local=True. IPv6
transition forms are decoded, and zone identifiers dropped, so a metadata IP cannot be
smuggled in as IPv6.
"""
Source: GitHub Commit 02157e1
Detection Methods for CVE-2026-107289
Indicators of Compromise
- Outbound requests from application hosts to cloud metadata addresses such as 169.254.169.254, fd00:ec2::254, or fe80::a9fe:a9fe originating from Pydantic AI processes.
- URLs in agent request logs that contain IPv6 literals with a zone identifier delimiter (%), especially targeting known metadata prefixes.
- Unexpected use of IMDS credentials by the workload identity associated with the application host.
Detection Strategies
- Inspect HTTP client logs and traces produced by Pydantic AI tools for hostnames or URLs containing % in the host component.
- Audit application code for use of FileUrl(force_download='allow-local') or web_fetch_tool(allow_local_urls=True) and verify the installed Pydantic AI version is 1.107.6, 2.44.0, or later.
- Alert on any egress from workload subnets to link-local or metadata IP ranges that is not expected to originate from the agent framework.
Monitoring Recommendations
- Enable VPC Flow Logs or equivalent cloud network telemetry and correlate metadata-service access with the invoking process.
- Monitor cloud IAM for anomalous API activity using the instance role, including calls from unexpected source IPs after temporary credentials are issued.
- Track dependency inventories for pydantic-ai versions in the vulnerable range using software composition analysis.
How to Mitigate CVE-2026-107289
Immediate Actions Required
- Upgrade Pydantic AI to 1.107.6 on the 1.x branch or 2.44.0 on the 2.x branch.
- Audit all agent configurations and remove force_download='allow-local' and allow_local_urls=True unless an operational requirement justifies them.
- Rotate any IAM credentials that may have been exposed through the instance metadata service on affected hosts.
Patch Information
The fix normalizes IPv6 zone identifiers before blocklist comparison by introducing the _parse_ip helper in pydantic_ai_slim/pydantic_ai/_ssrf.py. See GitHub Pull Request #8401 and the v1 backport in GitHub Pull Request #8402. Release notes are published at GitHub Release v1.107.6 and GitHub Release v2.44.0. The full disclosure is in GitHub Security Advisory GHSA-vmxc-h2x2-jmf3.
Workarounds
- Keep the opt-in local URL settings disabled, which is the shipped default and blocks the attack path entirely.
- Enforce IMDSv2 with a required session token and restrict the hop limit to 1 on AWS EC2 instances to reduce exposure if SSRF succeeds.
- Apply egress network policies that deny traffic from application pods or hosts to 169.254.169.254 and the IPv6 metadata prefixes unless explicitly required.
# Upgrade Pydantic AI to a patched release
pip install --upgrade 'pydantic-ai>=2.44.0'
# Or for the 1.x branch
pip install --upgrade 'pydantic-ai>=1.107.6,<2'
# Verify the 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

