7.5high
Pydantic AI: Concurrency-limited models can keep their slot when a streamed request ends early
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.45% (higher than 40% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-6fqq-452j-qhrpPYSEC-2026-4276PYSEC-2026-4285
Description
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 2.10.0 until 2.53.0, streamed requests made through ConcurrencyLimitedModel or limit_model_concurrency can retain shared concurrency slots because anyio.CapacityLimiter associates an acquired slot with the borrowing task while streaming cleanup can run in a different task. Early stream termination, cancellation, consumer exceptions, or complete stream_text() consumption with debounce_by=0.1 can therefore leave capacity occupied, eventually preventing later requests that share the long-lived limiter from proceeding and causing a denial of service. Agent-level max_concurrency and non-streaming model requests are not affected. This issue is fixed in version 2.53.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| pydantic pydantic-ai | >= 2.10.0, < 2.53.0 | CVE List |
| pydantic pydantic-ai-slim | >= 2.10.0, < 2.53.0 | CVE List |
| pydantic-ai (PyPI) | from 2.10.0 before 2.53.0 | GitHub Advisory Database, PyPA Advisory Database |
| pydantic-ai-slim (PyPI) | from 2.10.0 before 2.53.0 | GitHub Advisory Database, PyPA Advisory Database |
| pydantic pydantic_ai | from 2.10.0 before 2.53.0 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| PyPA Advisory Database | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 2.10.0 until 2.53.0, streamed requests made through ConcurrencyLimitedModel or limit_model_concurrency can retain shared concurrency slots because anyio.CapacityLimiter associates an acquired slot with the borrowing task while streaming cleanup can run in a different task. Early stream termination, cancellation, consumer exceptions, or complete stream_text() consumption with debounce_by=0.1 can therefore leave capacity occupied, eventually preventing later requests that share the long-lived limiter from proceeding and causing a denial of service. Agent-level max_concurrency and non-streaming model requests are not affected. This issue is fixed in version 2.53.0.
GitHub Advisory Database
This issue was posted by Codex Desktop using gpt-6.1-sol on behalf of David.
Summary
Applications that wrap a model with ConcurrencyLimitedModel or limit_model_concurrency can permanently lose shared concurrency capacity when a streamed request releases its slot from a different task than the one that acquired it. This can happen when a stream ends early, and also when a stream is fully consumed using the default stream_text() debouncing.
In an application that exposes an affected streaming endpoint to network clients and shares a long-lived model limiter across requests, a client can repeatedly start a stream and disconnect. The completed requests retain their slots, eventually preventing subsequent requests that share the limiter from proceeding.
Agent-level max_concurrency and non-streaming model requests are not affected by this defect.
Details
The built-in limiter uses anyio.CapacityLimiter, which associates each acquired slot with its borrowing task. Pydantic AI's streaming lifecycle can acquire the slot on the task consuming the stream and run cleanup on another internal task. The limiter rejects that release, so the slot remains occupied even after the request has ended. Cleanup can raise a RuntimeError; a later request on the borrowing task can also fail because that task still holds a slot.
Early termination includes stopping iteration, a consumer exception, and cancellation. Fully consuming stream_text() with its default debounce_by=0.1 can also reach the cross-task release path. Fully consumed streams must therefore not be assumed safe.
Mitigation
Upgrade to a patched release of pydantic-ai or pydantic-ai-slim. If you cannot upgrade yet, use the agent-level max_concurrency setting instead of a concurrency-limited model, or avoid streaming runs through a concurrency-limited model.
References
| https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-6fqq-452j-qhrp | mitigation, vendor-advisory, web | |
| https://github.com/pydantic/pydantic-ai/pull/9478 | patch, vendor-advisory, web | |
| https://github.com/pydantic/pydantic-ai/commit/453f19feeb7ab1d789f9393b1723c6a73b3d77b2 | patch, web | |
| https://github.com/pydantic/pydantic-ai/releases/tag/v2.53.0 | patch, release-notes, vendor-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-107286 | advisory | |
| https://github.com/pydantic/pydantic-ai | package | |
| https://pypi.org/project/pydantic-ai | package | |
| https://github.com/advisories/GHSA-6fqq-452j-qhrp | advisory | |
| https://pypi.org/project/pydantic-ai-slim | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-107286 changed 2026-10-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-6fqq-452j-qhrp changed 2026-10-15 | CC-BY-4.0 |
| NVD | CVE-2026-107286 changed 2026-10-13 | Public domain |
| PyPA Advisory Database | PYSEC-2026-4276 changed 2026-10-15 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2026-4285 changed 2026-10-15 | CC-BY-4.0 |