CVE-2026-65975: CWE-863: Incorrect Authorization in pydantic pydantic-ai
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.
AI Analysis
Technical Summary
CVE-2026-65975 describes an incorrect authorization vulnerability (CWE-863) in pydantic-ai's UI adapters (AG-UI and Vercel AI). The adapters use a sanitize_messages function to remove unresolved client-submitted tool calls before processing. However, the sanitization logic incorrectly anchors to a message index computed before sanitization, causing a trailing client message sanitized to empty to be dropped and a preceding assistant response with an unresolved tool call to become the new tail. This unresolved tool call is then dispatched without inspection, allowing a remote client to trigger execution of registered server tools with client-supplied arguments rather than model-generated ones. The impact is limited by the nature of the affected tools and is most significant when tool execution is gated by model-request hooks, as this bypasses those guardrails. Tools requiring approval are not auto-executed via this path. The vulnerability affects versions 1.88.0 up to but not including 1.107.1 and 2.0.0b1 up to but not including 2.5.0 and has been fixed in versions 1.107.1 and 2.5.0.
Potential Impact
A remote attacker can cause execution of registered server tools with client-supplied arguments, bypassing model-generated argument validation and any model-request hook guardrails that gate tool execution. This may lead to unauthorized actions depending on the capabilities of the affected tools. Tools requiring explicit approval are not affected by this bypass. The overall impact is limited to the scope of what the affected tools can perform and the deployment context.
Mitigation Recommendations
This vulnerability has been fixed in pydantic-ai versions 1.107.1 and 2.5.0. Users should upgrade to these or later versions to remediate the issue. No vendor advisory or patch links were provided, so check the official pydantic-ai release notes or repository for the official fix. Until upgraded, applications should review their use of UI adapters and consider additional validation or restrictions on tool execution to mitigate risk.
CVE-2026-65975: CWE-863: Incorrect Authorization in pydantic pydantic-ai
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.
CVSS v3.1
Score 6.5medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-65975 describes an incorrect authorization vulnerability (CWE-863) in pydantic-ai's UI adapters (AG-UI and Vercel AI). The adapters use a sanitize_messages function to remove unresolved client-submitted tool calls before processing. However, the sanitization logic incorrectly anchors to a message index computed before sanitization, causing a trailing client message sanitized to empty to be dropped and a preceding assistant response with an unresolved tool call to become the new tail. This unresolved tool call is then dispatched without inspection, allowing a remote client to trigger execution of registered server tools with client-supplied arguments rather than model-generated ones. The impact is limited by the nature of the affected tools and is most significant when tool execution is gated by model-request hooks, as this bypasses those guardrails. Tools requiring approval are not auto-executed via this path. The vulnerability affects versions 1.88.0 up to but not including 1.107.1 and 2.0.0b1 up to but not including 2.5.0 and has been fixed in versions 1.107.1 and 2.5.0.
Potential Impact
A remote attacker can cause execution of registered server tools with client-supplied arguments, bypassing model-generated argument validation and any model-request hook guardrails that gate tool execution. This may lead to unauthorized actions depending on the capabilities of the affected tools. Tools requiring explicit approval are not affected by this bypass. The overall impact is limited to the scope of what the affected tools can perform and the deployment context.
Mitigation Recommendations
This vulnerability has been fixed in pydantic-ai versions 1.107.1 and 2.5.0. Users should upgrade to these or later versions to remediate the issue. No vendor advisory or patch links were provided, so check the official pydantic-ai release notes or repository for the official fix. Until upgraded, applications should review their use of UI adapters and consider additional validation or restrictions on tool execution to mitigate risk.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-07-23T18:15:14.581Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a6a61149c2644c7f8ff97df
Added to database: 07/29/2026, 20:22:44 UTC
Last enriched: 07/29/2026, 20:38:50 UTC
Last updated: 07/29/2026, 21:07:18 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.