/

CVE-2026-25580

Severity:

HIGH RISK

(8.6)

SSRF in Pydantic AI URL Download Functionality

CVE-2026-25580

Modified

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized access to internal network resources and sensitive metadata via server-initiated HTTP requests

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A Server-Side Request Forgery (SSRF) issue in Pydantic AI's URL download functionality allows untrusted message history to trigger HTTP requests from the server to arbitrary URLs.

If an application accepts message history from external users, an attacker can embed malicious URLs that cause the backend to reach internal network resources, potentially exposing internal services or cloud metadata and credentials.

Affected context

This vulnerability affects applications built with Pydantic AI (versions 0.0.26 to before 1.56.0) that:

  • Use the framework's URL download or fetching capabilities as part of agent workflows, and
  • Accept message history or similar conversational state from untrusted or external users, and
  • Allow those messages to influence which URLs the server requests.

It does not inherently affect deployments where message history is fully controlled, sanitized, or generated exclusively by trusted backend components.

Exploit preconditions

  • Attack surface: Pydantic AI–based endpoints or workflows that accept externally supplied message history or user content that can contain or influence URLs.
  • Required access: Ability to send messages or payloads that the application ingests as conversation history for the agent.
  • Trigger point: Invocation of the URL download functionality when processing the user-controlled history, causing the server to issue HTTP requests to attacker-chosen URLs.
  • Why exploitation is possible: The URL download logic treats user-influenced URLs as trustworthy and does not sufficiently restrict or validate the destination, allowing access to internal or otherwise non-public endpoints from the server's network position.

Why this happens

The core issue stems from treating user-controlled or user-influenced URLs as safe targets for server-side HTTP requests without applying robust validation or network egress controls.

This aligns with CWE-918: Server-Side Request Forgery (SSRF), where backend functionality makes outbound network calls based on untrusted input, effectively turning the server into a proxy into its own internal network and cloud environment.

Conceptually, the agent workflow couples:

  • Conversational inputs (message history) that may contain arbitrary URLs, with
  • A powerful server-side HTTP client capable of reaching internal services, metadata endpoints, or management interfaces.

Without strict allowlists or blocking of sensitive address ranges (e.g., 169.254.169.254, RFC1918 networks), an attacker's URLs can traverse network boundaries that are not directly reachable from the internet.

Potential impact

  • Access to internal HTTP-based services that are not exposed publicly.
  • Discovery of internal network structure and service endpoints.
  • Retrieval of cloud instance metadata, which may include temporary credentials or tokens.
  • Abuse of internal APIs, potentially leading to data exfiltration or configuration changes.
  • Use of the server as a pivot point for further attacks inside the private network.

General mitigation guidance

Effective mitigation focuses on treating all external URLs as untrusted and constraining where the server is allowed to connect:

  • Prefer explicit allowlists of domains or URL patterns that the application is permitted to fetch, rather than filtering out "bad" destinations.
  • Reject or sanitize URLs that resolve to:
  • Private IP ranges (e.g., 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16),
  • Link-local or metadata endpoints (e.g., 169.254.169.254),
  • Localhost and loopback addresses (127.0.0.0/8, ::1) and the server's own IPs.
  • Resolve hostnames and validate the final destination after DNS resolution, not just the hostname string.
  • Decouple user-visible messaging or "history injection" features from any direct URL fetching, e.g., by requiring a trusted backend decision point before performing outbound requests.
  • Apply network-level egress controls (firewalls, security groups, service mesh policies) to block or tightly limit access to sensitive internal and metadata endpoints from the application runtime.
  • Run URL fetch logic with least-privilege network and cloud permissions, ensuring that even if SSRF is attempted, there is minimal access to high-value resources.

How teams detect issues like this

Detection generally involves a combination of code-level inspection and runtime monitoring:

  • Static analysis and code review:
  • Search for HTTP client usage in Pydantic AI workflows or tools that accept URLs influenced by user or external message history.
  • Flag patterns where user content is passed directly into URL download helpers without validation or allowlisting.
  • Review any "agent tools" or "actions" that perform network calls, verifying they apply domain and IP safeguards.
  • Policy enforcement:
  • Introduce coding guidelines that prohibit direct use of generic URL-fetch APIs with untrusted input.
  • Use automated code scanning tools to enforce network egress rules or to detect missing URL validation wrappers.
  • Runtime monitoring:
  • Log outbound HTTP requests with destination host/IP and correlate them with request context or user identity.
  • Alert on connections to unusual destinations, especially private IP spaces, metadata endpoints, or new internal services.
  • Use network-level observability (service mesh, firewall logs) to detect and investigate suspicious outbound patterns from Pydantic AI services.

Sources

SourceLink
github.comgithub.com/pydantic/pydantic-ai/commit/d398bc9d39aecca6530fa7486a410d5cce936301
github.comgithub.com/pydantic/pydantic-ai/security/advisories/GHSA-2jrp-274c-jhv3
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-25580
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2437781
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25580.json

Frequently asked

questions

Yes, but only in applications that accept message history or similar content from external users and pass that content into Pydantic AI workflows that perform URL downloads. In such cases, an attacker over the network can influence which URLs the server calls.

The attacker needs the ability to supply or manipulate the message history or input that the application feeds into Pydantic AI agents. They do not need shell or local access; standard application-level access (e.g., sending chat messages or API calls) can be sufficient if those inputs can affect URLs fetched by the backend.

The most robust approach is to ensure that any URL fetching functionality:

  • Only connects to a tightly controlled allowlist of domains or services, and
  • Rejects destinations that resolve to internal, loopback, or metadata IPs, and
  • Separates user-provided content from the decision of whether and where to make outbound HTTP requests.

Design agent tools and actions with clear trust boundaries: treat any user-controlled data (including message history, prompts, and tool arguments) as untrusted, route all network calls through validated, policy-enforcing gateways, and embed SSRF protections (allowlists, IP range checks, and egress controls) into shared network utility layers that all agents must use.

Find out what's already
exploitable in your codebase.