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-30241

CVE-2026-30241: Missing Query Depth Validation in Mercurius GraphQL Subscriptions

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 6, 2026·5 min read·22 visits

Executive Summary (TL;DR)

Mercurius versions prior to 16.8.0 fail to apply `queryDepth` limits to GraphQL subscriptions over WebSockets. Attackers can exploit this to send deeply nested queries that exhaust server resources.

A logic vulnerability in the Mercurius GraphQL adapter for Fastify allows attackers to bypass query depth limits using WebSocket subscriptions. While standard HTTP queries are validated against the configured `queryDepth`, subscription operations received via the WebSocket transport layer skip this check. This oversight allows unauthenticated remote attackers to submit arbitrarily nested queries, potentially leading to Denial of Service (DoS) via CPU and memory exhaustion when the subscription events are resolved.

Vulnerability Overview

Mercurius is a popular GraphQL adapter for the Fastify web framework, designed for high performance. To protect against resource exhaustion attacks—common in GraphQL due to the graph-like nature of data—Mercurius provides a queryDepth configuration option. This setting limits the maximum nesting level of incoming queries, preventing clients from requesting exponentially complex data structures.

However, a discrepancy exists in how Mercurius handles different transport protocols. While the HTTP request handler correctly invokes the depth validation logic before execution, the WebSocket handler (used for GraphQL Subscriptions) fails to enforce this check. Consequently, the queryDepth protection is effectively bypassed for any operation submitted via a persistent WebSocket connection.

This vulnerability is classified as CWE-863 (Incorrect Authorization) because the system fails to authorize the resource consumption level (depth) for a specific communication channel, despite the policy being defined globally.

Root Cause Analysis

The root cause lies in the architectural separation between HTTP route handling and WebSocket connection management within the Mercurius codebase. Validation logic was not centralized but rather applied independently in each transport handler.

In the HTTP path (lib/routes.js), the request processing pipeline explicitly calls the internal validation utility to check the Abstract Syntax Tree (AST) of the incoming query against the queryDepth limit. If the limit is exceeded, the request is rejected immediately with a 400 error.

In contrast, the WebSocket path is handled by lib/subscription-connection.js. The SubscriptionConnection class manages the lifecycle of WebSocket clients. When a client sends a start (or subscribe) message, the handler parses the payload and initiates the subscription iterator. Prior to version 16.8.0, this flow did not include a call to the queryDepth validator. The parameters for the depth limit were not even passed down to the subscription connection context, making validation impossible within that scope.

Code Analysis

The fix required plumbing the queryDepthLimit configuration option down to the SubscriptionConnection class and enforcing the check during the message handling phase.

Vulnerable Code Path (Conceptual): In lib/subscription-connection.js, the message handler simply proceeded to execution:

// Pre-patch logic
handleMessage (message) {
  switch (message.type) {
    case GQL_START:
      // ... parsing logic ...
      this.executeSubscription(id, payload, query, variables, operationName)
      break;
  }
}

Patched Code Path: The commit introduces the validation step explicitly. The queryDepth function is imported and called before execution proceeds.

// lib/subscription-connection.js
 
// [1] Import the validator
const queryDepth = require('./query-depth')
 
// [2] Inside the message handler
if (this.queryDepthLimit) {
  // Validate the parsed document definitions
  const queryDepthErrors = queryDepth(document.definitions, this.queryDepthLimit)
  
  if (queryDepthErrors.length > 0) {
    // [3] Halt execution if depth is exceeded
    const err = new MER_ERR_GQL_VALIDATION()
    err.errors = queryDepthErrors
    this.sendMessage(GQL_ERROR, id, { payload: err })
    return
  }
}

Additionally, index.js and lib/routes.js were updated to ensure queryDepthLimit is passed into the SubscriptionConnection constructor during initialization.

Exploitation Methodology

Exploiting this vulnerability requires establishing a WebSocket connection using a standard GraphQL subscription protocol (e.g., graphql-ws or subscriptions-transport-ws). No authentication is strictly required unless the endpoint itself enforces it at the connection level, but the depth check bypass occurs regardless of privilege level.

Attack Scenario:

  1. Target Identification: The attacker identifies a GraphQL schema with recursive relationships (e.g., a User type with a friends field that returns a list of User types).
  2. Connection: The attacker connects to ws://target.com/graphql.
  3. Payload Delivery: The attacker sends a subscription operation with excessive nesting, far exceeding the intended limit (e.g., 100 levels deep).
    subscription { 
      userUpdates { 
        friends { 
          friends { 
            friends { 
              ... # repeated 100+ times
              name 
            } 
          } 
        } 
      } 
    }
  4. Trigger: When the subscription event fires (e.g., a user is updated), the server attempts to resolve the graph. Due to the exponential nature of the nested fields, this consumes significant CPU cycles and memory, degrading service for other users.

Impact Assessment

The primary impact is Denial of Service (DoS). While the CVSS v4.0 score is rated Low (2.7), this likely reflects the specific environmental metrics applied in the context (Availability: Low). In a real-world production environment, uncontrolled recursion can easily crash a Node.js process due to heap allocation failures or block the event loop for extended periods.

Metric Breakdown:

  • Confidentiality/Integrity: None. The attacker cannot read unauthorized data or modify data they shouldn't access (assuming field-level authorization works correctly).
  • Availability: Low to High. Depending on the schema complexity and server resources, a single malicious subscription could stall the process. If the server automatically restarts, it may lead to a boot-loop if the attacker persists the connection.

This vulnerability is particularly dangerous because subscriptions are long-lived. A successful attack does not require a flood of requests; a single expensive subscription can persistently drain resources every time an event is published.

Official Patches

MercuriusCommit 5b56f60 fixes the validation bypass

Fix Analysis (1)

Technical Appendix

CVSS Score
2.7/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:U

Affected Systems

Mercurius GraphQL AdapterFastify applications using MercuriusNode.js GraphQL servers using Mercurius subscriptions

Affected Versions Detail

Product
Affected Versions
Fixed Version
mercurius
mercurius-js
< 16.8.016.8.0
AttributeDetail
CVE IDCVE-2026-30241
CVSS v4.02.7 (Low)
CWECWE-863 (Incorrect Authorization)
Attack VectorNetwork (WebSocket)
ImpactDenial of Service
Exploit StatusPoC Available (Regression Test)

MITRE ATT&CK Mapping

T1499Endpoint Denial of Service
Impact
T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-863
Incorrect Authorization

The software does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.

Known Exploits & Detection

GitHub CommitRegression test included in the fix commit demonstrates the vulnerability.

Vulnerability Timeline

Vulnerability Disclosed (GHSA-m4h2-mjfm-mp55)
2026-03-06
Patch Released (v16.8.0)
2026-03-06
CVE-2026-30241 Published
2026-03-06

References & Sources

  • [1]GHSA-m4h2-mjfm-mp55 Advisory
  • [2]Fix Commit
  • [3]CVE Record

More Reports

•about 4 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 5 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 5 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
7 views•5 min read
•about 6 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 6 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 7 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