/

CVE-2026-84504

Severity:

HIGH RISK

(8.1)

Improper Input Validation (CWE-20) in Fastify Routes

CVE-2026-84504

Analyzed

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Unauthorized State Changes and Data Disclosure

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Fastify versions before 5.12.2 may replace a validated request body with the value of a root-level property named value after an Ajv asynchronous validator succeeds. An authenticated, low-privilege caller could use this behavior to make a route process data that was not covered by its schema, potentially causing unauthorized state changes or exposing protected information.

Affected context

The issue occurs in Fastify routes that use Ajv asynchronous validation or custom validator compilers and accept request bodies containing a root-level value property. It becomes risky when the route handler relies on the validated body while Fastify substitutes that body with the property's nested value before handler execution.

Exploit preconditions

  • Attack surface: Authenticated HTTP request handling through a Fastify route
  • Required access: A low-privilege account capable of submitting requests to an affected endpoint
  • Trigger point: Successful asynchronous Ajv validation followed by request-body processing
  • Required input condition: The request body contains a root-level property named value
  • Why exploitation is possible: Fastify interprets the validator result using a protocol intended for custom validator compilers and replaces the complete body after validation, allowing the handler to receive data that was not the object validated by the route schema

Why this happens

The underlying bug is a mismatch between asynchronous validator return handling and the request-body contract expected by Fastify. A successful Ajv validator result containing a value property is treated as a replacement-value protocol rather than as the already validated request object. This maps to CWE-20: Improper Input Validation, because data can reach application logic in a form that was not actually covered by the route's declared validation rules.

Potential impact

  • An attacker may cause handlers to process unauthorized nested data.
  • Application state could be changed beyond the permissions represented by the route schema.
  • Protected records or fields could be disclosed through affected operations.
  • Downstream authorization and business-rule checks may receive unexpected object structures.
  • Data integrity could be weakened when handlers trust the substituted request body.

General mitigation guidance

Mitigation generally focuses on preserving the identity and integrity of validated request objects across the validation boundary.

Common defensive patterns include:

  • Use framework and validator integrations that distinguish validation results from replacement-value protocols.
  • Ensure asynchronous validators return only the result shape expected by the active integration.
  • Apply explicit schema validation and authorization checks to the object consumed by the handler.
  • Avoid relying solely on pre-handler validation when request data may be transformed.
  • Limit route permissions and handler privileges so unexpected input cannot authorize sensitive operations.
  • Add regression tests for root-level properties that could collide with validator result conventions.

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis and dependency review for asynchronous validator integrations and custom compiler hooks.
  • Code review checks for request-body replacement, implicit object transformations, and ambiguous value result conventions.
  • Integration tests that compare the object validated by a route schema with the object received by its handler.
  • Policy enforcement requiring authorization checks after parsing or transformation boundaries.
  • Automated security review tools that flag mismatches between validation contracts and handler input assumptions.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/fastify/security/advisories/GHSA-667r-xxjv-c9mm

Frequently asked

questions

It can be exploitable through an affected HTTP route when the attacker is authenticated and has permission to submit requests to that route. The attacker does not necessarily need administrative privileges.

The described scenario requires a low-privilege authenticated caller with access to an endpoint that uses the affected asynchronous validation behavior.

Ensure that validation results are not confused with replacement-value protocols, and make the handler consume the same object that the route schema validated. Framework and dependency remediation should be paired with regression testing.

Keep validation, transformation, and authorization contracts explicit; test the exact object passed to handlers; and review custom validator integrations for ambiguous result handling.

Find out what's already
exploitable in your codebase.