CVE-2026-84504: Fastify Fastify Vulnerable To Request Body Vulnerability

HIGH
Advisory Identifier: GHSA-667r-xxjv-c9mm
CVSS 8.1
CWE-20
Published
Advisory Summary

CVE-2026-84504 is a HIGH (CVSS 8.1) fastify vulnerable to request body vulnerability (CWE-20: Improper Input Validation) affecting Fastify libraries in the npm ecosystem. The issue involves fastify vulnerable to request body replacement via an async validation result collision. Remediation is available by upgrading affected packages to version 5.12.2.

CVE-2026-84504 at a Glance

CVE Identifier CVE-2026-84504
GHSA Identifier GHSA-667r-xxjv-c9mm
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-20: Improper Input Validation
Affected Product Fastify
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-84504

To remediate this vulnerability, upgrade all affected Fastify dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

fastify fixed: 5.12.2
npm install fastify@5.12.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls fastify

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-84504, inspect your project dependencies using npm:

npm ls fastify

Analyze the terminal output to locate any version of Fastify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.12.2), your application is affected.

Note: The npm ls fastify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Fastify, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Fastify runs a route's validator and, for a result shaped like `{ value, error }`, unwraps it: an `error` becomes a validation failure and `value` replaces the request part. This convention is intended for synchronous custom compilers (for example Joi). A JSON Schema `$async` validator, however, resolves with the validated data itself, so Fastify applied the same unwrapping to it. If a request part validated by an `$async` schema contains a `value` property, Fastify replaced the whole request part with that nested value before the handler ran, so a `value` or `error` property in the payload was attacker-controlled. An application that dispatches operations from the validated request body could then act on data that never satisfied the route schema, leading to unauthorized state changes or disclosure. Reaching the vulnerable path requires the route to use an `$async` request schema. ### Patches Fastify no longer treats an asynchronous validation result as a `{ value, error }` wrapper: an async validator's resolved value is used only to determine pass or fail, and it can no longer replace the request part or inject an error. The synchronous custom-compiler contract is unchanged. Patched in fastify `5.12.2` and `6.0.0`. ### Workarounds If upgrading is not immediately possible, avoid `$async` request schemas, or perform the security-sensitive check in an `onRequest` or `preHandler` hook rather than relying on the schema-validated request part. Custom async validator compilers should signal failure by throwing (rejecting) rather than returning an `{ error }` object.

CVE-2026-84504 Affected Fastify Versions

1 component(s)
Fixed Versions:
5.12.2
Product / Package Ecosystem Affected Versions Fixed Version
fastify
npm
< 5.12.2
5.12.2

References

Frequently Asked Questions

What is CVE-2026-84504?
CVE-2026-84504 is a security vulnerability in Fastify involving fastify vulnerable to request body replacement via an async validation result collision under CWE-20: Improper Input Validation.
Which Fastify versions are affected?
Affected versions include releases prior to 5.12.2 across affected packages: fastify.
What version fixes CVE-2026-84504?
Upgrading to 5.12.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fastify affected?
Yes, fastify is affected in releases prior to 5.12.2. Upgrade your dependency to 5.12.2 or later.
What is the CVSS score of CVE-2026-84504?
CVE-2026-84504 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-84504?
CVE-2026-84504 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2026-84504?
Run the dependency tree command: 'npm ls fastify'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-667r-xxjv-c9mm",
  "modified" : "2026-09-30T23:45:45Z",
  "published" : "2026-09-30T23:45:45Z",
  "aliases" : [ "CVE-2026-84504" ],
  "summary" : "fastify vulnerable to request body replacement via an async validation result collision",
  "details" : "### Impact\n\nFastify runs a route's validator and, for a result shaped like `{ value, error }`, unwraps it: an `error` becomes a validation failure and `value` replaces the request part. This convention is intended for synchronous custom compilers (for example Joi). A JSON Schema `$async` validator, however, resolves with the validated data itself, so Fastify applied the same unwrapping to it. If a request part validated by an `$async` schema contains a `value` property, Fastify replaced the whole request part with that nested value before the handler ran, so a `value` or `error` property in the payload was attacker-controlled. An application that dispatches operations from the validated request body could then act on data that never satisfied the route schema, leading to unauthorized state changes or disclosure. Reaching the vulnerable path requires the route to use an `$async` request schema.\n\n### Patches\n\nFastify no longer treats an asynchronous validation result as a `{ value, error }` wrapper: an async validator's resolved value is used only to determine pass or fail, and it can no longer replace the request part or inject an error. The synchronous custom-compiler contract is unchanged. Patched in fastify `5.12.2` and `6.0.0`.\n\n### Workarounds\n\nIf upgrading is not immediately possible, avoid `$async` request schemas, or perform the security-sensitive check in an `onRequest` or `preHandler` hook rather than relying on the schema-validated request part. Custom async validator compilers should signal failure by throwing (rejecting) rather than returning an `{ error }` object.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fastify"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.12.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify/security/advisories/GHSA-667r-xxjv-c9mm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-84504"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify/commit/f02d8d4ab1ab208f10819c4dc213595b06497833"
  }, {
    "type" : "WEB",
    "url" : "https://cna.openjsf.org/security-advisories.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fastify/fastify"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify/releases/tag/v5.12.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-30T23:45:45Z",
    "nvd_published_at" : "2026-09-04T10:17:13Z"
  }
}