Vulnerability  ·  2026-11-20

Pydantic AI Harness: ToolOutputLimits ANSI-stripping is quadratic — crafted tool output blocks the event loop

VulnerabilityMedium impactGlobalCVE-2026-133161
The stripping runs on the event loop before the capability reduces the output, so the output size limits do not bound the work. The advisory characterises the attacker as able to place text in content a tool returns, and the fix resolves the quadratic ANSI-stripping pattern.
Agents routinely run untrusted tool output. A malicious tool or MCP result can induce a single-process denial of service that stalls every concurrent agent run and inference request served by that harness process — a low-effort availability attack in the agent runtime layer.
When strip_ansi=True, ToolOutputLimits strips ANSI escape sequences with a pattern that is quadratic in line length. A tool result of a few hundred kilobytes crafted with many unterminated escape sequences occupies the event loop for tens of seconds to minutes, delaying every other request and agent run in the process.
pydantic-ai-harness with ToolOutputLimits (named OverflowingToolOutput before 0.13.0) and strip_ansi=True; fixed in 0.70.0
Upgrade pydantic-ai-harness to 0.70.0 or later, or leave strip_ansi at its default False. On Pydantic AI v1 (cannot upgrade past 0.4.0) upgrade to v2 plus harness 0.70.0 or disable strip_ansi.
Pydantic AI Harness security advisory GHSA-m4cr-m4qc-9hh3NVD — CVE-2026-133161
See this in the live feed Explore related AI security and governance findings — updated every morning.
Open the feed →