Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply prompt-injected input to agent
-
ExploitSandboxed snippet invokes run_nested_call()
-
ExecutionNested calls skip check_before_tool_call
-
ImpactExceed tool_calls_limit on costly tools
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V2 - Validation and Business Logic Resource allocation limits
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to deploy the pydantic-ai-harness CodeMode toolset with run_code enabled AND to rely on an operator-configured UsageLimits.tool_calls_limit for cost or safety control - without that limit there is nothing to bypass. The attacker must be able to influence the sandboxed program's behavior, either as a user of the agent or through prompt-injected content that reaches the agent, causing it to call run_nested_call(). Limiting factors: the flaw only matters where tool_calls_limit is set as a guardrail; impact is bounded to exceeding call counts on costly or side-effecting tools (no data exposure); and it affects only versions before 0.59.0. The AT:P metric reflects this feature-and-configuration dependency. |
| Impact | This is a moderate-risk resource/limit-enforcement flaw (CWE-770), not a code-execution or data-disclosure bug. The vendor CVSS 4.0 score is 6.3 with vector AV:N/AC:L/AT:P/PR:N/UI:N and impact limited to VI:L/VA:L (no confidentiality, no subsequent-system impact), which aligns well with the description: the only consequence is that an operator-configured UsageLimits.tool_calls_limit is bypassed for nested tool calls, allowing more invocations of costly or side-effecting tools than intended. The AT:P (attack requirements present) metric is significant - it signals that exploitation is conditional on the application actually using the CodeMode toolset's run_code feature with a tool_calls_limit configured, which tempers the PR:N/UI:N 'unauthenticated remote' framing. No EPSS score, no CISA KEV listing, and no public exploit were provided, so this is best characterized as no public exploit identified at time of analysis; the Denial Of Service tag reflects the resource/cost-exhaustion nature rather than any evidence of active exploitation. Net: a genuine guardrail-bypass worth patching for teams relying on tool_calls_limit as a cost or safety control, but not an urgent widespread-exploitation emergency. One data note: the input tags omit the prompt-injection/LLM-agent context that the description makes central - verify threat model against your own agent deployment. |
| Exploit ScenarioDerived | An application exposes a pydantic-ai agent with the CodeMode toolset and sets UsageLimits.tool_calls_limit to cap invocations of an expensive or side-effecting tool. An attacker supplies input to the agent (directly, or via prompt-injected content the agent ingests) that causes the sandboxed snippet to call run_nested_call() repeatedly; because these nested calls skip check_before_tool_call, the operator's limit is never enforced and the tool runs well past the intended cap. No public exploit code was identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 21, 2026
Pydantic AI Harness versions before 0.59.0 fail to enforce the operator-configured UsageLimits.tool_calls_limit for nested tool invocations dispatched from inside a sandboxed run_code snippet in the CodeMode toolset, letting a program call run_nested_call() repeatedly and reach costly or side-effecting tools far beyond the intended ceiling. Unauthenticated remote attackers who can shape the agent's execution - as a user of the agent or through prompt-injected content - can therefore bypass a guardrail that operators rely on for cost and safety control, with impact bounded to resource exhaustion/limit violation rather than data exposure or code execution. This is a moderate CWE-770 resource-throttling flaw; no public exploit code or active exploitation was identified at time of analysis, and the vendor has released 0.59.0 to correct it.
RemediationAI
Upgrade pydantic-ai-harness to 0.59.0 (PyPI) or later, which corresponds to repository tag v2.59.0; the fix lands via PR https://github.com/pydantic/pydantic-ai/pull/10362 and commit https://github.com/pydantic/pydantic-ai/commit/eb27b2b89fe76ae23ee9b6fc9eb4b227a4967949, and the vendor advisory is at https://www.vulncheck.com/advisories/pydantic-ai-harness-before-0.59.0-codemode-tool-call-limit-bypass-via-run-code. After upgrading, verify that nested calls now count toward tool_calls_limit together with the run_code call and terminate the run with UsageLimitExceeded even if the snippet swallows the exception; also be aware that speculatively launched calls count from the moment they start, so budgets may be consumed earlier than before. If upgrading is not immediately possible, treat tool_calls_limit as unreliable for CodeMode and add compensating controls: disable the CodeMode/run_code toolset entirely (removes the sandboxed-program capability and any agent workflows that depend on it), remove high-cost or side-effecting tools from the toolset exposed to CodeMode so nested dispatch cannot reach them (degrades agent capability for those tools), and enforce spend/time ceilings outside the agent - per-request token and tool-invocation quotas at the API gateway or application layer plus outbound rate limits on the tools' downstream APIs (adds latency and needs its own tuning, but caps damage from a runaway loop). Monitor agent runs for abnormal tool-call counts per run_code invocation as a detection backstop, and treat untrusted or prompt-injected content reaching the agent as a potential trigger.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
pydantic-ai-harness ships a CodeMode toolset that lets an agent emit a Python-like program which runs inside a restricted executor (the harness's _monty_exec sandbox, with eager and speculative scheduling components in code_mode/_eager.py and code_mode/_speculation.py) and reaches back out to real tools through run_nested_call(). The intended contract is that every tool call - including nested ones - is validated through check_before_tool_call and counted against UsageLimits.tool_calls_limit, alongside the run_code call that made it. Versions before 0.59.0 checked only top-level dispatch, so nested calls bypassed both the pre-call check and the counter, and catching the resulting error inside the snippet was unnecessary because no error was raised at all. This is CWE-770 (Allocation of Resources Without Limits or Throttling): the throttle is advisory rather than enforced on one code path. The upstream fix (PR #10362, commit eb27b2b8) adds a per-execution usage_limit_exceeded state that is raised from the eager call path, makes the limit count calls still pending so an over-limit nested call terminates the run with UsageLimitExceeded even if the snippet catches it, and documents that a call launched eagerly by speculate counts from the moment it starts. Note this is a guardrail-bypass class issue: it changes nothing about the sandbox's memory/duration resource_limits, which are separate controls.
Know when Pydantic gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N
Reachable over the network via agent input with no auth (PR:N), but only low integrity/availability impact from exceeding tool-call caps; no confidentiality impact and no scope change.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
Pydantic AI Harness before 0.59.0 fails to enforce UsageLimits.tool_calls_limit on nested tool calls dispatched from run_code in the CodeMode toolset. Users or prompt-injected content can make the sandboxed program invoke tools via run_nested_call() without check_before_tool_call, exceeding operator limits on costly or side-effecting tools.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
n8n-workflows Main Commit ee25413 allows attackers to execute a directory traversal via the download_workflow function w
Pydantic AI versions 0.0.26 through 1.55.x contain a server-side request forgery vulnerability in URL download functiona
Regular expression denial of service in Pydanic < 2.4.0, < 1.10.13 allows remote attackers to cause denial of service vi
HTTPX2's SOCKS5 proxy implementation omits TLS negotiation for WebSocket Secure (wss://) origins, exposing the full WebS
Cross-site request forgery in Pydantic AI's development web chat UI allows any website a developer happens to visit whil
Concurrency slot exhaustion in Pydantic AI 2.10.0 through 2.52.x lets streamed model requests permanently occupy slots i
Memory exhaustion via unbounded decompression in HTTPX2 (all versions before 2.12.0) allows any HTTP server the client c
Pydantic is a data validation and settings management using Python type hinting. Rated high severity (CVSS 7.5), this vu
Server-Side Request Forgery in Pydantic AI (versions 1.56.0-1.101.0, 2.0.0b1, 2.0.0b2) allows unauthenticated network at
Server-side request forgery in Pydantic AI's URL-fetching guards lets an application that has explicitly opted a URL int
Server-Side Request Forgery in Pydantic AI's UI adapter layer (versions 1.65.0-1.105.0 and 2.0.0b1-2.0.0b5) allows unaut
Pydantic AI, a Python framework for building Generative AI agents, buffers complete HTTP response bodies before applying
EUVD-2026-107233
GHSA-3589-pxp7-3gj8
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB