CVE-2026-18504: fastify vulnerable to schema validation bypass via root primitive coercion mismatch

Published Aug 18, 2026
·
Updated

fastify is a fast and low overhead web framework for Node.js. Versions of fastify before 5.12.1 are affected by a schema validation bypass when a request body schema targets a root primitive value. When the schema validates a top-level primitive such as an integer, Ajv can coerce a JSON string into the expected type during validation, but Fastify does not replace the root request body with the coerced value, so the route handler receives the original unvalidated string. As a result, a request that should have failed validation can reach application logic with a value that does not satisfy the schema, which can undermine integrity and access-control checks that rely on the validated type. Users should upgrade to fastify 5.12.1, which fixes the mismatch. No known workarounds are available.

Affected Software

1 affected component
npm/fastify<5.12.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade fastify to a version that resolves this vulnerability.

    Fixed in 5.12.1

Event History

Aug 18, 2026
CVE Published
via MITRE·08:19 PM
Data Sourced
via MITRE·08:19 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which routes are most relevant to triage?

Applications using Fastify versions before 5.12.1 are exposed when a route validates its request body as a top-level primitive, such as an integer. Routes whose security or integrity decisions rely on the body having the validated primitive type are the relevant attack surface.

2

What does an attacker need to exploit this issue?

An attacker needs network access to a vulnerable route and the ability to send a JSON string where the route expects a root primitive value. The request can pass validation after Ajv coercion, while the handler receives the original string instead of the coerced primitive.

3

What remediation is available?

Upgrade Fastify to version 5.12.1. The advisory states that no known workarounds are available if upgrading cannot be done immediately.

4

How can we identify potentially affected application code?

Review routes that use request-body schemas with a top-level primitive type and determine whether handlers assume the received value has that validated type. Affected versions are Fastify releases before 5.12.1.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203