Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
HIGH severity

CVE-2026-25580 pydantic-ai

HIGHFix: pydantic/pydantic-ai@d398bc9

CVE-2026-25580 is a high-severity (CVSS 8.6) Server-Side Request Forgery (SSRF) vulnerability in pydantic-ai. A fix is available for pydantic-ai — see the affected versions and patch details below.

Pydantic AI Affected by Server-Side Request Forgery (SSRF) in URL Download Handling

Also known asGHSA-2jrp-274c-jhv3PYSEC-2026-2976PYSEC-2026-2980
Published
Feb 6, 2026
Updated
Aug 12, 2026
Affected
2 pkgs
Patched
2 / 2
Exploits
None indexed
Exploitation data as of Sep 21, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-25580.

EPSS Exploitation Probability

via FIRST.org ↗
0.6%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs47th percentile — riskier than 47% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

How urgent is this, really

CVE-2026-25580 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.

Where this sits among everything scored

Of 377,636 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.

Real-World Exposure

2 pkgs affected
🐍pydantic-ai🐍pydantic-ai-slim

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Summary

A Server-Side Request Forgery (SSRF) vulnerability exists in Pydantic AI's URL download functionality. When applications accept message history from untrusted sources, attackers can include malicious URLs that cause the server to make HTTP requests to internal network resources, potentially accessing internal services or cloud credentials.

This vulnerability only affects applications that accept message history from external users, such as those using:

  • Agent.to_web or clai web to serve a chat interface
  • VercelAIAdapter for Vercel AI SDK integration
  • AGUIAdapter or Agent.to_ag_ui for AG-UI protocol integration
  • Custom APIs that accept message history from user input

Applications that only use hardcoded or developer-controlled URLs are not affected.

Description

The download_item() helper function downloads content from URLs without validating that the target is a public internet address. When user-supplied message history contains URLs, attackers can:

  1. Access internal services: Request http://127.0.0.1, localhost, or private IP ranges (10.x.x.x, 172.16.x.x, 192.168.x.x)
  2. Steal cloud credentials: Access cloud metadata endpoints (AWS IMDSv1 at 169.254.169.254, GCP, Azure, Alibaba Cloud)
  3. Scan internal networks: Enumerate internal hosts and ports

Who Is Affected

You are affected if your application:

  1. Uses Agent.to_web or clai web - The web interface accepts file attachments via the Vercel AI Data Stream Protocol, where users can provide arbitrary URLs through chat messages.

  2. Uses VercelAIAdapter - Chat interfaces built with Vercel AI SDK allow users to submit messages containing URLs that are processed server-side.

  3. Uses AGUIAdapter or Agent.to_ag_ui - The AG-UI protocol allows users to provide file references with URLs as part of agent interactions.

  4. Exposes a custom API accepting message history - Any endpoint that accepts message history or ImageUrl, AudioUrl, VideoUrl, DocumentUrl objects from user input.

Attack Scenario

Via chat interface, an attacker submits a message with a file attachment pointing to an internal resource:

{
  "role": "user",
  "parts": [
    {"type": "file", "mediaType": "image/png", "url": "http://169.254.169.254/latest/meta-data/iam/security-credentials/"}
  ]
}

Affected Model Integrations

Multiple model integrations download URL content in certain conditions:

ProviderDownloaded Types
OpenAIChatModelAudioUrl, DocumentUrl
AnthropicModelDocumentUrl (text/plain)
GoogleModel (GLA)All URL types (except YouTube and Files API URLs)
XaiModelDocumentUrl
BedrockConverseModelImageUrl, DocumentUrl, VideoUrl (non-S3 URLs)
OpenRouterModelAudioUrl

Remediation

Upgrade to Patched Version

Upgrade to the patched version or later. The fix adds comprehensive SSRF protection:

  • Blocks private/internal IP addresses by default
  • Always blocks cloud metadata endpoints (even with allow-local)
  • Only allows http:// and https:// protocols
  • Resolves hostnames before requests to prevent DNS rebinding
  • Validates each redirect target

New force_download='allow-local' Option

