CVE-2026-25223: Fastify's Content-Type header tab character allows body validation bypass
Impact
A validation bypass vulnerability exists in Fastify where request body validation schemas specified by Content-Type can be completely circumvented. By appending a tab character (\t) followed by arbitrary content to the Content-Type header, attackers can bypass body validation while the server still processes the body as the original content type.
For example, a request with Content-Type: application/json\ta will bypass JSON schema validation but still be parsed as JSON.
This vulnerability affects all Fastify users who rely on Content-Type-based body validation schemas to enforce data integrity or security constraints. The concrete impact depends on the handler implementation and the level of trust placed in the validated request body, but at the library level, this allows complete bypass of body validation for any handler using Content-Type-discriminated schemas.
This issue is a regression or missed edge case from the fix for a previously reported vulnerability.
Patches
This vulnerability has been patched in Fastify v5.7.2. All users should upgrade to this version or later immediately.
Workarounds
If upgrading is not immediately possible, user can implement a custom onRequest hook to reject requests containing tab characters in the Content-Type header:
javascript fastify.addHook('onRequest', async (request, reply) => { const contentType = request.headers['content-type'] if (contentType && contentType.includes('\t')) { reply.code(400).send({ error: 'Invalid Content-Type header' }) } })
Resources
- https://github.com/fastify/fastify/blob/759e9787b5669abf953068e42a17bffba7521348/lib/validation.js#L272 - https://github.com/fastify/fastify/blob/759e9787b5669abf953068e42a17bffba7521348/lib/content-type-parser.js#L125 - Fastify Validation and Serialization Documentation - https://hackerone.com/reports/3464114
Other sources
Fastify is a fast and low overhead web framework, for Node.js. Prior to version 5.7.2, a validation bypass vulnerability exists in Fastify where request body validation schemas specified by Content-Type can be completely circumvented. By appending a tab character (\t) followed by arbitrary content to the Content-Type header, attackers can bypass body validation while the server still processes the body as the original content type. This issue has been patched in version 5.7.2.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/fastifyto a version that resolves this vulnerability.Fixed in 5.7.2 - Upgrade
Upgrade
fastifyto a version that resolves this vulnerability.Fixed in 5.7.2 - Configuration
If upgrading is not immediately possible, implement a custom Fastify `onRequest` hook that checks `request.headers['content-type']` and rejects the request with HTTP 400 when the header includes a tab character (`'\t'`).
Fastify (onRequest hook) Content-Type header validation (tab character check) = Reject requests where Content-Type includes '\t'
Event History
Frequently Asked Questions
What is the severity of CVE-2026-25223?
CVE-2026-25223 is classified as a high-severity vulnerability due to its ability to bypass request body validation.
How does CVE-2026-25223 affect application security?
CVE-2026-25223 allows attackers to send malicious payloads by circumventing validation, leading to potential exploitation of the application.
What versions of Fastify are affected by CVE-2026-25223?
CVE-2026-25223 affects Fastify versions prior to 5.7.2.
How do I fix CVE-2026-25223?
To fix CVE-2026-25223, upgrade Fastify to version 5.7.2 or later.
Is there a known exploit for CVE-2026-25223?
Yes, details of the exploit for CVE-2026-25223 have been documented and publicly disclosed.