CVE-2026-133161: Harness `ToolOutputLimits` ANSI stripping can take quadratic time, blocking the event loop
Summary ui
With stripansi=True, Pydantic AI Harness's ToolOutputLimits capability removes ANSI escape sequences from tool output with a pattern that takes time quadratic in the length of a line. A tool result of a few hundred kilobytes, crafted with many unterminated escape sequences, can occupy the event loop for tens of seconds to minutes, delaying every other request and agent run in the process.
Details
This affects applications that set stripansi=True on ToolOutputLimits (named OverflowingToolOutput before 0.13.0) and run tools whose output an attacker can influence, such as shell commands, file reads, fetched pages or MCP servers. Stripping runs on the event loop before the capability reduces the output, so its own size limits do not bound it.
The assumed attacker can place text in content a tool returns.
Mitigation
Upgrade pydantic-ai-harness to 0.70.0 or later. Until then, leave stripansi at its default, False.
On Pydantic AI v1, the harness cannot be upgraded past 0.4.0. Upgrade to Pydantic AI v2 and pydantic-ai-harness 0.70.0, or leave stripansi off.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pydantic-ai-harnessto a version that resolves this vulnerability.Fixed in 0.70.0 - Upgrade
Upgrade
Pydantic AIto a version that resolves this vulnerability.Fixed in 2 - Configuration
Leave strip_ansi disabled (False) on ToolOutputLimits.
Pydantic AI Harness ToolOutputLimits strip_ansi = False
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Applications are affected when they enable strip_ansi=True on ToolOutputLimits and run tools whose output can be influenced by an attacker, including shell commands, file reads, fetched pages, or MCP servers. The default setting, strip_ansi=False, is not affected by this condition.
What does an attacker need to trigger the denial of service?
An attacker needs to be able to place crafted text into content returned by a tool. Output containing many unterminated ANSI escape sequences can cause ANSI stripping to consume quadratic time on the event loop.
Do ToolOutputLimits size limits prevent exploitation?
No. ANSI stripping occurs on the event loop before the capability reduces the output, so the capability's output-size limits do not bound the expensive processing.
What can be done if an upgrade is not immediately possible?
Leave strip_ansi disabled, which is its default value. For Pydantic AI v1, the harness cannot be upgraded beyond 0.4.0; move to Pydantic AI v2 with pydantic-ai-harness 0.70.0, or keep strip_ansi off.
What version contains the fix?
Upgrade pydantic-ai-harness to version 0.70.0 or later.