If an application legitimately needs to access local/private network resources (e.g., in a fully trusted internal environment), it can explicitly opt in:

from pydantic_ai import ImageUrl

# Default behavior: private IPs are blocked
ImageUrl(url="http://internal-service/image.png")  # Raises ValueError

# Opt-in to allow local access (use with caution)
ImageUrl(url="http://internal-service/image.png", force_download='allow-local')

Important: Cloud metadata endpoints (169.254.169.254, fd00:ec2::254, 100.100.100.200) are always blocked, even with allow-local.

Workaround for Older Versions

If a project cannot upgrade immediately, use a history processor to filter out URLs targeting local/private addresses:

import ipaddress
import socket
from urllib.parse import urlparse

from pydantic_ai import Agent, ModelMessage, ModelRequest
from pydantic_ai.messages import AudioUrl, DocumentUrl, ImageUrl, VideoUrl

def is_private_url(url: str) -> bool:
    """Check if a URL targets a private/internal IP address."""
    try:
        parsed = urlparse(url)
        hostname = parsed.hostname
        if not hostname:
            return True  # Invalid URL, block it

        # Resolve hostname to IP
        ip_str = socket.gethostbyname(hostname)
        ip = ipaddress.ip_address(ip_str)

        # Block private, loopback, and link-local addresses
        return ip.is_private or ip.is_loopback or ip.is_link_local
    except (socket.gaierror, ValueError):
        return True  # DNS resolution failed, block it

def filter_private_urls(messages: list[ModelMessage]) -> list[ModelMessage]:
    """Remove URL parts that target private/internal addresses."""
    url_types = (ImageUrl, AudioUrl, VideoUrl, DocumentUrl)
    filtered = []
    for msg in messages:
        if isinstance(msg, ModelRequest):
            safe_parts = [
                part for part in msg.parts
                if not (isinstance(part, url_types) and is_private_url(part.url))
            ]
            if safe_parts:
                filtered.append(ModelRequest(parts=safe_parts))
        else:
            filtered.append(msg)
    return filtered

# Apply the filter to your agent
agent = Agent('openai:gpt-5', history_processors=[filter_private_urls])

Technical Details of the Fix

The fix introduces a new _ssrf.py module with comprehensive protection:

  1. Protocol validation: Only http:// and https:// allowed
  2. DNS resolution before request: Prevents DNS rebinding attacks
  3. Private IP blocking (by default):
    • 127.0.0.0/8, ::1/128 (loopback)
    • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 (private)
    • 169.254.0.0/16, fe80::/10 (link-local)
    • 100.64.0.0/10 (CGNAT)
    • fc00::/7 (unique local)
    • 2002::/16 (6to4, can embed private IPv4)
  4. Cloud metadata always blocked: 169.254.169.254, fd00:ec2::254, 100.100.100.200
  5. Safe redirect handling: Each redirect validated before following (max 10)

Affected Packages

2 total 2 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIpydantic-ai0.0.26&&< 1.56.01.56.0pip install --upgrade 'pydantic-ai==1.56.0'
🐍PyPIpydantic-ai-slim0.0.26&&< 1.56.01.56.0pip install --upgrade 'pydantic-ai-slim==1.56.0'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for pydantic-ai, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update pydantic-ai to 1.56.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-25580 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2026-25580 can be triaged on real exposure rather than presence alone.

Tailored to CVE-2026-25580. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary A Server-Side Request Forgery (SSRF) vulnerability exists in Pydantic AI's URL download functionality. When applications accept message history from untrusted sources, attackers can include malicious URLs that cause the server to make HTTP requests to internal network resources, potentially accessing internal services or cloud credentials. **This vulnerability only affects applications that accept message history from external users**, such as those using: - **`Agent.to_web`** or **`clai web`** to serve a chat interface - **`VercelAIAdapter`** for Vercel AI SDK integration - **`AG
O3 Security · Impact-Aware SCA

Is CVE-2026-25580 in your dependencies?

O3 Security finds CVE-2026-25580 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

CVE-2026-25580: pydantic-ai SSRF (High 8.6) | O3 Security