Impact
Fastify implements a regex-based validator for the Content-Type header that is intended to enforce RFC 9110 §8.3.1. In this CVE, the validator incorrectly accepts headers that contain trailing characters after the subtype token, such as Content-Type: application/json garbage, because the end anchor in the regular expression is missing. As a result, requests whose media types are RFC-invalid are treated as valid by Fastify’s parser and are routed to the associated content-type parser. This flaw is categorized as CWE‑185 and CWE‑625, and allows an attacker to bypass the server’s media‑type validation and potentially cause malicious payloads to be processed under the wrong parser.
Affected Systems
The vulnerability affects the Fastify framework distributed under the npm package fastify. All released versions prior to 5.8.1 are susceptible, as the patch was introduced in v5.8.1. No specific operating systems or Node.js version constraints are listed, but the bug exists within the Fastify codebase regardless of deployment environment.
Risk and Exploitability
With a CVSS v3 base score of 5.3, the flaw is considered moderate severity. The EPSS score is under 1%, indicating a low probability that attackers are actively exploiting it at present. The vulnerability is not listed in the CISA KEV catalog. An attacker can trigger the issue by sending an HTTP request with a Content-Type header that includes trailing characters beyond the acceptable subtype token; the server will accept the header, route the request to the parser, and process the payload as if it were compliant. Because the flaw only allows bypass of validation without direct code execution, the risk is limited to potential downstream effects such as injection of malformed data, but it remains exploitable in environments that rely on strict Content-Type validation for security.
OpenCVE Enrichment
Github GHSA