CVE-2021-29510
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
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.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
3.3
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
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.
- Record
CVE-2021-29510- CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - Weakness
- CWE-835
- Updated
- 2026-11-02
EUVDEUVD-2021-0206
3.3
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.
- Record
EUVD-2021-0206- CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-5jqp-qgf6-3pvh
5.3
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
Impact
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). Patches
Pydantic is be patched with fixes available in the following versions:
v1.8.2
v1.7.4
v1.6.2
All these versions are available on pypi, and will be available on conda-forge soon.
See the changelog for details. Workarounds
If you absolutely can't upgrade, you can work around this risk using a validator to catch these values, brief demo:
from datetime import date from pydantic import BaseModel, validator
class DemoModel(BaseModel): date_of_birth: date
@validator('date_of_birth', pre=True)
def skip_infinite_values(cls, v):
try:
seconds = float(v)
except (ValueError, TypeError):
return v
else:
if seconds == float('inf'):
return date.max
elif seconds == float('-inf'):
return date.min
else:
return seconds
Note: 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 requesting a back-port, and we will endeavour to release a patch for earlier versions of pydantic. References
This was fixed in commit 7e83fdd.
- Record
GHSA-5jqp-qgf6-3pvh- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - Weakness
- CWE-835
- Updated
- 2026-11-02
NVD
3.3
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.
- Record
CVE-2021-29510- CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:N/A:P - Weakness
- CWE-835
- Updated
- 2026-11-02
OSV
7.5
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.
- Record
CVE-2021-29510- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-29510
7.5
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.
- Record
DEBIAN-CVE-2021-29510- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Show 7 moreShow less
OSVGHSA-5jqp-qgf6-3pvh
5.3
Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic
Impact
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). Patches
Pydantic is be patched with fixes available in the following versions:
v1.8.2
v1.7.4
v1.6.2
All these versions are available on pypi, and will be available on conda-forge soon.
See the changelog for details. Workarounds
If you absolutely can't upgrade, you can work around this risk using a validator to catch these values, brief demo:
from datetime import date from pydantic import BaseModel, validator
class DemoModel(BaseModel): date_of_birth: date
@validator('date_of_birth', pre=True)
def skip_infinite_values(cls, v):
try:
seconds = float(v)
except (ValueError, TypeError):
return v
else:
if seconds == float('inf'):
return date.max
elif seconds == float('-inf'):
return date.min
else:
return seconds
Note: 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 requesting a back-port, and we will endeavour to release a patch for earlier versions of pydantic. References
This was fixed in commit 7e83fdd.
- Record
GHSA-5jqp-qgf6-3pvh- CVSS 4.0
- 5.3 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - Weakness
- CWE-835
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-29510
3.3
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.
- Record
UBUNTU-CVE-2021-29510- CVSS 3.1
- 3.3 Low
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVopenSUSE-SU-2024:11254-1 No score
python36-pydantic-1.8.2-1.2 on GA media
These are all security issues fixed in the python36-pydantic-1.8.2-1.2 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:11254-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2024:13869-1 No score
python310-pydantic-2.6.4-2.1 on GA media
These are all security issues fixed in the python310-pydantic-2.6.4-2.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:13869-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2026:11424-1 No score
python313-pydantic-2.13.4-2.1 on GA media
These are all security issues fixed in the python313-pydantic-2.13.4-2.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2026:11424-1- Updated
- 2026-11-02
OSVPYSEC-2021-47 No score
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.
- Record
PYSEC-2021-47- Updated
- 2026-11-02
OSVUSN-6553-1 No score
pydantic vulnerability
Nina Jensen discovered that Pydantic incorrectly handled user input in the date and datetime fields. An attacker could possibly use this issue to cause a denial of service via application crash. (CVE-2021-29510)
- Record
USN-6553-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
pydanticPyPI |
before 1.6.2 | 1.6.2 |
pydanticPyPI |
1.8 up to 1.8.2 | 1.8.2 |
pydanticPyPI |
1.7 up to 1.7.4 | 1.7.4 |
pydanticDebian:12 |
before 1.7.4-1 | 1.7.4-1 |
pydanticDebian:13 |
before 1.7.4-1 | 1.7.4-1 |
pydanticDebian:14 |
before 1.7.4-1 | 1.7.4-1 |
pydanticPyPI |
before 1.6.2, plus listed versions 0.0.10.0.20.0.30.0.40.0.5 Show 45 moreShow less0.0.60.0.70.0.80.10.100.110.11.10.11.20.120.12.10.130.13.10.140.150.160.16.10.170.180.18.10.18.20.190.20.2.10.200.20.10.20a10.210.220.230.240.250.260.270.27a10.280.290.30.300.30.10.310.31.10.320.32.10.32.20.4 |
1.6.2 |
pydanticPyPI |
1.8 up to 1.8.2, plus listed versions 1.8.1 |
1.8.2 |
pydanticPyPI |
1.7 up to 1.7.4, plus listed versions 1.7.11.7.21.7.3 |
1.7.4 |
pydanticPyPI |
before 1.6.2, 1.7 up to 1.7.4, 1.8 up to 1.8.2, plus listed versions 0.0.10.0.20.0.30.0.40.0.5 Show 45 moreShow less0.0.60.0.70.0.80.10.100.110.11.10.11.20.120.12.10.130.13.10.140.150.160.16.10.170.180.18.10.18.20.190.20.2.10.200.20.10.20a10.210.220.230.240.250.260.270.27a10.280.290.30.300.30.10.310.31.10.320.32.10.32.20.4 |
1.6.21.7.41.8.2 |
pydanticUbuntu:Pro:20.04:LTS |
before 1.2-1ubuntu0.1~esm1, plus listed versions 0.30.1-11.2-1 |
1.2-1ubuntu0.1~esm1 |
python-pydanticopenSUSE:Tumbleweed From an advisory covering 2 CVEs |
before 2.13.4-2.1 | 2.13.4-2.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-29510 is a low vulnerability (CVSS 3.3) in Pydantic, published May 13, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.97%, the 62nd percentile. Fixed in pydantic 1.6.2.
References
github.com/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh
github.com/samuelcolvin/pydantic/commit/7e83fdd2563ffac081db7ecdf1affa65ef38c468
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB
nvd.nist.gov/vuln/detail/CVE-2021-29510
Show 15 moreShow less
github.com/pydantic/pydantic/commit/1c24f1d74ba95ea985b50bdc001ce96c813229aa
github.com/pydantic/pydantic/commit/80e0dd3f752bef145dce12f160d262bb40ec8d47
github.com/pydantic/pydantic/commit/bdde15b7b947c94ca00fd6eb92da8db390a13520
github.com/pypa/advisory-database/tree/main/vulns/pydantic/PYSEC-2021-47.yaml
lists.fedoraproject.org/archives/list/[email protected]/message/S2HT266L6Q7H6ICP7DFGXOGBJHNNKMKB
lists.fedoraproject.org/archives/list/[email protected]/message/UEFWM7DYKD2ZHE7R5YT5EQWJPV4ZKYRB
lists.fedoraproject.org/archives/list/[email protected]/message/UMKAJX4O6IGBBCE32CO2G7PZQCCQSBLV
github.com/advisories/GHSA-5jqp-qgf6-3pvh
security-tracker.debian.org/tracker/CVE-2021-29510
github.com/pydantic/pydantic
ubuntu.com/security/CVE-2021-29510
ubuntu.com/security/notices/USN-6553-1
cve.org/CVERecord?id=CVE-2021-29510
suse.com/security/cve/CVE-2021-29510
suse.com/security/cve/CVE-2024-3772
Left out here: 123 versions. The JSON record has them.