CVE-2021-29510
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
Also known as GHSA-5jqp-qgf6-3pvh, PYSEC-2021-47
Mitigation
- Upgrade pydantic to one of 1.6.2, 1.8.2, 1.7.4 (or later in the same release line).
Who should check
- Projects that depend on PyPI package pydantic (< 1.6.2)
- Anyone running samuelcolvin pydantic >= 1.8.0, < 1.8.2; >= 1.7.0, < 1.7.4; < 1.6.2
Vulnerability facts
- Affected
- pydantic < 1.6.2
- Fixed in
- 1.6.2, 1.8.2, 1.7.4
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 3.3 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: None
- Availability impact: Low
- EPSS
- 0.97% chance of exploitation in 30 days (percentile 61, 2026-11-26)
- CWE
- CWE-835
- Modified
Description
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI pydantic | < 1.6.2 | 1.6.2, 1.8.2, 1.7.4 | osv |
| samuelcolvin pydantic | >= 1.8.0, < 1.8.2; >= 1.7.0, < 1.7.4; < 1.6.2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2021-29510. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2021-29510.md Affected: pydantic < 1.6.2 Fixed in: 1.6.2, 1.8.2, 1.7.4 Steps: 1. Search this machine and project for pydantic (PyPI), samuelcolvin pydantic: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
- https://github.com/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB/
- https://nvd.nist.gov/vuln/detail/CVE-2021-29510
Patches
- https://github.com/samuelcolvin/pydantic/commit/7e83fdd2563ffac081db7ecdf1affa65ef38c468
- https://github.com/pydantic/pydantic/commit/1c24f1d74ba95ea985b50bdc001ce96c813229aa
- https://github.com/pydantic/pydantic/commit/80e0dd3f752bef145dce12f160d262bb40ec8d47
- https://github.com/pydantic/pydantic/commit/bdde15b7b947c94ca00fd6eb92da8db390a13520
Other
- https://github.com/pydantic/pydantic
- https://github.com/pypa/advisory-database/tree/main/vulns/pydantic/PYSEC-2021-47.yaml
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV
FAQ
Is CVE-2021-29510 being exploited?
There is no confirmed exploitation: CVE-2021-29510 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.97% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2021-29510?
Low: CVSS 3.3 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2021-29510?
pydantic < 1.6.2.
Is there a fix for CVE-2021-29510?
Yes. Fixed in 1.6.2, 1.8.2, 1.7.4. Upgrade pydantic to one of 1.6.2, 1.8.2, 1.7.4 (or later in the same release line).
How do I check if I'm affected by CVE-2021-29510?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.