CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-3419

CVE-2026-3419: Content-Type Validation Bypass in Fastify via Regex Anchor Missing

Alon Barad
Alon Barad
Software Engineer

Mar 6, 2026·4 min read·32 visits

Executive Summary (TL;DR)

Fastify versions prior to 5.8.1 incorrectly validate `Content-Type` headers due to a missing regex anchor. Attackers can append arbitrary garbage to media types (e.g., `application/json<script>`) to bypass validation logic while still triggering JSON parsing.

Fastify, a high-performance web framework for Node.js, contains a validation bypass vulnerability in its `Content-Type` header parsing logic. Due to an incomplete regular expression in `lib/content-type.js`, the framework fails to enforce the end-of-string anchor (`$`) when validating media subtypes. This omission allows attackers to supply malformed `Content-Type` headers containing illegal trailing characters (e.g., `application/json garbage`), which Fastify incorrectly accepts as valid. This behavior violates RFC 9110 §8.3.1 and can lead to parser confusion where malicious payloads are routed to incorrect content parsers, potentially bypassing security controls or triggering unexpected application behavior.

Vulnerability Overview

CVE-2026-3419 identifies a medium-severity validation flaw in the Fastify web framework's handling of HTTP Content-Type headers. The vulnerability resides in the core library's MIME type parsing mechanism, specifically where it validates the subtype portion of a media type (the json in application/json).

Under RFC 9110, a media type must conform to strict syntax rules, essentially type/subtype. Fastify attempts to validate this structure using regular expressions. However, the regex used for the subtype validation failed to assert the end of the input string. Consequently, the parser performs a prefix match rather than an exact match.

This flaw allows a client to send a header like Content-Type: application/json unknown-suffix. While a strictly compliant server would reject this as an invalid media type (returning HTTP 415), vulnerable versions of Fastify validate the json prefix and accept the header. This discrepancy permits malformed requests to proceed to the body parsing stage, potentially confusing downstream logic or logging systems that expect RFC-compliant headers.

Root Cause Analysis

