CVE-2026-133421: Quadratic time timedelta validation in Pydantic V1
Validating an untrusted ISO 8601 duration string into a timedelta field with Pydantic V1 takes quadratic time: an input of a few dozen kilobytes takes seconds to validate.
The iso8601durationre regular expression used to parse ISO 8601 durations (in pydantic/datetimeparse.py) contains an unescaped ".", which also matches digits. On a string of digits, the repeated groups overlap and the regex engine backtracks in quadratic time.
The issue was fixed in commit 62791e66a9f8f118e465ed760c9e2ede9ae3055e. Users relying on the pydantic.v1 namespace in Pydantic V2 should upgrade to 2.14.2 or later.
Impact: denial of service through validation of untrusted input. Affected are applications validating untrusted strings into timedelta fields.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pydanticto a version that resolves this vulnerability.Patch 62791e66a9f8f118e465ed760c9e2ede9ae3055e - Upgrade
Upgrade
pydanticto a version that resolves this vulnerability.Fixed in 2.14.2
Event History
Frequently Asked Questions
Which applications are exposed to this denial-of-service issue?
Applications are affected when they validate untrusted strings into timedelta fields using Pydantic V1. This also includes applications using the pydantic.v1 namespace in Pydantic V2.
What does an attacker need to exploit it?
An attacker needs to submit a crafted ISO 8601 duration value where it is processed as an untrusted timedelta field. A digits-only input can trigger quadratic regular-expression backtracking, and inputs of a few dozen kilobytes can take seconds to validate.
What should teams using the Pydantic V1 compatibility namespace do?
Upgrade to Pydantic 2.14.2 or later when relying on the pydantic.v1 namespace. The fix is in commit 62791e66a9f8f118e465ed760c9e2ede9ae3055e.