# GHSA-JFV7-GHGV-GX4X: Quadratic time timedelta validation in Pydantic V1

- Database: GitHub
- Severity: CVSS 6.9 (Medium)
- Published: 2026-10-29
- Modified: 2026-11-19

## Tracked as

- [CVE-2026-133421](https://cve.now/CVE-2026-133421.md): Pydantic denial of service in ISO 8601 duration parsing

## Affected versions

- pydantic (PyPI): through 1.10.26

## Description

### Summary

Validating an untrusted ISO 8601 duration string into a [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta) field with Pydantic V1 takes quadratic time: an input of a few dozen kilobytes takes seconds to validate.

### Details

The [`iso8601_duration_re`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/datetime_parse.py#L45) regular expression used to parse ISO 8601 durations (in [`pydantic/datetime_parse.py`](https://github.com/pydantic/pydantic/blob/v1.10.26/pydantic/datetime_parse.py)) contains an unescaped `.`, which also matches digits:

```python
iso8601_duration_re = re.compile(
    r'^(?P<sign>[-+]?)'
    r'P'
    r'(?:(?P<days>\d+(.\d+)?)D)?'
    r'(?:T'
    r'(?:(?P<hours>\d+(.\d+)?)H)?'
    r'(?:(?P<minutes>\d+(.\d+)?)M)?'
    r'(?:(?P<seconds>\d+(.\d+)?)S)?'
    r')?'
    r'$'
)
```

On a string of digits, the repeated groups overlap and the regex engine backtracks in quadratic time.

The issue was fixed in commit https://github.com/pydantic/pydantic/commit/62791e66a9f8f118e465ed760c9e2ede9ae3055e.

If you are relying on the `pydantic.v1` namespace in Pydantic V2, upgrade to [V2.14.2](https://github.com/pydantic/pydantic/releases/tag/v2.14.2) or later.

### Impact

Denial of service through validation of untrusted input. Affected are applications validating untrusted strings into [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta) fields.

## References

- https://github.com/pydantic/pydantic/security/advisories/GHSA-jfv7-ghgv-gx4x

Page: https://cve.now/GHSA-JFV7-GHGV-GX4X
