CVE-2026-107290: Pydantic AI Event Loop Blocked By Quadratic Vulnerability

MODERATE
Advisory Identifier: GHSA-fpf4-vwcp-v4hp
CVSS 6.5
CWE-1333 CWE-407
Published
Advisory Summary

CVE-2026-107290 is a MODERATE (CVSS 6.5) event loop blocked by quadratic vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Pydantic AI libraries in the PyPI ecosystem. The issue involves event loop blocked by quadratic title extraction in `web_fetch`. Remediation is available by upgrading affected packages to version 1.107.6, 2.44.0.

CVE-2026-107290 at a Glance

CVE Identifier CVE-2026-107290
GHSA Identifier GHSA-fpf4-vwcp-v4hp
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Pydantic AI
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-107290

To remediate this vulnerability, upgrade all affected Pydantic AI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pydantic-ai fixed: 1.107.6
pip install pydantic-ai>=1.107.6
pydantic-ai fixed: 2.44.0
pip install pydantic-ai>=2.44.0
pydantic-ai-slim fixed: 1.107.6
pip install pydantic-ai-slim>=1.107.6
pydantic-ai-slim fixed: 2.44.0
pip install pydantic-ai-slim>=2.44.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show pydantic-ai

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-107290, inspect your installed packages using pip:

pip show pydantic-ai

Analyze the terminal output to locate any version of Pydantic AI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.107.6), your application is affected.

Note: The pip show pydantic-ai command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Pydantic AI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The local web-fetch tool (`web_fetch_tool`, also used as the `WebFetch` capability's local fallback) processed responses with several steps whose running time grows quadratically with the size of certain server-controlled inputs, and ran them on the event loop: decoding the body with whichever charset the server declared, extracting the page title with a backtracking regular expression, and converting the HTML to markdown. An application that exposes this tool to untrusted prompts can be steered to fetch an attacker-controlled page of a megabyte or two that blocks the event loop for minutes, stalling every other coroutine in the process — other agent runs, other requests being served — for the duration. This is an **availability** issue only. SSRF protections and the download size limit introduced in GHSA-v2xh-2vp8-57h8 are unaffected; that limit bounds how much is downloaded, not how long the response takes to process. ### Details Title extraction used a backtracking pattern over the raw response body, so a body made of repeated unterminated tag openings cost time proportional to the square of its size. The HTML-to-markdown conversion had the same shape in three of its steps: normalizing whitespace, stripping preformatted blocks, and numbering ordered lists all took time proportional to the square of a run of spaces or a list's length. All of it ran on the event loop, and the regex steps hold the interpreter lock even when moved off it, so the whole process paid for the size of a server-controlled response. The response body was also decoded on the event loop with the codec named by the `charset` parameter of the response's `Content-Type`, looked up in Python's codec registry. That registry includes `punycode`, whose decoder takes time proportional to the square of its input: a response of about one megabyte labelled `charset=punycode` blocked the event loop for roughly half a minute, with no HTML required. The registry also includes codecs that aren't text encodings at all, such as `rot_13` and `base64_codec`; a response labelled with one of those raised an unexpected exception out of the tool, aborting the agent run that fetched it. Separately, the HTML-to-markdown conversion recursed once per nested element, so a page nested a few hundred elements deep raised a `RecursionError` out of the tool, aborting the agent run that fetched it. A JSON response nested deeper than the interpreter allows did the same. These only affect that one run. ### Who Is Affected You are affected if your application registers the local web-fetch tool (or relies on the `WebFetch` capability's local fallback) and exposes the agent to untrusted prompts. `allowed_domains` narrows the exposure to pages on those domains but does not remove it. Applications that only fetch developer-controlled URLs are not exposed to the model-chosen attack path. ### Remediation Upgrade to a patched version. The title is now found with a single linear scan, the conversion steps above run in linear time, and decoding, title extraction and conversion all run in a worker thread. A charset naming a codec that isn't a text encoding, and a page too deeply nested to convert, are reported back to the model as a failed fetch instead of aborting the run; a JSON body too deeply nested to parse is returned as plain text. ### Credits Reported privately by @BrianWillows, whose report covered the quadratic title extraction. The response decoding, the codecs that are not text encodings, and the quadratic steps in the HTML-to-markdown conversion were found while fixing it.

CVE-2026-107290 Affected Pydantic AI Versions

4 component(s)
Fixed Versions:
1.107.62.44.0
Product / Package Ecosystem Affected Versions Fixed Version
pydantic-ai
PyPI
≥ 1.77.0
< 1.107.6
1.107.6
pydantic-ai
PyPI
≥ 2.0.0b1
< 2.44.0
2.44.0
pydantic-ai-slim
PyPI
≥ 1.77.0
< 1.107.6
1.107.6
pydantic-ai-slim
PyPI
≥ 2.0.0b1
< 2.44.0
2.44.0

References

Frequently Asked Questions

