CVE-2026-107287: Pydantic AI Excessive Resource Consumption Due to Nested HTML Conversion
Summary
CVE-2026-107287: Pydantic AI: Excessive resource use when local web fetching converts nested HTML. Affects pydantic-ai across 2 version ranges.
>= 1.77.0, < 1.107.7
>= 2.0.0b1, < 2.52.0
Fixed in 1.107.7 or 2.52.0, depending on the release line you run. How to fix ↓
Also tracked for
- pydantic-ai-slim · PyPI
The same CVE-2026-107287 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Pydantic AI is a Python library designed for data validation and settings management using Python type annotations. It provides tools for parsing and validating data structures, making it easier for developers to work with complex data. However, a recent vulnerability has been identified that affects its local web-fetching capabilities, particularly when handling nested HTML content.
Vulnerability Detail
The vulnerability arises from the way Pydantic AI processes nested block elements during HTML-to-Markdown conversion. When an application fetches attacker-controlled HTML, the conversion process can lead to excessive CPU and memory usage due to the reprocessing of accumulated text at each nested level. This can significantly degrade application performance and may lead to denial of service conditions. The issue is exacerbated in current releases where conversion occurs in a worker thread, consuming substantial resources and delaying other operations.
How To Fix
Latest published version: 2.60.0 as of 23 Oct 2026
pip install --upgrade "pydantic-ai==2.60.0"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
>= 1.77.0, < 1.107.71.107.7pip install --upgrade "pydantic-ai==1.107.7" -
>= 2.0.0b1, < 2.52.02.52.0pip install --upgrade "pydantic-ai==2.52.0"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If upgrading is not immediately feasible, avoid using local web fetching for any HTML content that could be controlled by an attacker. This will help mitigate the risk of excessive resource consumption.
Conclusion
In summary, the vulnerability identified as CVE-2026-107287 in Pydantic AI poses a risk of excessive resource consumption when processing nested HTML. Users are advised to upgrade to the latest patched versions or implement workarounds to safeguard their applications.
See every vulnerability recorded for pydantic-ai →
FAQ
The vulnerability involves excessive CPU and memory usage when converting nested HTML content fetched from potentially malicious sources.
You can check if your application is affected by using the Vulert playground at Vulert Scanner, which allows you to monitor and alert for open-source vulnerabilities without requiring any signup.
Failure to address this vulnerability can lead to significant performance degradation and potential denial of service, as the application may become unresponsive due to excessive resource consumption.
Yes, the CVSS score for this vulnerability is 6.5, indicating a moderate severity level.
If an upgrade is not possible, refrain from using local web fetching for any HTML content that may be controlled by an attacker to mitigate risks.
References
Related vulnerabilities
Recent vulnerabilities recorded for pydantic-ai.