Cloudanix VulnDB

CVE-2026-18504

Medium · 5.4

CVSS

5.4

EPSS

0.3%

Published

Aug 18, 2026

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A popular Node.js web framework lets some incorrectly formatted data slip past its safety checks, which can let attackers bypass rules meant to protect the application.

Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Data Tampering
Component
Web Framework
Class
Improper Input Validation
Remediation
Upgrade
Effort
Low
Patch risk
Low

What it actually does

Schema validation bypass for root primitive request bodies: Ajv performs type coercion on incoming JSON strings but Fastify fails to substitute the coerced value, so route handlers receive the original unvalidated string that violates the declared schema.

Why it matters to the business

Applications relying on Fastify for input validation may allow invalid primitive data to reach business logic, undermining access-control and integrity checks and increasing risk of unauthorized actions or data corruption.

How an attack unfolds

An attacker identifies an endpoint whose schema declares a top-level primitive, sends a JSON string that Ajv would coerce into the expected type, and the un-coerced original value reaches the handler where it bypasses intended validation.

How to fix it

Upgrade fastify to version 5.12.1 or later; no workarounds exist.

How to confirm the fix worked

Confirm installed fastify version is at least 5.12.1; test affected endpoints with a root-primitive schema and a string payload that should be rejected to verify validation now fails as expected.

Typical attack path

  1. Identify route with root-primitive body schema
  2. Submit JSON string payload that should fail validation
  3. Bypass occurs because coerced value is not substituted
  4. Handler processes unvalidated input to trigger logic flaws

How to detect it

Review application logs for requests containing string bodies on routes whose schemas expect root primitives; correlate with any downstream logic that processes values that would have been rejected by the schema.

What your security team should do

  • Upgrade fastify to 5.12.1 across all deployments
  • Audit schemas that validate root primitive values
  • Add regression tests for primitive body validation

The record

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 packages

Ecosystem Package Introduced Fixed

Related vulnerabilities