Executive brief
The npm content package is a utility library that parses HTTP headers, particularly the Content-Encoding header. The Content-Encoding HTTP header parser has a vulnerability that causes the application to crash when it receives malformed header values. An attacker can send specially crafted HTTP requests with invalid headers to remotely shut down services that use this package.
Technical details
The vulnerability is a denial of service flaw in the Content-Encoding HTTP header parser of the npm content package. When the parser encounters certain invalid values in the Content-Encoding header, it throws a system-level error rather than an application error. The hapi framework rethrows system errors instead of catching them as expected application errors, allowing the unhandled exception to propagate up the call stack. If the application lacks a global unhandled exception handler, this causes a process crash. The attack requires only network access and a single HTTP request with a malformed Content-Encoding header; no authentication is required. The package has been deprecated and replaced by @hapi/content, which contains the fix.
Affected products
- npm content 0 through 4.0.6 (all previous versions are affected; fixed in 4.1.1)
Timeline
- 2020-09-03: disclosed
- 2020-02-13: patched: Fix released in v4.1.1 and package deprecated in favor of @hapi/content