CVE-2026-133161: Pydantic AI Harness's ToolOutputLimits(strip_ansi=True) can be stalled for minutes by crafted tool output, blocking every agent run in the process (fixed 0.70.0)
With strip_ansi=True, the ToolOutputLimits capability in pydantic-ai-harness strips ANSI escape sequences from tool output with a pattern that takes time quadratic in the line length. A tool result of a few hundred kilobytes with many unterminated escape sequences can hold the event loop for tens of seconds to minutes, delaying every other request and agent run in the process. The attacker only needs to put text into something a tool returns: shell output, a file, a fetched page or an MCP server response. Affects 0.4.0 to 0.69.0; fixed in 0.70.0.
What it is
Stripping runs on the event loop before the capability shortens the output, so its own size limits don't bound the work.
Only applications that set strip_ansi=True on ToolOutputLimits (called OverflowingToolOutput before 0.13.0) are affected; the default is False.
Affected: pydantic-ai-harness >= 0.4.0, <= 0.69.0. Fixed in 0.70.0. On Pydantic AI v1 the harness can't be upgraded past 0.4.0, so v1 users need to move to Pydantic AI v2 or keep strip_ansi off. GitHub published the advisory on 18 November 2026 and the CVE followed on 19 November.
How to check
- Run pip show pydantic-ai-harness and check the version.
- Search your code for strip_ansi=True on ToolOutputLimits or OverflowingToolOutput.
How to fix
- Upgrade to pydantic-ai-harness 0.70.0 or later (needs Pydantic AI v2).
- Until then, leave strip_ansi at its default, False.
- Run long or untrusted tool calls with timeouts and off the main event loop.
pip show pydantic-ai-harness | grep -i '^version'
grep -rnE 'strip_ansi\s*=\s*True' --include='*.py' . Sources
- highCVE-2026-107295: any website can make the Pydantic AI web chat UI (Agent.to_web, clai web) run your agent and its tools, upgrade to 1.107.4 or 2.28.0
- mediumCVE-2026-133505: In Pydantic AI, third-party data in a tool result shaped like a file object was rebuilt as a real file when message history was reloaded, triggering local-network downloads or s3:// reads with the app's credentials (fixed 1.107.10 / 2.66.0)