Skip to content
GitHub Security Advisories·Indexed by this site · Originally published· Event →SelectedAttention36

Pydantic AI fixes event loop blocking vulnerability caused by quadratic complexity title extraction in web_fetch

Pydantic AI: Event loop blocked by quadratic title extraction in `web_fetch`

AI summary

Pydantic AI's local web scraping tool web_fetch_tool (also the local fallback of the WebFetch capability) has a quadratic-complexity step in response processing and runs on the event loop; applications exposed to untrusted prompts can be guided to fetch attacker-controlled pages, blocking the event loop for minutes and stalling other coroutines in the process. Title extraction uses a backtracking regex on the raw response body, and repeated unclosed tag prefixes make time grow quadratically with size; HTML-to-markdown whitespace normalization, preformatted block stripping, and ordered list numbering have the same issue. HTML-to-markdown recurses once per nesting level, and hundreds of nested levels trigger a RecursionError that aborts execution; deeply nested responses have the same issue. This issue affects availability only; the SSRF protections and download size limits introduced by GHSA-v2xh-2vp8-57h8 are unaffected. The issue was privately reported by @BrianWillows; other issues were found during the fix process.

Why it was selected

Disclosed a secondary complexity processing issue in Pydantic AI's local web scraping tool triggered by server-controllable input, along with the corresponding fix.

Read originalgithub.com