CVE-2026-133161: Pydantic AI Harness ANSI stripping flaw blocks event loop

A quadratic-time regular expression in Pydantic AI Harness's ANSI stripping code can freeze the event loop for minutes when processing attacker-controlled tool output, delaying all other requests.

Christopher Ort
By Christopher Ort · 2 min read
Share
A developer staring at a frozen terminal screen in a dimly lit office, hands hovering over a keyboard
Image: AI-generated, i10X
On this page
  1. Quick Take
  2. In plain English
  3. What happened
  4. What you should do
  5. What it means
  6. Sources

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.

i10X Quick Take

Quick Take

  1. What: CVE-2026-133161, a quadratic-time regular expression in Pydantic AI Harness’s ToolOutputLimits capability (formerly OverflowingToolOutput) when strip_ansi=True
  2. Who is affected: Applications using pydantic-ai-harness versions 0.4.0 through 0.69.0 that set strip_ansi=True and run tools with attacker-influenced output (shell commands, file reads, fetched pages, MCP servers)
  3. CVSS: 7.5 High (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
  4. What to do: Upgrade pydantic-ai-harness to version 0.70.0 or later; until then, leave strip_ansi at its default value of False
  5. Pydantic AI v1 users: Upgrade to Pydantic AI v2 and pydantic-ai-harness 0.70.0, or leave strip_ansi off

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
Christopher Ort

Christopher Ort

Christopher Ort handles SEO, AI agent workflows and PR & partnerships at i10x.ai, the all-in-one AI workspace built by i10X Global Pte. Ltd. in Singapore. He is a graduate of Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU). He is the author of “The Style Penalty”, a study published on SSRN that analyses 1,576 evaluation decisions by four frontier AI models to show how AI-written CVs fare in automated hiring screens; the research has been covered by heise online and t3n.

Editor's picks

  1. CVE-2026-133161: Pydantic AI Harness ANSI stripping flaw blocks event loop
  2. Circus Brings Its CA-1 Robot Kitchen Into a Hospital, Serving Fresh Meals Around the Clock at Schoen Clinic Munich
  3. Metano Emerges From Stealth With a $12 Million Seed to Secure AI Agents Across Endpoints, Cloud and SaaS
  4. IEA World Energy Outlook 2026: AI Boom Doubles Data Center Electricity Use to 1,000 TWh by 2030
  5. Know Your Agent: Singapore’s MAS Plans a Protocol for AI Agents in Banking and Warns Users Not to Share Their Logins