Pydantic AI's built-in web chat UI has a path traversal + XSS flaw allowing an attacker to serve arbitrary JavaScript to anyone who clicks a crafted link, silently stealing their full AI chat history. If your development or internal teams use Agent.to_web() or clai web, patch to v1.51.0 immediately — these UIs often carry sensitive prompts, internal data, and credentials typed into chat. Low EPSS and required user interaction reduce urgency, but developer tooling is routinely unprotected.
Risk Assessment
Medium risk in practice. CVSS 5.4 reflects the user-interaction gate and scoped impact (confidentiality + integrity, no availability). Exposure is concentrated in developer environments and internal demos, which rarely have WAF, CSP headers, or security monitoring — making them softer targets than production systems. The attack requires only a crafted URL, trivially delivered via Slack, email, or GitHub comments in engineering channels. EPSS 0.00014 and absence from CISA KEV indicate no observed exploitation yet, but the low barrier to craft the exploit and the high value of AI chat data (which often contains internal architecture details, API keys, and proprietary prompts) elevate the effective risk for teams actively building AI agents.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| pydantic-ai | pip | >= 1.34.0, < 1.51.0 | 1.51.0 |
| pydantic-ai-slim | pip | >= 1.34.0, < 1.51.0 | 1.51.0 |
| pydantic_ai | — | — | No patch |
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: Upgrade pydantic-ai and pydantic-ai-slim to v1.51.0 or later immediately.
-
Inventory: Identify all internal or external deployments using Agent.to_web() or clai web — including developer laptops, staging environments, and internal demos.
-
Workaround if patching is delayed: Block or strip the 'version' query parameter at the reverse proxy or WAF layer; alternatively, disable the web UI feature and use programmatic API access instead.
-
Detection: Search web/app server logs for requests to the Pydantic AI UI endpoint containing '../', '%2e%2e%2f', or version parameter values that do not match a valid semantic version string.
-
Post-incident: Treat any sensitive data (credentials, internal architecture details, PII) shared via the chat interface in affected versions as potentially compromised — rotate credentials and review exposed conversations.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-25640?
Pydantic AI's built-in web chat UI has a path traversal + XSS flaw allowing an attacker to serve arbitrary JavaScript to anyone who clicks a crafted link, silently stealing their full AI chat history. If your development or internal teams use Agent.to_web() or clai web, patch to v1.51.0 immediately — these UIs often carry sensitive prompts, internal data, and credentials typed into chat. Low EPSS and required user interaction reduce urgency, but developer tooling is routinely unprotected.
Is CVE-2026-25640 actively exploited?
No confirmed active exploitation of CVE-2026-25640 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-25640?
1. Patch: Upgrade pydantic-ai and pydantic-ai-slim to v1.51.0 or later immediately. 2. Inventory: Identify all internal or external deployments using Agent.to_web() or clai web — including developer laptops, staging environments, and internal demos. 3. Workaround if patching is delayed: Block or strip the 'version' query parameter at the reverse proxy or WAF layer; alternatively, disable the web UI feature and use programmatic API access instead. 4. Detection: Search web/app server logs for requests to the Pydantic AI UI endpoint containing '../', '%2e%2e%2f', or version parameter values that do not match a valid semantic version string. 5. Post-incident: Treat any sensitive data (credentials, internal architecture details, PII) shared via the chat interface in affected versions as potentially compromised — rotate credentials and review exposed conversations.
What systems are affected by CVE-2026-25640?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, model serving.
What is the CVSS score for CVE-2026-25640?
CVE-2026-25640 has a CVSS v3.1 base score of 5.4 (MEDIUM). The EPSS exploitation probability is 0.02%.
Technical Details
NVD Description
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 1.34.0 to before 1.51.0, a path traversal vulnerability in the Pydantic AI web UI allows an attacker to serve arbitrary JavaScript in the context of the application by crafting a malicious URL. In affected versions, the CDN URL is constructed using a version query parameter from the request URL. This parameter is not validated, allowing path traversal sequences that cause the server to fetch and serve attacker-controlled HTML/JavaScript from an arbitrary source on the same CDN, instead of the legitimate chat UI package. If a victim clicks the link or visits it via an iframe, attacker-controlled code executes in their browser, enabling theft of chat history and other client-side data. This vulnerability only affects applications that use Agent.to_web to serve a chat interface and clai web to serve a chat interface from the CLI. These are typically run locally (on localhost), but may also be deployed on a remote server. This vulnerability is fixed in 1.51.0.
Exploitation Scenario
An attacker targeting an AI engineering team discovers via LinkedIn or GitHub that developers are using Pydantic AI to build an internal RAG assistant with an Agent.to_web() UI. The attacker crafts a URL to the internal app with a 'version' parameter containing path traversal sequences pointing to attacker-controlled HTML hosted on the legitimate CDN used by Pydantic AI. The URL is sent as a Slack DM ('hey, can you check if this agent response looks right to you?') or embedded in a GitHub issue comment on the target's repo. When the developer opens the link, the attacker's JavaScript executes in the context of the Pydantic AI chat interface, silently POSTing the full conversation history — including any API keys, internal system prompts, or proprietary data typed into the chat — to an attacker-controlled endpoint. The developer sees nothing unusual.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N References
Timeline
Related Vulnerabilities
CVE-2026-25580 8.6 pydantic-ai: SSRF allows internal network access
Same package: pydantic-ai CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Code Execution CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same attack type: Data Extraction CVE-2025-53767 10.0 Azure OpenAI: SSRF EoP, no auth required (CVSS 10)
Same attack type: Data Extraction CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Data Extraction
AI Threat Alert