CVE-2026-25640: Pydantic AI affected by Stored XSS via Path Traversal in Web UI CDN URL
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.
Security readout for executives and security teams
Plain-English summary
Pydantic AI chat interfaces can load attacker-controlled browser code when affected versions build their web UI CDN URL from an unvalidated request parameter. A user must visit a malicious link or iframe. Successful exploitation could expose chat history and other client-side data.
Executive priority
Treat this as a high-priority patch for teams using Pydantic AI web chat interfaces. The business risk is data exposure from AI chat sessions, but scope is narrower than a platform-wide server compromise.
Technical view
Versions 1.34.0 through before 1.51.0 are affected when applications use Agent.to_web or clai web. The version query parameter is used to construct a CDN URL without validation, allowing path traversal to different same-CDN content and resulting JavaScript execution in the app context.
Likely exposure
Exposure is limited to Pydantic AI applications serving the chat UI through Agent.to_web or clai web. These are often localhost tools, but remote deployments or shared internal interfaces raise risk, especially where users can be induced to open crafted links.
Exploitation context
The supplied sources do not show known active exploitation, and KEV is false. Exploitation requires user interaction: visiting a malicious URL or loading it through an iframe. The documented impact is browser-side data theft and limited integrity impact.
Researcher notes
Evidence supports CWE-22 and CWE-79: unvalidated CDN path construction enables script execution in the application origin. Sources name the affected feature set and fixed version, but do not provide evidence of exploitation in the wild.
Mitigation direction
Upgrade pydantic-ai to 1.51.0 or later where the issue is fixed.
Restrict or disable Agent.to_web and clai web chat interfaces until upgraded.
Do not expose local or development chat interfaces to untrusted networks.
Monitor the GitHub advisory and Red Hat entries for downstream guidance.
Validation and detection
Inventory projects for pydantic-ai versions from 1.34.0 to before 1.51.0.
Check whether Agent.to_web or clai web serves any chat interface.
Identify any remote, shared, or iframe-accessible deployments of the chat UI.
Confirm deployed environments run pydantic-ai 1.51.0 or later.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-22: File access and web shell behavior lookup
File traversal and upload weaknesses can lead teams to review file, web shell, execution, and collection telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Client-side and session-facing weaknesses should be reviewed alongside initial-access and user-execution behaviors. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references file access or upload behavior, so file telemetry and web shell review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.