A vulnerability in Pydantic AI Harness allows attackers to freeze the event loop for tens of seconds to minutes by crafting tool output with many unterminated ANSI escape sequences. The flaw affects applications that enable ANSI stripping on tool output and run tools whose results an attacker can influence.
Quick Take
- What: CVE-2026-133161, a quadratic-time regular expression in Pydantic AI Harness’s
ToolOutputLimitscapability (formerlyOverflowingToolOutput) whenstrip_ansi=True - Who is affected: Applications using pydantic-ai-harness versions 0.4.0 through 0.69.0 that set
strip_ansi=Trueand run tools with attacker-influenced output (shell commands, file reads, fetched pages, MCP servers) - CVSS: 7.5 High (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
- What to do: Upgrade pydantic-ai-harness to version 0.70.0 or later; until then, leave
strip_ansiat its default value ofFalse - Pydantic AI v1 users: Upgrade to Pydantic AI v2 and pydantic-ai-harness 0.70.0, or leave
strip_ansioff
In plain English
Pydantic AI Harness is a tool that helps AI agents run commands and process their output. When it tries to clean up colored text (ANSI codes) from command results, it uses a slow method that gets much slower the longer the text is. An attacker who can control what a command returns can craft specially formatted text that can stall the whole application for minutes. Only developers who turned on the strip_ansi setting are affected (it is off by default). If you use Pydantic AI Harness in your code, upgrade to version 0.70.0. If you are not a developer or do not use this tool, you can ignore this issue.
What happened
With strip_ansi=True, Pydantic AI Harness’s ToolOutputLimits capability removes ANSI escape sequences from tool output using a regular expression 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.
The vulnerability affects applications that set strip_ansi=True on ToolOutputLimits (named OverflowingToolOutput before version 0.13.0) and run tools whose output an attacker can influence, such as shell commands, file reads, fetched pages or MCP servers. The stripping runs on the event loop before the capability reduces the output, so its own size limits do not bound the attack.
The assumed attacker can place text in content a tool returns. Only applications that set strip_ansi=True are affected; the default is False.
What you should do
Upgrade pydantic-ai-harness to version 0.70.0 or later. Until you upgrade, leave strip_ansi at its default value of False.
On Pydantic AI v1, the harness cannot be upgraded past version 0.4.0. Upgrade to Pydantic AI v2 and pydantic-ai-harness 0.70.0, or leave strip_ansi off.
What it means
The vulnerability is tracked as CVE-2026-133161 and carries a CVSS 3.1 score of 7.5 (High). The weakness is classified as CWE-1333 (Inefficient Regular Expression Complexity). The flaw was reported by manus-pi and manus-use. Pydantic published a security advisory (GHSA-m4cr-m4qc-9hh3) on November 18, 2026.
Denial of service through slow regular expressions also hit agent tooling recently: see our report on the IBM ContextForge MCP Gateway ReDoS flaw and on three MCP servers that let AI agents break out of tool limits. New cases are tracked in our AI Security hub.
Sources
- NVD CVE-2026-133161
- Pydantic GitHub Advisory GHSA-m4cr-m4qc-9hh3



