CVE-2026-107295: `pydantic-ai-slim` web UI `/api/chat` accepts browser-simple cross-origin requests that can trigger agent tool execution
Summary
The Pydantic AI development web chat UI (Agent.toweb(), clai web) did not check the content type of requests to its chat endpoint. This allowed a website visited by a developer to submit a request to a chat UI running on that developer's machine, causing the served agent to run and to execute its tools with the privileges and credentials of the local process.
Binding the web UI to localhost — the default — does not prevent this, because a page open in the developer's browser can reach the loopback address.
Impact
Applications and developers serving an agent through Agent.toweb() or clai web. The consequences depend on the tools the served agent exposes, and can include data disclosure as well as unwanted tool side effects. Tools marked requiresapproval=True were not protected either, because the endpoint trusts approval decisions relayed by the client.
Mitigation
Upgrade to a patched version. The chat endpoint now requires Content-Type: application/json and rejects other requests before the request body is parsed and before the agent runs. The bundled chat UI already sends this header; scripts and other non-browser clients that call the endpoint directly may need to be updated to send it.
If you cannot upgrade, don't run the web UI while browsing untrusted sites, stop it when you aren't using it, and don't serve an agent with side-effecting tools through it.
Credits - Thai Son Dinh from VinSOC Labs (R&D)
Other sources
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 1.34.0 until 1.107.4 and 2.28.0, the Agent.toweb() and clai web development chat endpoint has missing request content-type validation. A website visited by a developer can submit a browser-compatible request to a loopback-hosted chat server, causing the served agent to run and execute tools with the privileges and credentials of the local process; client-relayed approval decisions also leave requiresapproval=True tools exposed. Binding to localhost does not prevent a browser page from reaching the loopback address. This issue is fixed in versions 1.107.4 and 2.28.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pydantic-ai-slimto a version that resolves this vulnerability.Fixed in 2.28.0 - Upgrade
Upgrade
pip/pydantic-ai-slimto a version that resolves this vulnerability.Fixed in 1.107.4 - Upgrade
Upgrade
pip/pydantic-aito a version that resolves this vulnerability.Fixed in 2.28.0 - Upgrade
Upgrade
pip/pydantic-aito a version that resolves this vulnerability.Fixed in 1.107.4 - Upgrade
Upgrade
Pydantic AIto a version that resolves this vulnerability.Fixed in 1.107.4 - Upgrade
Upgrade
Pydantic AIto a version that resolves this vulnerability.Fixed in 2.28.0 - Configuration
Update scripts and other non-browser clients to send Content-Type: application/json when calling the chat endpoint.
Pydantic AI development web chat UI /api/chat Content-Type = application/json - Compensating control
If you cannot upgrade, do not run the web UI while browsing untrusted sites, stop it when it is not in use, and do not serve an agent with side-effecting tools through it.
Event History
Frequently Asked Questions
Who is exposed to this issue?
Developers and applications that serve an agent through Agent.to_web() or clai web are exposed. The impact depends on the tools available to the served agent and the privileges and credentials of its local process.
Does binding the web UI only to localhost prevent exploitation?
No. Localhost is the default binding, but a website opened in the developer's browser can still send requests to the loopback address.
Can tools that require approval still be triggered?
Yes. Tools marked requires_approval=True were not protected because the endpoint trusted approval decisions relayed by the client.
What changes after upgrading, and could it affect API clients?
The patched endpoint requires Content-Type: application/json and rejects other content types before parsing the body or running the agent. The bundled chat UI already sends this header, but scripts and other non-browser clients calling the endpoint may need to send it.