CVE-2017-16013: Denial of Service via malformed accept-encoding header in hapi

hapi Updated 02 Oct 2025

Summary

09/10/2018
Yes i
High
7.5

CVE-2017-16013: Denial of Service via malformed accept-encoding header in hapi. Affects hapi versions >= 15.0.0, < 16.1.1. Fixed in 16.1.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The hapi package is an open-source framework for building applications and services in Node.js. It provides a robust set of features for handling HTTP requests, routing, and server-side logic. However, versions of hapi prior to 16.1.1 are vulnerable to a Denial of Service (DoS) attack when a malformed accept-encoding header is received. This vulnerability can lead to crashes or the event loop being locked, impacting the availability of the application.

Vulnerability Detail

The vulnerability arises from a lack of proper input validation in the handling of the accept-encoding header. When a malformed header is encountered, it triggers a crash or locks the event loop, causing the application to become unresponsive. An attacker can exploit this vulnerability by sending specially crafted requests with malformed accept-encoding headers, leading to a DoS condition. The impact of this vulnerability can range from temporary service disruption to a complete application outage.

How To Fix

Latest published version: 18.1.0 as of 22 Oct 2026

npm install hapi@18.1.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

16.1.1

This is the first release that contains the fix.

npm install hapi@16.1.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version of hapi is not immediately feasible, a temporary workaround can be implemented by adding input validation for the accept-encoding header. This can be done by inspecting the header value and ensuring it conforms to the expected format before further processing. Here is an example of how this can be achieved in Node.js:

const Hapi = require('hapi');

const server = new Hapi.Server();

server.connection({
  port: 3000,
  routes: {
    validate: {
      headers: {
        'accept-encoding': Joi.string().regex(/^gzip, deflate, br$/)
      }
    }
  }
});

// Rest of the server setup and route handling

Conclusion

In conclusion, the hapi package prior to version 16.1.1 is vulnerable to a Denial of Service attack when a malformed accept-encoding header is received. To mitigate this vulnerability, it is crucial to update the package to the latest version or implement the provided workaround. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for hapi →

Share this vulnerability

FAQ

hapi is an open-source framework for building applications and services in Node.js. It provides a rich set of features for handling HTTP requests, routing, and server-side logic.

A Denial of Service attack is a malicious attempt to disrupt the normal functioning of a system or network, making it unavailable to its intended users.

An attacker can exploit this vulnerability by sending specially crafted requests with malformed accept-encoding headers, causing the application to crash or become unresponsive.

The impact of this vulnerability can range from temporary service disruption to a complete application outage, depending on the severity of the DoS condition triggered.

To fix this vulnerability, update the hapi package to version 16.1.1 or later by running the command: npm install hapi@16.1.1

Related vulnerabilities

Recent vulnerabilities recorded for hapi.

How To Fix

Latest published version: 18.1.0 as of 22 Oct 2026

npm install hapi@18.1.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

16.1.1

This is the first release that contains the fix.

npm install hapi@16.1.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.