VAITP Dataset

← Back to the dataset

CVE-2026-107295

Missing content‑type validation in Agent.to_web() lets browsers trigger local agent tools.

  • CVSS 7.6
  • CWE-352
  • Input Validation and Sanitization
  • Remote

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.to_web() 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 requires_approval=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.

CVSS base score
7.6
Published
2026-10-08
OWASP
A10 Server-Side Request Forgery (SSRF)
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Insecure Direct Object References (IDOR)
Accessibility scope
Remote
Impact
Privilege Escalation
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade Pydantic AI to ≥ 1.107.4 (or to the 2.x series ≥ 2.28.0).

Vulnerable code sample

from fastapi import FastAPI, Request
from pydantic import BaseModel
from pydantic_ai import Agent

app = FastAPI()
agent = Agent()

class ChatMessage(BaseModel):
    content: str

@app.post("/chat")
async def chat_endpoint(request: Request):
    # VULNERABLE: missing content‑type validation allows arbitrary POST bodies to be processed
    payload = await request.json()
    msg = ChatMessage(**payload)
    response = await agent.to_web(msg.content)
    return {"reply": response}

Patched code sample

from fastapi import FastAPI, Request, HTTPException
from pydantic import BaseModel
from pydantic_ai import Agent

app = FastAPI()
agent = Agent()

class ChatMessage(BaseModel):
    content: str

@app.post("/chat")
async def chat_endpoint(request: Request):
    # FIX: enforce JSON content‑type before processing request body
    if request.headers.get("content-type") != "application/json":
        raise HTTPException(status_code=415, detail="Unsupported Media Type")
    payload = await request.json()
    msg = ChatMessage(**payload)
    response = await agent.to_web(msg.content)
    return {"reply": response}

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026107295,
  title        = {{Missing content‑type validation in Agent.to_web() lets browsers trigger local agent tools.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-107295},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-107295/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.