CVE-2026-25640 is a high-severity path traversal vulnerability in pydantic-ai (pip), affecting versions >= 1.34.0, < 1.51.0. It is fixed in 1.51.0.
Summary 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. 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.toweb to serve a chat interface 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. Description The web UI serves its frontend HTML by fetching it from a CDN. 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. Who Is Affected Projects are affected if your application uses Agent.toweb or clai web to serve the Pydantic AI chat interface. Attack Scenario An attacker crafts a URL pointing to the victim's Pydantic AI web UI instance (either localhost with the known port, or a remote server endpoint) with a malicious version query parameter containing path traversal sequences. The attacker gets the victim to visit this URL, directly via a link, through a redirect, or by embedding it in an iframe. When the victim's browser loads the page, the server fetches and serves attacker-controlled HTML/JavaScript instead of the legitimate chat UI. The attacker's JavaScript executes in the victim's browser in the context of the Pydantic AI web application, with access to: Chat history stored in localStorage (all user messages and AI responses) Session cookies that are not set as HttpOnly, if authentication middleware is configured Remediation Upgrade to Patched Version Upgrade to the patched version or later. The fix removes the user-controllable version parameter entirely. The CDN URL is now hardcoded at startup and cannot be influenced by request parameters. A new htmlsource parameter is available on Agent.toweb and createwebapp for applications that need to customize the UI source (e.g., for enterprise environments, offline usage, or custom UI builds). This parameter is only settable in application code, not via query parameters.
Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.
CVE-2026-25640 has a CVSS score of 7.1 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.
A fixed version is available (1.51.0). Upgrading removes the vulnerable code path.
pip
pydantic-ai (>= 1.34.0, < 1.51.0)pydantic-ai-slim (>= 1.34.0, < 1.51.0)pydantic-ai → 1.51.0 (pip)pydantic-ai-slim → 1.51.0 (pip)Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.
Kodem's runtime-powered SCA identifies whether CVE-2026-25640 is reachable in your applications. Explore open-source security for your team.
See if CVE-2026-25640 is reachable in your applications. Get a demo
Already deployed Kodem? See CVE-2026-25640 in your environment →Upgrade the following packages to resolve this vulnerability:
pydantic-ai to 1.51.0 or laterpydantic-ai-slim to 1.51.0 or laterKodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
CVE-2026-25640 is a high-severity path traversal vulnerability in pydantic-ai (pip), affecting versions >= 1.34.0, < 1.51.0. It is fixed in 1.51.0. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
CVE-2026-25640 has a CVSS score of 7.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
pydantic-ai (pip) (versions >= 1.34.0, < 1.51.0)pydantic-ai-slim (pip) (versions >= 1.34.0, < 1.51.0)Yes. CVE-2026-25640 is fixed in 1.51.0. Upgrade to this version or later.
Whether CVE-2026-25640 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
pydantic-ai to 1.51.0 or laterpydantic-ai-slim to 1.51.0 or later