Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-107292 Overview
CVE-2026-107292 affects Pydantic AI, a Python agent framework for building generative AI applications and workflows. The Agent.to_web() method and clai web development chat server fail to validate the HTTP Host header. This omission allows a malicious website visited by a developer to perform DNS rebinding and reach the loopback-hosted agent as a same-origin service. Attackers can then read the served UI and submit chat requests that execute agent tools with the local process's privileges and credentials. Binding to localhost, Origin checks, and CSRF tokens do not prevent this same-origin DNS rebinding path. The flaw is tracked as [CWE-346] Origin Validation Error and affects versions 1.34.0 through 2.30.0.
Critical Impact
A hostile web page can hijack a locally running Pydantic AI agent, invoking its tools with the developer's local credentials to disclose data or trigger unwanted side effects.
Affected Products
- Pydantic AI versions 1.34.0 through 1.107.4
- Pydantic AI versions 2.0.0 through 2.29.x
- Any application using Agent.to_web() or the clai web command
Discovery Timeline
- 2026-10-08 - CVE-2026-107292 published to NVD
- 2026-10-14 - Last updated in NVD database
Technical Details for CVE-2026-107292
Vulnerability Analysis
The vulnerability is a DNS rebinding attack enabled by missing Host header validation in the Pydantic AI web development server. When a developer runs Agent.to_web() or clai web, the server binds to 127.0.0.1:7932 by default and serves a chat UI that can invoke registered agent tools. Because the server accepts any Host header value, an attacker-controlled domain can resolve first to a public IP (to deliver the attacker's page) and then rebind to 127.0.0.1. The browser treats subsequent requests as same-origin with the attacker's page, bypassing standard Same-Origin Policy protections. Origin checks and CSRF tokens do not help, because the attacker page is now considered same-origin and can read tokens directly from the response. Any tools exposed by the agent then run with the developer's local privileges, including API keys, filesystem access, and credentials loaded into the agent process.
Root Cause
The root cause is an origin validation error [CWE-346] in pydantic_ai_slim/pydantic_ai/_cli/web.py. The web server accepts requests regardless of the Host header, trusting that localhost binding is sufficient to restrict access. DNS rebinding defeats this assumption by changing the resolved IP of a hostname after the initial page load.
Attack Vector
An attacker hosts a page at attacker.example. A developer running an agent via clai web visits that page. The attacker's DNS server returns a short-TTL record pointing first to the attacker's IP, then rebinds to 127.0.0.1. JavaScript in the attacker page then issues fetch calls to http://attacker.example:7932/, which reach the loopback agent server. The agent processes chat prompts and tool invocations, returning results to the attacker-controlled page.
# Patch: pydantic_ai_slim/pydantic_ai/_cli/__init__.py
parser.add_argument('--host', default='127.0.0.1', help='Host to bind server (default: 127.0.0.1)')
parser.add_argument('--port', type=int, default=7932, help='Port to bind server (default: 7932)')
parser.add_argument(
'--allowed-host',
action='append',
dest='allowed_hosts',
help='Hostname to answer to in addition to IP addresses and localhost, which are always '
'allowed (can be repeated). Needed only when reaching the UI through a name, e.g. behind a '
'reverse proxy or a tunnel. Supports "*.example.com" and "*" for any host.',
)
# Source: https://github.com/pydantic/pydantic-ai/commit/871c7aeec5dfed2138655ccbccbf15c6d763bae7
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-107292
Indicators of Compromise
- Inbound HTTP requests to the local Pydantic AI web server (default port 7932) with a Host header that is not localhost, 127.0.0.1, or an explicitly allowed hostname.
- Unexpected agent tool invocations in Pydantic AI logs originating from a browser session the developer did not initiate.
- Outbound DNS queries from developer workstations resolving third-party hostnames to 127.0.0.1 or other loopback addresses.
Detection Strategies
- Review Pydantic AI server access logs for Host header values that do not match the configured bind address or the --allowed-host list.
- Monitor browser telemetry and endpoint DNS resolver logs for short-TTL records followed by rapid IP changes to loopback or RFC1918 ranges.
- Audit installed Pydantic AI versions in developer environments; flag any instance running >=1.34.0,<1.107.5 or >=2.0.0,<2.30.0.
Monitoring Recommendations
- Alert on process execution of clai web or Python processes importing pydantic_ai._cli.web on workstations without current patches.
- Watch for anomalous child processes spawned by the Pydantic AI process, which may indicate tool execution triggered through a rebinding attack.
- Instrument network egress to flag DNS responses that rebind external hostnames to loopback or private addresses.
How to Mitigate CVE-2026-107292
Immediate Actions Required
- Upgrade Pydantic AI to version 1.107.5 (for the v1 branch) or 2.30.0 (for the v2 branch).
- Pass an explicit allowed_hosts list to Agent.to_web() or use the --allowed-host flag with clai web only when exposing the UI through a hostname.
- Stop running clai web or Agent.to_web() on developer machines until the upgrade is applied, especially when the agent has tools with filesystem, shell, or credentialed API access.
Patch Information
The fix adds host validation and an allowed_hosts parameter to Agent.to_web() and the clai web CLI. By default, only IP literals and localhost are accepted, which blocks the DNS rebinding path. See the Pydantic AI Security Advisory GHSA-q2xc-rrxj-58x9, the v1.107.5 release, the v2.30.0 release, and the fix commits in Pull Request #7437 and Pull Request #7438.
Workarounds
- Run the Pydantic AI web UI inside an isolated environment or container with no network egress to the developer's browser.
- Place a reverse proxy in front of the agent server that strictly validates the Host header and strips unexpected values before forwarding.
- Avoid registering sensitive tools (filesystem, shell, credentialed API calls) on agents exposed through Agent.to_web() or clai web until patched.
# Configuration example: restrict allowed hosts when running clai web
clai web --host 127.0.0.1 --port 7932 --allowed-host localhost --allowed-host dev.internal.example
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

