CVE-2026-18504: Fastify Fastify Vulnerable To Schema Validation Vulnerability
MODERATECVE-2026-18504 is a MODERATE (CVSS 5.4) fastify vulnerable to schema validation vulnerability (CWE-20: Improper Input Validation) affecting Fastify libraries in the npm ecosystem. The issue involves fastify vulnerable to schema validation bypass via root primitive coercion mismatch. Remediation is available by upgrading affected packages to version 5.12.1.
CVE-2026-18504 at a Glance
Security Impact
CVSS: 5.4
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:L/I:L/A:N).
How to Fix CVE-2026-18504
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.
npm install fastify@5.12.1
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-18504, 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.1), 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
CVE-2026-18504 Affected Fastify Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
fastify
|
npm |
< 5.12.1
|
5.12.1
|
References
Frequently Asked Questions
What is CVE-2026-18504?
Which Fastify versions are affected?
What version fixes CVE-2026-18504?
Is fastify affected?
What is the CVSS score of CVE-2026-18504?
What CWE is associated with CVE-2026-18504?
How can I check npm dependencies for CVE-2026-18504?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w2qp-rph6-63g4",
"modified" : "2026-09-02T15:13:23Z",
"published" : "2026-09-02T15:13:23Z",
"aliases" : [ "CVE-2026-18504" ],
"summary" : "fastify vulnerable to schema validation bypass via root primitive coercion mismatch",
"details" : "### Impact\n\n`fastify` before 5.12.1, when a route uses a root-level primitive body schema (for example an integer with a minimum and maximum) and the default type coercion, validates the coerced value but exposes the original, uncoerced value to the route handler. For example, a JSON body `\"10\"` is coerced to the number `10` and passes an integer 1 to 10 schema, but `request.body` stays the string `\"10\"`. An application that trusts the validated type is handed a value that did not satisfy the schema, which can bypass limits the application enforces on that typed value. Object and array body schemas are not affected, they coerce their members in place.\n\n### Patches\n\nUpgrade to `fastify` 5.12.1.\n\n### Workarounds\n\nUntil you can upgrade, avoid relying on the validated type of a root primitive body. Wrap the value in an object schema (object properties are coerced in place), for example accept `{ \"value\": 10 }` and read `request.body.value`, or re-check the type in the handler.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "fastify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.12.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify/security/advisories/GHSA-w2qp-rph6-63g4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-18504"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify/commit/1ef8a60c87e94f42f666aa15ad68957772a83655"
}, {
"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.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-02T15:13:23Z",
"nvd_published_at" : "2026-08-18T21:16:34Z"
}
}