Pydantic is a widely used PyPI package. As of 2026-05-24, there are 3 known vulnerabilities in the OSV database. The latest stable version is 2.13.4. Developers should audit their dependency trees and update to patched versions.
Package Overview
Known Vulnerabilities (3)
| ID | Severity | Score | Affected Versions | Fixed In | Description |
|---|---|---|---|---|---|
| CVE-2021-29510 | MODERATE | 5.0 | 0 to 1.6.2; 1.8 to 1.8.2; 1.7 to 1.7.4 | 1.6.2 | Use of "infinity" as an input to datetime and date fields causes infinite loop in pydantic |
| CVE-2024-3772 | MODERATE | 5.0 | 2.0.0 to 2.4.0; 0 to 1.10.13 | 2.4.0 | Pydantic regular expression denial of service |
| CVE-2021-29510 | UNKNOWN | - | 0 to 7e83fdd2563ffac081db7ecdf1affa65ef38c468; 0 to 1.6.2 | 7e83fdd2563ffac081db7ecdf1affa65ef38c468 | 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 |
Security Recommendations
- Pin Pydantic to the latest stable version (2.13.4) in your dependency manifest
- Enable automated dependency updates with Dependabot or Renovate
- Run regular vulnerability scans using
pip-audit - Review your lock file (requirements.txt) after every update
- Monitor the OSV database and NIST NVD for new advisories
FAQ
Is Pydantic safe to use?
Pydantic is actively maintained and widely used. As of 2026-05-24, there are 3 known vulnerabilities listed in the OSV database. Most have patches available. Keeping your dependencies updated and running regular security audits significantly reduces risk.
What vulnerabilities does Pydantic have?
The OSV database currently lists 3 vulnerabilities for Pydantic. These range in severity and are detailed in the vulnerability table above. Check the linked advisories for full technical details and remediation guidance.
How do I update Pydantic to fix vulnerabilities?
Run pip install --upgrade pydantic to get the newest version. Use pip-audit or safety check to scan for known vulnerabilities. Pin your dependencies with a requirements file and review updates regularly.
Using AI-Generated Code with Pydantic?
Our vibe coding security audit checks for misconfigurations, exposed secrets and vulnerable dependencies in AI-generated codebases. If your project uses Pydantic, we can verify it is locked to a safe version and properly configured.
Get a Vibe Coding Security Audit