GHSA-8494-f6mr-cjpv - @hapi/content: quadratic-time parsing of Content-Disposition parameters allows denial of service
### Summary
`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()`:
```js
/([^\=\*\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.
```js
/([^\=\*\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:
```js
const Hapi = require('@hapi/hapi');
const Net = require(
HIGH
Severity & confidence
Source severityhigh
Platform severityhigh
Confidencehigh
Exploitationunknown
CVSS7.5
Affected
Vendors@hapicontent
Products@hapi/contentcontent
Reporting sources (2)
GitHub Security Advisories
NIST NVD - National Vulnerability Database
Timeline & provenance
Published2026-10-30T23:10:13
Last updated2026-11-09T09:35:06
Ingested2026-10-30T23:16:09
FreshnessNEAR-REAL-TIME
Threat typeadvisory
Recommended action
Review the advisory and upgrade affected packages to the first patched version.
Next steps
- Identify affected systems in your environment.
- Apply the vendor patch or mitigation guidance.
- Review logs for indicators described in the advisory.
- Follow the affected vendor/product to track updates.
Confidence explanation
Reported by a government or cert-grade source (CISA, NCSC, NVD, ENISA, MSRC).
Source type: vendor ยท Original: GitHub Security Advisories