# CVE-2021-29510: Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** LOW 3.3
- **CVSS:** 3.3 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.97% (percentile 61, 2026-11-26)
- **CWE:** CWE-835
- **Aliases:** GHSA-5jqp-qgf6-3pvh, PYSEC-2021-47
- **Published:** 2021-05-13T18:55:11.000Z
- **Modified:** 2026-07-08T06:29:37.051Z

## 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

## 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

- PyPI `pydantic`: affected \< 1.6.2; fixed 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)

## Mitigation

- Upgrade pydantic to one of 1.6.2, 1.8.2, 1.7.4 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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.

## References

- vendor: <https://github.com/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB/>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2021-29510>
- patch: <https://github.com/samuelcolvin/pydantic/commit/7e83fdd2563ffac081db7ecdf1affa65ef38c468>
- patch: <https://github.com/pydantic/pydantic/commit/1c24f1d74ba95ea985b50bdc001ce96c813229aa>
- patch: <https://github.com/pydantic/pydantic/commit/80e0dd3f752bef145dce12f160d262bb40ec8d47>
- patch: <https://github.com/pydantic/pydantic/commit/bdde15b7b947c94ca00fd6eb92da8db390a13520>
- other: <https://github.com/pydantic/pydantic>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/pydantic/PYSEC-2021-47.yaml>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-29510>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-5jqp-qgf6-3pvh> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2021-47> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2021-29510> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-29510>
