Pydantic AI: Excessive resource use when local web fetching converts nested HTMLGHSA-v36g-jcw9-x7cw
MEDIUMFix: pydantic/pydantic-ai#8984GHSA-v36g-jcw9-x7cw is a medium-severity (CVSS 6.5) Uncontrolled Resource Consumption vulnerability in pydantic-ai. A fix is available for pydantic-ai — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-v36g-jcw9-x7cw.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-v36g-jcw9-x7cw by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
pydantic-ai🐍pydantic-ai🐍pydantic-ai-slim🐍pydantic-ai-slimReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
Applications using Pydantic AI's local web-fetch tool can experience excessive CPU and memory use when it converts attacker-controlled HTML. An agent must fetch the affected page; provider-native web fetching is not affected.
Details
Nested block elements cause HTML-to-Markdown conversion to reprocess accumulated text at each level and can greatly expand the intermediate output. The response-body limit bounds downloaded bytes, while the returned-content limit is applied only after conversion. On current releases, conversion runs in a worker thread but can still consume substantial resources and delay other work in the process. Older releases performed conversion on the event loop.
Mitigation
Upgrade to a patched release of pydantic-ai or pydantic-ai-slim. If you cannot upgrade yet, avoid using local web fetching for attacker-controlled HTML.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | pydantic-ai | ≥ 1.77.0&&< 1.107.7 | 1.107.7pip install --upgrade 'pydantic-ai==1.107.7' |
| 🐍PyPI | pydantic-ai | ≥ 2.0.0b1&&< 2.52.0 | 2.52.0pip install --upgrade 'pydantic-ai==2.52.0' |
| 🐍PyPI | pydantic-ai-slim | ≥ 1.77.0&&< 1.107.7 | 1.107.7pip install --upgrade 'pydantic-ai-slim==1.107.7' |
| 🐍PyPI | pydantic-ai-slim | ≥ 2.0.0b1&&< 2.52.0 | 2.52.0pip install --upgrade 'pydantic-ai-slim==2.52.0' |
Affected Products
pydantic aipydanticDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for pydantic-ai, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update pydantic-ai to 1.107.7 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-v36g-jcw9-x7cw is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Red Hat has rated this flaw as MODERATE severity. The pydantic-ai package, as shipped in Red Hat Enterprise Linux AI and Lightspeed Core container images, is affected by a denial-of-service flaw in its local web fetching. When the local web_fetch_tool or the WebFetch local fallback processes attacker-controlled HTML…
A workaround is available: configure agents to use provider-native web fetching, which is not affected by this issue, instead of the local web_fetch_tool or the WebFetch local fallback. Disabling or restricting the local web fetch tool so it cannot be used for model-directed fetches of untrusted URLs also reduces exposure. Upstream has fixed this issue in pydantic-ai 1.107.7 and 2.52.0; however, the fix for the Red Hat delivered products is currently deferred.Source: Red Hat security advisory for GHSA-v36g-jcw9-x7cw (CC BY 4.0)
Frequently Asked Questions
Is GHSA-v36g-jcw9-x7cw in your dependencies?
Find it across PyPI, including transitive dependencies.