CVE-2026-25580: Pydantic AI Server-Side Request Forgery (SSRF) Vulnerability in URL Download Handling

pydantic-ai Updated 06 Feb 2026

Summary

06/02/2026
Yes i
High
8.6

CVE-2026-25580: Pydantic AI has Server-Side Request Forgery (SSRF) in URL Download Handling. Affects pydantic-ai versions >= 0.0.26, < 1.56.0. Fixed in 1.56.0. How to fix ↓

Also tracked for

The same CVE-2026-25580 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Pydantic AI is a Python library designed for data validation and settings management using Python type annotations. It is widely used in applications that require robust data handling and validation. The library's functionality includes the ability to download content from URLs, which is essential for applications that interact with external resources. However, this feature has a critical vulnerability that allows attackers to exploit the URL download functionality, leading to potential unauthorized access to internal network resources.

Vulnerability Detail

A Server-Side Request Forgery (SSRF) vulnerability exists in Pydantic AI's URL download functionality. This vulnerability arises when applications accept message history from untrusted sources, allowing attackers to include malicious URLs. The download_item() function does not validate whether the target URL is a public internet address, enabling attackers to access internal services, steal cloud credentials, and scan internal networks. This vulnerability primarily affects applications that utilize specific integrations or expose custom APIs that accept user input containing URLs.

How To Fix

Latest published version: 2.60.0 as of 23 Oct 2026

pip install --upgrade "pydantic-ai==2.60.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.56.0

This is the first release that contains the fix.

pip install --upgrade "pydantic-ai==1.56.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not possible, implement a history processor to filter out URLs targeting local or private addresses. Below is a sample code snippet for the workaround:

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:
try:
    parsed = urlparse(url)
    hostname = parsed.hostname
    if not hostname:
            return True
    ip_str = socket.gethostbyname(hostname)
    ip = ipaddress.ip_address(ip_str)
        return ip.is_private or ip.is_loopback or ip.is_link_local
except (socket.gaierror, ValueError):
        return True

def filter_private_urls(messages: list[ModelMessage]) -> list[ModelMessage]:
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

agent = Agent('openai:gpt-5', history_processors=[filter_private_urls])

Conclusion

The SSRF vulnerability in Pydantic AI's URL download handling poses significant risks to applications that accept untrusted user input. It is crucial to upgrade to the patched version to mitigate these risks. If immediate upgrading is not feasible, implementing the provided workaround can help protect against potential exploitation.

See every vulnerability recorded for pydantic-ai →

Share this vulnerability

FAQ

The vulnerability is a Server-Side Request Forgery (SSRF) that allows attackers to send malicious URLs, potentially accessing internal network resources.

Applications that accept message history from external users, particularly those using specific integrations like Agent.to_web, VercelAIAdapter, and custom APIs, are affected.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

The CVSS score of this vulnerability is 8.6, indicating a high severity level.

If you cannot upgrade immediately, implement the provided workaround to filter out private URLs from user input.

Related vulnerabilities

Recent vulnerabilities recorded for pydantic-ai.

How To Fix

Latest published version: 2.60.0 as of 23 Oct 2026

pip install --upgrade "pydantic-ai==2.60.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.56.0

This is the first release that contains the fix.

pip install --upgrade "pydantic-ai==1.56.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback