CVE-2026-18504: fastify vulnerable to schema validation bypass via root primitive coercion mismatch
Impact 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".
Published Sep 2, 2026
Affected packages
fastify
- Ecosystem
- npm
- Affected
- < 5.12.1
- Fixed in
- 5.12.1
- Check
npm ls fastify
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
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.
Patches
Upgrade to fastify 5.12.1.
Workarounds
Until 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.
Credited to velgusgus599, mcollina, UlisesGascon.
References
- https://github.com/fastify/fastify/security/advisories/GHSA-w2qp-rph6-63g4
- https://nvd.nist.gov/vuln/detail/CVE-2026-18504
- https://github.com/fastify/fastify/commit/1ef8a60c87e94f42f666aa15ad68957772a83655
- https://cna.openjsf.org/security-advisories.html
- https://github.com/fastify/fastify/releases/tag/v5.12.1
- https://github.com/advisories/GHSA-w2qp-rph6-63g4
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More npm vulnerabilities
All npm entriesCVE-2026-107832
fastify is vulnerable to header validation bypass via case-sensitive propertyNames
low3.7Oct 22, 2026CVE-2026-76169
fastify vulnerable to authentication bypass via malformed URLs reaching encapsulated not-found handlers
high7.5Sep 30, 2026CVE-2026-84428
fastify vulnerable to header validation bypass via incomplete schema case normalization
high7.5Sep 30, 2026CVE-2026-84469
fastify vulnerable to request validation bypass via skipped boolean false schemas
high7.5Sep 30, 2026CVE-2026-84504
fastify vulnerable to request body replacement via an async validation result collision
high8.1Sep 30, 2026CVE-2026-92081
fastify vulnerable to Denial of Service via unhandled exception on HTTP/2 trailer responses
medium5.9Sep 30, 2026
