CVE-2018-3711: Denial of Service vulnerability with large JSON payloads in fastify

fastify Updated 02 Oct 2025

Summary

18/07/2018
Yes i
High
7.5

CVE-2018-3711: Denial of Service vulnerability with large JSON payloads in fastify. Affects fastify versions < 0.38.0. Fixed in 0.38.0. 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Fastify is an open-source web framework for Node.js that focuses on providing high-performance and low-overhead for web applications. It is known for its speed and efficiency in handling HTTP requests. However, versions of fastify up to 0.37.0 are vulnerable to a Denial of Service (DoS) attack when processing a request with a large JSON payload and the 'Content-Type' header set to 'application/json'. This vulnerability can be exploited to overload the server and cause it to become unresponsive.

Vulnerability Detail

The vulnerability arises due to a lack of proper validation and handling of large JSON payloads. When a request with a large JSON payload is received, fastify attempts to process it, leading to excessive memory consumption and CPU usage. This can result in the server becoming overwhelmed and unable to handle other requests, effectively causing a DoS condition. The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.

How To Fix

Minimum fixed version

0.38.0

This is the first release that contains the fix.

npm install fastify@0.38.0

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

Workaround

If updating fastify is not immediately feasible, a temporary workaround can be implemented by limiting the maximum payload size for JSON requests. This can be achieved by adding a request payload size limit middleware to the application. Here's an example of how to implement this workaround using fastify-rate-limit middleware:

const fastify = require('fastify');
const rateLimit = require('fastify-rate-limit');

const app = fastify();

app.register(rateLimit, {
  max: 1024, // Maximum payload size in bytes
  timeWindow: '1 minute',
  errorResponseBuilder: function (req, context) {
    return { error: 'Payload too large' };
  }
});

// Rest of the application code

app.listen(3000, (err) => {
  if (err) {
    console.error(err);
    process.exit(1);
  }
  console.log('Server is running');
});

Conclusion

In conclusion, fastify versions up to 0.37.0 are vulnerable to a Denial of Service (DoS) attack when processing large JSON payloads. To mitigate this vulnerability, it is crucial to update fastify to version 0.38.0 or later. Alternatively, a temporary workaround can be implemented by limiting the maximum payload size for JSON requests. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for fastify →

Share this vulnerability

FAQ

Fastify is an open-source web framework for Node.js that focuses on providing high-performance and low-overhead for web applications. It is known for its speed and efficiency in handling HTTP requests.

This vulnerability can be exploited to launch a Denial of Service (DoS) attack on a server running fastify. By sending a request with a large JSON payload and the 'Content-Type' header set to 'application/json', an attacker can overload the server's resources and make it unresponsive, causing a disruption in service.

To fix this vulnerability, it is recommended to update fastify to version 0.38.0 or later. This update includes the necessary patches and improvements to handle large JSON payloads more efficiently and prevent the DoS attack.

If updating fastify is not immediately feasible, a temporary workaround can be implemented by limiting the maximum payload size for JSON requests. This can be achieved by adding a request payload size limit middleware to the application.

The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.

Related vulnerabilities

Recent vulnerabilities recorded for fastify.

How To Fix

Minimum fixed version

0.38.0

This is the first release that contains the fix.

npm install fastify@0.38.0

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.