The root cause is a classic Regular Expression Anchoring error (CWE-185) located in lib/content-type.js. The regular expression subtypeNameReg was designed to validate that the subtype consists only of allowed characters (alphanumerics and specific symbols like !#$%&'*+.^|~-`).

The vulnerable definition was:

const subtypeNameReg = /^[\w!#$%&'*+.^`|~-]+\s*/

This regex uses the start-of-string anchor (^) but omits the end-of-string anchor ($). In JavaScript's RegExp engine, this instructs the matcher to verify that the string starts with valid characters, but it does not constrain what follows those characters. If the input is json garbage, the engine matches json against the allowed character class and considers the pattern satisfied, ignoring the trailing garbage.

Correct validation requires ensuring the entire string matches the allowed pattern. By missing the $, Fastify effectively downgraded its validation from "is exactly this format" to "starts with this format," opening the door for arbitrary suffix injection.

Code Analysis

The remediation involves a single-character change to the regular expression in lib/content-type.js. The patch enforces strict equality by appending the $ anchor, ensuring the regex matches the full string length.

Below is the comparison of the vulnerable and patched code:

// Vulnerable Code (lib/content-type.js)
// The regex matches any string starting with valid subtype characters.
// Input "json malicious" -> MATCH (Vulnerable)
const subtypeNameReg = /^[\w!#$%&'*+.^`|~-]+\s*/
 
// Patched Code (Fixed in v5.8.1)
// The '$' anchor ensures the string ends immediately after the valid characters.
// Input "json malicious" -> NO MATCH (Secure)
const subtypeNameReg = /^[\w!#$%&'*+.^`|~-]+\s*$/

When subtypeNameReg.test(subtype) is called in the fixed version, the engine consumes the valid characters and then checks for the end of the string. If unauthorized characters (like spaces followed by text, or control characters) are present, the match fails, and Fastify correctly identifies the media type as invalid.

Exploitation Scenarios

Exploitation of this vulnerability requires an attacker to send HTTP requests with crafted Content-Type headers. The primary goal is to bypass strict validation checks while still triggering a specific content parser (usually the JSON parser).

Attack Scenario: Parser Confusion

  1. Setup: A Fastify server is configured to parse application/json. It may have security middleware that blocks requests with unknown content types but uses the same loose validation logic.
  2. Execution: The attacker sends a request with Content-Type: application/json; boundary=exploit (syntactically incorrect for JSON) or Content-Type: application/json<script>.
  3. Result: Fastify validates the header as application/json because of the prefix match. The request is routed to the JSON parser.

This behavior is particularly risky if the application relies on the Content-Type header for security decisions (e.g., "only allow strictly application/json") or if the malformed header bypasses a WAF rule that expects strict RFC compliance but the application accepts it, creating a differential allowing the payload through.

Impact Assessment

The impact of CVE-2026-3419 is classified as Medium (CVSS 5.3). While it does not directly allow Remote Code Execution (RCE) or SQL Injection, it compromises the integrity of the input validation layer.

Technical Impact Breakdown:

  • RFC Violation: The server accepts traffic that violates HTTP standards (RFC 9110), making it non-compliant.
  • Security Bypass: Security controls relying on strict content-type definition can be circumvented. For example, a WAF might block application/x-www-form-urlencoded to prevent parameter pollution, but if an attacker sends application/json payload, and the server parses it as form data due to a misconfiguration or fallback, the protection is bypassed.
  • Log Injection / Obfuscation: Malformed headers (e.g., application/json\x00garbage) may corrupt logs or mislead analysts reviewing traffic logs.

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

  • Confidentiality: None.
  • Integrity: Low (Modification of interpreted request metadata).
  • Availability: None.

Official Patches

FastifyCommit 67f6c9b3 fixing the regex validation
FastifyOfficial GitHub Security Advisory

Fix Analysis (1)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Affected Systems

Fastify Framework (Node.js)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Fastify
OpenJS Foundation
< 5.8.15.8.1
AttributeDetail
CWE IDCWE-185
CWE NameIncorrect Regular Expression
CVSS v3.15.3 (Medium)
Attack VectorNetwork
ImpactValidation Bypass
StatusPatched

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-185
Incorrect Regular Expression

The software uses a regular expression that contains an error, or the regex does not correctly adhere to the intended logic, leading to inaccurate matches.

Known Exploits & Detection

GitHubThe fix commit includes test cases acting as PoC, such as 'application/json<script>alert(1)</script>'

Vulnerability Timeline

Fix commit merged into Fastify main
2026-03-05
Fastify v5.8.1 released
2026-03-05
CVE-2026-3419 and GHSA published
2026-03-06

References & Sources

  • [1]GHSA-573f-x89g-hqp9
  • [2]NVD - CVE-2026-3419
  • [3]RFC 9110 §8.3.1

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 11 hours ago•GHSA-XF4V-W5X5-PV79
5.1

GHSA-XF4V-W5X5-PV79: CSV Formula Injection in Spree Customer Export

A CSV Formula Injection vulnerability (CWE-1236) exists in the Spree headless eCommerce platform within the customer export functionality. An unauthenticated attacker can register a customer profile containing malicious formula sequences in fields like the first name or last name. When an administrator exports the customer data to a CSV file and opens it in a spreadsheet application, the spreadsheet engine can interpret and execute these formulas, potentially leading to remote command execution on the administrator's workstation or out-of-band data exfiltration.

Alon Barad
Alon Barad
4 views•6 min read
•about 11 hours ago•CVE-2026-47694
5.4

CVE-2026-47694: Stored Cross-Site Scripting in WWBN AVideo Category Descriptions

A Stored Cross-Site Scripting (XSS) vulnerability exists in WWBN AVideo versions up to and including 29.0. Unsanitized category descriptions are stored in the database and subsequently rendered as raw HTML in the Gallery view plugin, allowing low-privileged authenticated users to execute arbitrary JavaScript in the browsers of visiting users.

Alon Barad
Alon Barad
5 views•7 min read
•about 12 hours ago•GHSA-JPVJ-WPMJ-H7RV
9.6

GHSA-JPVJ-WPMJ-H7RV: Supply Chain Compromise and Malicious Code Injection in @cap-js/openapi

A critical supply chain compromise was identified in the Node.js package @cap-js/openapi at version 1.4.1. An attacker gained unauthorized publishing access to the npm registry and distributed a backdoored release that harvests sensitive developer credentials, environment variables, and SSH keys. The malicious code then exfiltrates the collected data to external actor-controlled servers.

Amit Schendel
Amit Schendel
12 views•5 min read
•about 12 hours ago•CVE-2026-47696
7.1

CVE-2026-47696: Authenticated Wallet Credit Bypass in WWBN AVideo AuthorizeNet Plugin

An authenticated wallet credit bypass vulnerability exists in WWBN AVideo version 29.0 and earlier. The AuthorizeNet plugin includes an unfinished mockup endpoint, processPayment.json.php, which lacks actual transaction verification and hardcodes success. This allows any authenticated user to credit their wallet with arbitrary balances without making any payments.

Amit Schendel
Amit Schendel
4 views•5 min read
•about 13 hours ago•GHSA-8WHC-2WMV-WW35
8.8

GHSA-8whc-2wmv-ww35: Unauthenticated Stored DOM-based Cross-Site Scripting in WWBN AVideo YPTSocket Plugin

An unauthenticated stored DOM-based Cross-Site Scripting (DOM XSS) vulnerability in the YPTSocket plugin of WWBN AVideo (formerly YouPHPTube) allows remote attackers to execute arbitrary JavaScript within the session context of administrative users. Unsanitized metadata parameters supplied during the WebSocket handshake are persisted in an SQLite database and broadcast to connected users. The frontend application processes these parameters through an unsafe jQuery append sink, leading to silent, high-impact administrative context compromise.

Amit Schendel
Amit Schendel
6 views•7 min read
•about 13 hours ago•CVE-2026-47676
5.3

CVE-2026-47676: Inconsistent Path Parsing and Slicing in Hono Framework Sub-Application Mounting

A path parsing and normalization inconsistency vulnerability exists in the Hono web framework prior to version 4.12.21. When hosting sub-applications via the app.mount() routing interface, Hono calculates the routing path prefix length on a percent-decoded representation of the URI but executes the path-slicing offset on the raw, percent-encoded string. This discrepancy results in malformed request paths being dispatched to mounted sub-applications, potentially leading to route bypasses, route confusion, and application-level Denial of Service.

Alon Barad
Alon Barad
4 views•6 min read