CVE-2026-107287: Pydantic AI Excessive Resource Use 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 a powerful local web-fetching tool that allows applications to retrieve and process web content. However, this functionality can lead to excessive resource consumption when handling attacker-controlled HTML, particularly when nested block elements are involved.
Vulnerability Detail
The vulnerability arises from the way Pydantic AI processes nested HTML during conversion to Markdown. When an agent fetches a page with nested HTML elements, the conversion process can result in significant CPU and memory usage due to the reprocessing of accumulated text at each level. This can lead to performance degradation and delays in other tasks. The issue is exacerbated in current releases where conversion occurs in a worker thread, consuming substantial resources, while older versions performed this conversion on the event loop.
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 possible, avoid using local web fetching for any HTML content that may be controlled by an attacker. This can help mitigate the risk of excessive resource consumption.
Conclusion
In summary, the vulnerability CVE-2026-107287 in Pydantic AI can lead to excessive resource consumption when processing nested HTML. It is crucial to upgrade to the patched versions or implement workarounds to mitigate the risk. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for pydantic-ai →
FAQ
The CVSS score of this vulnerability is 6.5, indicating a moderate level of risk.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Failure to address this vulnerability can lead to excessive CPU and memory usage, potentially causing application slowdowns and impacting overall performance.
Yes, versions 1.107.7 and 2.52.0 or later are patched and safe to use.
If you cannot upgrade, it is recommended to avoid using local web fetching for HTML content that may be controlled by an attacker.
References
Related vulnerabilities
Recent vulnerabilities recorded for pydantic-ai.