CVE-2021-29510 json
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
published 2021-05-13 5 y ago modified 2026-07-08 4 mo ago also GHSA-5jqp-qgf6-3pvh , PYSEC-2021-47 , EUVD-2021-0206
- cvss
- 3.3
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.0%
- EPSS 1.0% chance of exploitation in 30 days, percentile 62%
- public exploits
- 0
- none known
Summary
Pydantic is a data validation and settings management using Python type hinting. In affected versions passing either `'infinity'`, `'inf'` or `float('inf')` (or their negatives) to `datetime` or `date` fields causes validation to run forever with 100% CPU usage (on one CPU). Pydantic has been patched with fixes available in the following versions: v1.8.2, v1.7.4, v1.6.2. All these versions are available on pypi(https://pypi.org/project/pydantic/#history), and will be available on conda-forge(https://anaconda.org/conda-forge/pydantic) soon. See the changelog(https://pydantic-docs.helpmanual.io/) for details. If you absolutely can't upgrade, you can work around this risk using a validator(https://pydantic-docs.helpmanual.io/usage/validators/) to catch these values. This is not an ideal solution (in particular you'll need a slightly different function for datetimes), instead of a hack like this you should upgrade pydantic. If you are not using v1.8.x, v1.7.x or v1.6.x and are unable to upgrade to a fixed version of pydantic, please create an issue at https://github.com/samuelcolvin/pydantic/issues requesting a back-port, and we will endeavour to release a patch for earlier versions of pydantic.
Patch / fix
- pypi pydantic 1.6.2, 1.7.4, 1.8.2
- pydantic pydantic 1.6.2, 1.7.4, 1.8.2
- pydantic Debian 14, Debian 13, Debian 12 1.7.4-1
debian advisories DEBIAN-CVE-2021-29510
- pydantic Ubuntu Pro 20.04 LTS 1.2-1ubuntu0.1~esm1
ubuntu advisories UBUNTU-CVE-2021-29510
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- python-pydantic openSUSE Tumbleweed 2.13.4-2.1
opensuse advisories openSUSE-SU-2026:11424-1
- python-pydantic Arch Linux 1.8.2-1
arch linux advisories AVG-1951
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-29510 updated cvss 7.5
python-pydantic: Use of "infinity" as an input to datetime and date fields causes infinite loop
-
Red Hat All currently supported Red Hat productsnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
0.97% chance of exploitation in the next 30 days, higher than 62% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 3.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L |
| NVD | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 2.0 | 5.0 | AV:N/AC:L/Au:N/C:N/I:N/A:P |
| GitHub | 3.1 | 3.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | pydantic | <1.6.2 >=1.8, <1.8.2 >=1.7, <1.7.4 |
1.6.2 1.8.2 1.7.4 |
Affected products
- samuelcolvin pydantic
Classification
- Weakness
-
- CWE-835 Loop with Unreachable Exit Condition
References
-
github.com
/samuelcolvin/pydantic/commit/7e83fdd2563ffac081db7ecdf1affa65ef38c468
web, patch, third-party-advisory
-
github.com
/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh
web, mitigation, patch, third-party-advisory, advisory
-
github.com
/pydantic/pydantic/commit/1c24f1d74ba95ea985b50bdc001ce96c813229aa
web
-
github.com
/pydantic/pydantic/commit/80e0dd3f752bef145dce12f160d262bb40ec8d47
web
-
github.com
/pydantic/pydantic/commit/bdde15b7b947c94ca00fd6eb92da8db390a13520
web
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB/
vendor-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-29510
advisory
-
github.com
/pydantic/pydantic
package
-
github.com
/pypa/advisory-database/tree/main/vulns/pydantic/PYSEC-2021-47.yaml
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV
web
Sources
- CVE List CVE-2021-29510
- GitHub Advisory GHSA-5jqp-qgf6-3pvh
- NVD CVE-2021-29510
- OSV PYSEC-2021-47
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.