# CVE-2026-133161: Harness `ToolOutputLimits` ANSI stripping can take quadratic time, blocking the event loop


- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 19 Nov 2026
- **Updated:** 19 Nov 2026
- **Also known as:** GHSA-wvp9-4g4g-qwgm

## What is CVE-2026-133161?

CVE-2026-133161 is a high-severity vulnerability in pydantic-ai-harness, published on 19 Nov 2026. 

### Official description

### Summary ui

With `strip_ansi=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 `strip_ansi=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 `strip_ansi` 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 `strip_ansi` off.

Weakness: CWE-1333 (Inefficient Regular Expression Complexity)

## Which versions are affected by CVE-2026-133161?


## How do I fix CVE-2026-133161?

Upgrade pydantic-ai-harness to 0.13.0 or later. The advisory says that version fixes it.

## Is CVE-2026-133161 being exploited?

There is no known exploitation of CVE-2026-133161 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-133161 and fix it if it is affected.

What it is: CVE-2026-133161 is a high-severity vulnerability in pydantic-ai-harness, published on 19 Nov 2026. 
Exploitation: There is no known exploitation of CVE-2026-133161 in the wild and no public exploit code.

Affected product: pydantic-ai-harness. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-133161/ (Markdown: https://insights.sbomify.com/CVE-2026-133161/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-133161
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-133161
- OSV: https://osv.dev/vulnerability/CVE-2026-133161

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-133161/
Summaries are generated and may contain mistakes; the official description above is the record.
