decode-uri-component: Denial of service via quadratic replacement of percent-encoded runs
Impact
decodeUriComponent() takes quadratic time on malformed input that has many distinct percent-encoded runs. A single unauthenticated request of about 224 KB can block the Node.js event loop for about 20 seconds. Version 0.5.0, the release that fixed CVE-2026-45822, is affected.
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 0.5.1Semantic versions | 0.5.1 |
Version evidence: OSV · GHSA-qr28-fpjm-wq7f
View original version evidence (0 explicit versions)
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
SamVerschueren · GitHub_M
decode-uri-component
1 range
SamVerschueren · GitHub_M
decode-uri-component
Compare with this publisher’s ranges. This does not inspect your installation.
affected
< 0.5.1
Other versions: unknown
Original source description
Summary
decodeUriComponent() takes quadratic time on malformed input that has many distinct percent-encoded runs. A single unauthenticated request of about 224 KB can block the Node.js event loop for about 20 seconds. Version 0.5.0, the release that fixed CVE-2026-45822, is affected.
Details
When native decodeURIComponent throws, decodeUriComponent() falls back to customDecodeURIComponent (index.js:122). That function:
- Scans the input for every run of percent-encoded bytes (e.g.
%C3%A5) and stores each distinct run, with its decoded value, in a lookup table (index.js:130-144). - Runs one full-string
input.replace(new RegExp(key, 'g'), …)per table entry (index.js:154).
With K distinct runs in an input of length L, that's K regex compilations and K full scans of the string, so O(K·L). An attacker controls both K and L, and K grows with L. One malformed sequence such as a trailing %zz is enough to force the fallback path.
The 0.5.0 fix for CVE-2026-45822 (fa479da) replaced the recursive decode() routine with a linear scanner, but left this replacement loop unchanged.
Proof of concept
Running the following code takes ~20 seconds.
import decodeUriComponent from 'decode-uri-component';
let payload = '';
for (let i = 0; i < 32000; i++) {
const high = Math.floor(i / 256).toString(16).padStart(2, '0');
const low = (i % 256).toString(16).padStart(2, '0');
payload += `%${high}%${low}x`; // distinct run each iteration
}
payload += '%zz'; // forces the fallback decoder
console.time('decode');
decodeUriComponent(payload); // ~224 KB
console.timeEnd('decode');
Impact
This is an availability issue only and there's no confidentiality or integrity impact. Any application that passes untrusted input to decodeUriComponent(), directly or through a dependency such as query-string, can be made unresponsive. Because Node.js runs on one thread, one request stalls every other client.
The worst case needs input well beyond URL length limits. Node's default 16 KB header limit keeps payloads passed in via a URL query string to roughly 40 ms per request. Applications that decode request bodies are fully exposed, for example form bodies parsed with query-string.parse().
Inside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-118664View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Contributing organizations · 2
Assigning organization
Additional data publisher
What changed
Follow changes- CVE · CVE-2026-118664
Observed 2026-10-29T17:51:47.507Z · upstream updated 2026-10-29T17:23:10.863Z
Prioritization updated
before
[]
after
[ { "source": "CISA-ADP", "type": "SSVC", "role": "CISA Coordinator", "timestamp": "2026-10-29T15:29:24.494465Z", "decisions": [ { "name": "Exploitation", "value": "none" }, { "name": "Automatable", "value": "no" }, { "name": "Technical Impact", "value": "partial" } ] } ]
Large field values are marked as truncated previews. Original source snapshots remain retained.
Showing up to 50 most recent observed changes.