CVE-2026-140095
## Summary `python-semver/python-semver` is the Python Semantic Versioning library published on PyPI as `semver`. At `src/semver/version.py:95` it defines: ```python _LAST_NUMBER = re.compile(r"(?:[^\d]*(\d+)[^\d]*)+") ``` The pattern is used by `bump_build()` to find and increment the last numeric component of a version string's build metadata. Its outer repeated group `(?:[^\d]*(\d+)[^\d]*)+` contains two unbounded `[^\d]*` quantifiers plus `\d+`, and adjacent repetitions can consume the same run of non-digit characters. When the build metadata is a long alphabetic string with no digits, the engine must try an enormous number of ways to divide that run among the quantifiers before the overall match fails, producing super-quadratic catastrophic backtracking, a CWE-1333 (Inefficient Regular Expression Complexity / ReDoS) condition. The vulnerability is reachable end to end through the public API `semver.Version.parse("1.0.0+" + "a" * N).bump_build()`: the library's `BUILD_IDENTIFIER` rule is `[0-9a-zA-Z-]+`, so an arbitrarily long all-letter build identifier parses successfully and is then passed to the vulnerable search. The untrusted input surface is any version string supplied by an external party: package manifests and dependency constraints, version validation in CI and release pipelines, registry metadata, SBOM imports, update-check services, and multi-tenant version-policy validation. A roughly 32 KB build identifier blocks the parsing process for about 15 seconds, and longer values reach minute scale. Python's regular-expression engine cannot be interrupted by a timeout during that work. The ambiguity inside `_LAST_NUMBER` is structural: the trailing `[^\d]*` of one iteration and the leading `[^\d]*` of the next iteration can consume the same characters, and there is no separator that forces a unique division. With no digit anywhere in the input, the engine keeps generating new candidate partitions for the outer `+`, each of which must then fail at the m
Properties
- Severity
- high
- Summary
- python-semver: Super-quadratic ReDoS in _LAST_NUMBER via attacker-controlled version strings
- Nvd fetched at
- 2026-12-02T06:37:54.190518+00:00
- Epss score
- 0.00585
- Cvss severity
- HIGH
- Cvss score
- 8.7
- Retrieved at
- 2026-12-02T06:40:14+00:00
- Ghsa published
- 2026-12-01T19:08:01Z
- Source url
- https://github.com/advisories/GHSA-3qgw-g8j9-rcg4
- Ghsa updated
- 2026-12-01T19:08:02Z
- Ghsa id
- GHSA-3qgw-g8j9-rcg4
- Last source
- FIRST EPSS
- Score
- 8.7
- Cvss version
- 4.0
- Cve id
- CVE-2026-140095
- Cvss vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- First seen by Signal
- 2026-12-01T02:29:47+00:00
- Name
- CVE-2026-140095
- Is ghsa only
- false
- Vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Related Entities (3)
AFFECTS (1)
HAS_WEAKNESS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph