Packages / fastify / Security

ModerateVulnerabilityGHSA-w2qp-rph6-63g4CVE-2026-18504Published 2 Sep 2026

fastify vulnerable to schema validation bypass via root primitive coercion mismatch

Affected releases · fastify

  • 5.x5.0.0 – 5.12.0Fixed in 5.12.1
  • 4.x and older0.0.1 – 4.29.1No fix, no longer updated

On 5.x, the newest line:

npm install fastify@5.12.1
5.x
  1. Affected

    5.0.0 – 5.12.0

    32 releases

  2. Fixed

    5.12.1 – 5.12.7

    7 releases, latest

4.x
  1. Affected

    4.0.0 – 4.29.1

    61 releases

3.x
  1. Affected

    3.0.0 – 3.29.5

    71 releases

2.x
  1. Affected

    2.0.0 – 2.15.3

    25 releases

1.x
  1. Affected

    1.0.0 – 1.14.6

    31 releases

0.x
  1. Affected

    0.0.1 – 0.43.0

    73 releases

300 stable releases of fastify, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for fastify. It is read in your browser and sent nowhere.

What happens

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.