Case · DiggingBeagle record

Pydantic AI Harness ANSI stripping could block other agents through quadratic parsing

The Pydantic AI advisory explains that optional strip_ansi=True applies a potentially quadratic regular expression to attacker-influenced tool output before truncation, risking an event-loop stall.

Published by DiggingBeagle:

Scope

The vulnerability requires the optional processing path and sufficiently crafted untrusted text; no widespread outage count is documented. The Pydantic AI advisory explains that optional strip_ansi=True applies a potentially quadratic regular expression to attacker-influenced tool output before truncation, risking an event-loop stall.

Assessment profile

Assessment method
Setting
research demonstration
Exploitation
demonstrated
Evidence
Grade B
Remediation
patch available
AI role
AGAINST AI
Basis and provenance

Maintainer advisory describes a reproducible quadratic regex when strip_ansi is enabled and a fixed 0.70.0 release; active outage count is not known. Impact grade is left null rather than converting a vendor statistic, controlled attack result or unmeasured installed-base exposure into a standardized realized-harm score.

Assessed Nov 19, 2026 using diggingbeagle.assessment/1.

At a glance

Claims & evidence

CLM-DB264-PYDANTIC-ANSI-REGEX-BOUNDARYThe advisory lists affected versions from 0.4.0 to 0.69.0 and identifies 0.70.0 as the fix in the vulnerable version family. The vulnerability requires the optional processing path and sufficiently crafted untrusted text; no widespread outage count is documented.supported

Basis: reported finding

Link to claim
CLM-DB264-PYDANTIC-ANSI-REGEX-MECHANISMThe Pydantic AI advisory explains that optional strip_ansi=True applies a potentially quadratic regular expression to attacker-influenced tool output before truncation, risking an event-loop stall.supported

Basis: reported finding

Link to claim

Implications

Output-size truncation cannot protect an agent server when expensive text transformations happen before the truncation boundary.

Controls and mitigations

  • Update pydantic-ai-harness to 0.70.0 or later in the affected release line, and ensure untrusted tool-output size limits apply before expensive parsing.

Unknowns and contradictions

  • Observed production exploitation, the vulnerable task size and other framework versions with the optional feature.

Sources and citation

Material revision history

  1. Nov 19, 2026 · Published version · first publication · revision 266