The vulnerability is a path traversal flaw in the Pydantic AI web UI, leading to Cross-Site Scripting (XSS). The root cause lies in the create_web_app function, specifically its inner index request handler. This handler unsafely reads a version parameter from the URL's query string. This untrusted version is then passed to the _get_ui_html function, which uses it to construct a URL to fetch the UI's HTML from a CDN. Because the version parameter is not sanitized for path traversal characters (like ../), an attacker can craft a malicious URL that tricks the server into fetching and serving arbitrary HTML/JavaScript from the CDN's host instead of the legitimate chat UI. The vulnerability is exposed in applications that use either the Agent.to_web method or the clai web command-line tool, as both are entry points that create the vulnerable web application. The patch remediates this by completely removing the logic that reads the version from the query parameters and instead hardcoding the CDN URL, while providing a new, safe html_source parameter for developers to customize the UI source in their application code.