What is CVE-2026-107290?
CVE-2026-107290 is a security vulnerability in Pydantic AI involving Event loop blocked by quadratic title extraction in `web_fetch` under CWE-1333: Inefficient Regular Expression Complexity.
Which Pydantic AI versions are affected?
Affected versions include releases prior to 1.107.6, 2.44.0 across affected packages: pydantic-ai, pydantic-ai-slim.
What version fixes CVE-2026-107290?
Upgrading to 1.107.6, 2.44.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pydantic-ai affected?
Yes, pydantic-ai is affected in releases prior to 1.107.6, 2.44.0. Upgrade your dependency to 1.107.6, 2.44.0 or later.
Is pydantic-ai-slim affected?
Yes, pydantic-ai-slim is affected in releases prior to 1.107.6, 2.44.0. Upgrade your dependency to 1.107.6, 2.44.0 or later.
What is the CVSS score of CVE-2026-107290?
CVE-2026-107290 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-107290?
CVE-2026-107290 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check PyPI dependencies for CVE-2026-107290?
Run the dependency tree command: 'pip show pydantic-ai'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fpf4-vwcp-v4hp",
  "modified" : "2026-10-08T16:48:26Z",
  "published" : "2026-10-08T16:48:25Z",
  "aliases" : [ "CVE-2026-107290" ],
  "summary" : "Pydantic AI: Event loop blocked by quadratic title extraction in `web_fetch`",
  "details" : "### Summary\n\nThe local web-fetch tool (`web_fetch_tool`, also used as the `WebFetch` capability's local fallback) processed responses with several steps whose running time grows quadratically with the size of certain server-controlled inputs, and ran them on the event loop: decoding the body with whichever charset the server declared, extracting the page title with a backtracking regular expression, and converting the HTML to markdown. An application that exposes this tool to untrusted prompts can be steered to fetch an attacker-controlled page of a megabyte or two that blocks the event loop for minutes, stalling every other coroutine in the process — other agent runs, other requests being served — for the duration.\n\nThis is an **availability** issue only. SSRF protections and the download size limit introduced in GHSA-v2xh-2vp8-57h8 are unaffected; that limit bounds how much is downloaded, not how long the response takes to process.\n\n### Details\n\nTitle extraction used a backtracking pattern over the raw response body, so a body made of repeated unterminated tag openings cost time proportional to the square of its size. The HTML-to-markdown conversion had the same shape in three of its steps: normalizing whitespace, stripping preformatted blocks, and numbering ordered lists all took time proportional to the square of a run of spaces or a list's length. All of it ran on the event loop, and the regex steps hold the interpreter lock even when moved off it, so the whole process paid for the size of a server-controlled response.\n\nThe response body was also decoded on the event loop with the codec named by the `charset` parameter of the response's `Content-Type`, looked up in Python's codec registry. That registry includes `punycode`, whose decoder takes time proportional to the square of its input: a response of about one megabyte labelled `charset=punycode` blocked the event loop for roughly half a minute, with no HTML required. The registry also includes codecs that aren't text encodings at all, such as `rot_13` and `base64_codec`; a response labelled with one of those raised an unexpected exception out of the tool, aborting the agent run that fetched it.\n\nSeparately, the HTML-to-markdown conversion recursed once per nested element, so a page nested a few hundred elements deep raised a `RecursionError` out of the tool, aborting the agent run that fetched it. A JSON response nested deeper than the interpreter allows did the same. These only affect that one run.\n\n### Who Is Affected\n\nYou are affected if your application registers the local web-fetch tool (or relies on the `WebFetch` capability's local fallback) and exposes the agent to untrusted prompts. `allowed_domains` narrows the exposure to pages on those domains but does not remove it. Applications that only fetch developer-controlled URLs are not exposed to the model-chosen attack path.\n\n### Remediation\n\nUpgrade to a patched version. The title is now found with a single linear scan, the conversion steps above run in linear time, and decoding, title extraction and conversion all run in a worker thread. A charset naming a codec that isn't a text encoding, and a page too deeply nested to convert, are reported back to the model as a failed fetch instead of aborting the run; a JSON body too deeply nested to parse is returned as plain text.\n\n### Credits\n\nReported privately by @BrianWillows, whose report covered the quadratic title extraction. The response decoding, the codecs that are not text encodings, and the quadratic steps in the HTML-to-markdown conversion were found while fixing it.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydantic-ai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.77.0"
      }, {
        "fixed" : "1.107.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydantic-ai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0b1"
      }, {
        "fixed" : "2.44.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydantic-ai-slim"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.77.0"
      }, {
        "fixed" : "1.107.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydantic-ai-slim"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0b1"
      }, {
        "fixed" : "2.44.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-fpf4-vwcp-v4hp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/pull/8397"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/pull/8399"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/pull/8418"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/pull/8433"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/pull/8434"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/commit/2faa6181d8a17d83bc9516d035c5270db8730fa0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/commit/9cdc952e4c3319e85a3e04f2de49fbbb765bd38b"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/commit/a93ea5226be1e93ae13131ae3f22287190411389"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/commit/c3fd1cc1f15fdbf750d78e4e3ec1e8b4d6a3d920"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/commit/fb92ccfc3ca2735dab877e2ed73856681bf72ad1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pydantic/pydantic-ai"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/releases/tag/v1.107.6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydantic/pydantic-ai/releases/tag/v2.44.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-407" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-08T16:48:25Z",
    "nvd_published_at" : null
  }
}