{"id":"CVE-2026-25640","aliases":["EUVD-2026-5593","GHSA-wjp5-868j-wqv7","PYSEC-2026-2979","PYSEC-2026-2983"],"status":"published","title":"Pydantic AI affected by Stored XSS via Path Traversal in Web UI CDN URL","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.","severity":{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00371,"percentile":0.31327,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-22","CWE-79"],"published":"2026-02-06T18:51:57Z","modified":"2026-10-28T02:30:43Z","fixes":[{"ecosystem":"PyPI","package":"pydantic-ai","fixed_in":["1.51.0"],"sources":["ghsa","osv"]},{"ecosystem":"PyPI","package":"pydantic-ai-slim","fixed_in":["1.51.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"PyPI","package":"pydantic-ai","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}]},{"source":"ghsa","ecosystem":"PyPI","package":"pydantic-ai-slim","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}]},{"source":"osv","ecosystem":"PyPI","package":"pydantic-ai","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}],"versions":["1.34.0","1.35.0","1.36.0","1.37.0","1.38.0","1.39.0","1.39.1","1.40.0","1.41.0","1.42.0","1.43.0","1.44.0","1.46.0","1.47.0","1.48.0","1.49.0","1.50.0"]},{"source":"osv","ecosystem":"PyPI","package":"pydantic-ai-slim","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}],"versions":["1.34.0","1.35.0","1.36.0","1.37.0","1.38.0","1.39.0","1.39.1","1.40.0","1.41.0","1.42.0","1.43.0","1.44.0","1.46.0","1.47.0","1.48.0","1.49.0","1.50.0"]},{"source":"osv","ecosystem":"PyPI","package":"pydantic-ai","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}],"versions":["1.34.0","1.35.0","1.36.0","1.37.0","1.38.0","1.39.0","1.39.1","1.40.0","1.41.0","1.42.0","1.43.0","1.44.0","1.46.0","1.47.0","1.48.0","1.49.0","1.50.0"]},{"source":"osv","ecosystem":"PyPI","package":"pydantic-ai-slim","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.34.0"},{"fixed":"1.51.0"}]}],"versions":["1.34.0","1.35.0","1.36.0","1.37.0","1.38.0","1.39.0","1.39.1","1.40.0","1.41.0","1.42.0","1.43.0","1.44.0","1.46.0","1.47.0","1.48.0","1.49.0","1.50.0"]}],"products":[{"vendor":"pydantic","product":"pydantic-ai"},{"vendor":"pydantic","product":"pydantic_ai"},{"vendor":"red hat","product":"red hat enterprise linux ai (rhel ai) 3"}],"references":[{"url":"https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-wjp5-868j-wqv7","tags":["x_refsource_CONFIRM","Vendor Advisory","advisory","web"]},{"url":"https://github.com/pydantic/pydantic-ai/releases/tag/v1.51.0","tags":["x_refsource_MISC","Product","Release Notes","web"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-25640","tags":["vdb-entry","x_refsource_REDHAT","advisory"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2437753","tags":["issue-tracking","x_refsource_REDHAT","report"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25640.json","tags":["x_sadp-csaf-vex","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25640","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-wjp5-868j-wqv7","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/25xxx/CVE-2026-25640.json","tags":["advisory"]},{"url":"https://github.com/pydantic/pydantic-ai","tags":["package"]},{"url":"https://pypi.org/project/pydantic-ai","tags":["package"]},{"url":"https://pypi.org/project/pydantic-ai-slim","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-25640","title":"Pydantic AI affected by Stored XSS via Path Traversal in Web UI CDN URL","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.","status":"published","published":"2026-02-06T20:01:53.892Z","modified":"2026-07-15T01:16:10.402Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"cna"},{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"adp"}],"cwes":["CWE-22","CWE-79","CWE-22"],"updated_at":"2026-11-02T13:41:30.911526Z"}],"euvd":[{"id":"EUVD-2026-5593","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.","status":"published","published":"2026-02-06T20:01:53Z","modified":"2026-07-15T01:16:10Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"updated_at":"2026-11-02T18:19:55.318488Z"}],"ghsa":[{"id":"GHSA-wjp5-868j-wqv7","title":"Pydantic AI has Stored XSS via Path Traversal in Web UI CDN URL","description":"## Summary\n\nA Path Traversal vulnerability in the [Pydantic AI web UI](https://ai.pydantic.dev/web/) 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.\n\n**This vulnerability only affects applications that use:**\n- **`Agent.to_web`** to serve a chat interface\n- **`clai web`** to serve a chat interface from the CLI\n\nThese are typically run locally (on `localhost`), but may also be deployed on a remote server.\n\n### Description\n\nThe 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.\n\n### Who Is Affected\n\nProjects are affected if your application uses `Agent.to_web` or `clai web` to serve the Pydantic AI chat interface.\n\n### Attack Scenario\n\n1. 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.\n\n2. The attacker gets the victim to visit this URL — directly via a link, through a redirect, or by embedding it in an iframe.\n\n3. When the victim's browser loads the page, the server fetches and serves attacker-controlled HTML/JavaScript instead of the legitimate chat UI.\n\n4. The attacker's JavaScript executes in the victim's browser in the context of the Pydantic AI web application, with access to:\n   - **Chat history** stored in `localStorage` (all user messages and AI responses)\n   - **Session cookies** that are not set as `HttpOnly`, if authentication middleware is configured\n\n## Remediation\n\n### Upgrade to Patched Version\n\n**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.\n\nA new `html_source` parameter is available on `Agent.to_web` and `create_web_app` 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.","status":"published","published":"2026-02-06T18:51:57Z","modified":"2026-02-06T21:43:12Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-22","CWE-79"],"updated_at":"2026-11-02T14:39:23.728882Z"}],"nvd":[{"id":"CVE-2026-25640","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.","status":"published","published":"2026-02-06T20:16:11.11Z","modified":"2026-07-15T02:18:55.463Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"secondary"},{"version":"3.1","score":5.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N","level":"medium","assessor":"primary"},{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high","assessor":"secondary"}],"cwes":["CWE-22","CWE-79"],"updated_at":"2026-11-02T14:12:05.52517Z"}],"osv":[{"id":"CVE-2026-25640","title":"Pydantic AI affected by Stored XSS via Path Traversal in Web UI CDN URL","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.","status":"published","published":"2026-02-06T20:01:53.892Z","modified":"2026-10-28T02:30:43.191123138Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-22","CWE-79"],"updated_at":"2026-11-02T15:44:59.438965Z"},{"id":"GHSA-wjp5-868j-wqv7","title":"Pydantic AI has Stored XSS via Path Traversal in Web UI CDN URL","description":"## Summary\n\nA Path Traversal vulnerability in the [Pydantic AI web UI](https://ai.pydantic.dev/web/) 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.\n\n**This vulnerability only affects applications that use:**\n- **`Agent.to_web`** to serve a chat interface\n- **`clai web`** to serve a chat interface from the CLI\n\nThese are typically run locally (on `localhost`), but may also be deployed on a remote server.\n\n### Description\n\nThe 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.\n\n### Who Is Affected\n\nProjects are affected if your application uses `Agent.to_web` or `clai web` to serve the Pydantic AI chat interface.\n\n### Attack Scenario\n\n1. 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.\n\n2. The attacker gets the victim to visit this URL — directly via a link, through a redirect, or by embedding it in an iframe.\n\n3. When the victim's browser loads the page, the server fetches and serves attacker-controlled HTML/JavaScript instead of the legitimate chat UI.\n\n4. The attacker's JavaScript executes in the victim's browser in the context of the Pydantic AI web application, with access to:\n   - **Chat history** stored in `localStorage` (all user messages and AI responses)\n   - **Session cookies** that are not set as `HttpOnly`, if authentication middleware is configured\n\n## Remediation\n\n### Upgrade to Patched Version\n\n**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.\n\nA new `html_source` parameter is available on `Agent.to_web` and `create_web_app` 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.","status":"published","published":"2026-02-06T18:51:57Z","modified":"2026-07-13T16:43:43.442896235Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"cwes":["CWE-22","CWE-79"],"updated_at":"2026-11-02T15:46:58.767335Z"},{"id":"PYSEC-2026-2979","title":"Pydantic AI has Stored XSS via Path Traversal in Web UI CDN URL","description":"## Summary\n\nA Path Traversal vulnerability in the [Pydantic AI web UI](https://ai.pydantic.dev/web/) 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.\n\n**This vulnerability only affects applications that use:**\n- **`Agent.to_web`** to serve a chat interface\n- **`clai web`** to serve a chat interface from the CLI\n\nThese are typically run locally (on `localhost`), but may also be deployed on a remote server.\n\n### Description\n\nThe 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.\n\n### Who Is Affected\n\nProjects are affected if your application uses `Agent.to_web` or `clai web` to serve the Pydantic AI chat interface.\n\n### Attack Scenario\n\n1. 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.\n\n2. The attacker gets the victim to visit this URL — directly via a link, through a redirect, or by embedding it in an iframe.\n\n3. When the victim's browser loads the page, the server fetches and serves attacker-controlled HTML/JavaScript instead of the legitimate chat UI.\n\n4. The attacker's JavaScript executes in the victim's browser in the context of the Pydantic AI web application, with access to:\n   - **Chat history** stored in `localStorage` (all user messages and AI responses)\n   - **Session cookies** that are not set as `HttpOnly`, if authentication middleware is configured\n\n## Remediation\n\n### Upgrade to Patched Version\n\n**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.\n\nA new `html_source` parameter is available on `Agent.to_web` and `create_web_app` 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.","status":"published","published":"2026-07-13T14:36:34.92564Z","modified":"2026-07-13T16:43:43.442896235Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"updated_at":"2026-11-02T15:52:56.429374Z"},{"id":"PYSEC-2026-2983","title":"Pydantic AI has Stored XSS via Path Traversal in Web UI CDN URL","description":"## Summary\n\nA Path Traversal vulnerability in the [Pydantic AI web UI](https://ai.pydantic.dev/web/) 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.\n\n**This vulnerability only affects applications that use:**\n- **`Agent.to_web`** to serve a chat interface\n- **`clai web`** to serve a chat interface from the CLI\n\nThese are typically run locally (on `localhost`), but may also be deployed on a remote server.\n\n### Description\n\nThe 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.\n\n### Who Is Affected\n\nProjects are affected if your application uses `Agent.to_web` or `clai web` to serve the Pydantic AI chat interface.\n\n### Attack Scenario\n\n1. 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.\n\n2. The attacker gets the victim to visit this URL — directly via a link, through a redirect, or by embedding it in an iframe.\n\n3. When the victim's browser loads the page, the server fetches and serves attacker-controlled HTML/JavaScript instead of the legitimate chat UI.\n\n4. The attacker's JavaScript executes in the victim's browser in the context of the Pydantic AI web application, with access to:\n   - **Chat history** stored in `localStorage` (all user messages and AI responses)\n   - **Session cookies** that are not set as `HttpOnly`, if authentication middleware is configured\n\n## Remediation\n\n### Upgrade to Patched Version\n\n**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.\n\nA new `html_source` parameter is available on `Agent.to_web` and `create_web_app` 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.","status":"published","published":"2026-07-13T14:36:34.993999Z","modified":"2026-07-13T16:43:43.442896235Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N","level":"high"}],"updated_at":"2026-11-02T15:52:56.429374Z"}]}}
