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



GHSA-JV2J-MQMW-XVV5

GHSA-jv2j-mqmw-xvv5: Stack Overflow Denial of Service in SurrealDB Query Engine

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 20, 2026·6 min read·10 visits

Executive Summary (TL;DR)

A stack overflow vulnerability in SurrealDB allows authenticated users to trigger an uncatchable process abort by submitting queries with thousands of chained binary operators. The issue is resolved in version 3.1.5 by introducing a parser-level recursion depth limit.

An authenticated denial-of-service vulnerability in SurrealDB allows remote attackers with query privileges to crash the server process. The issue arises from uncontrolled recursion during the compilation, serialization, or deallocation of exceptionally deep Abstract Syntax Trees (ASTs). While the iterative Pratt parser successfully handles long flat sequences of binary operators without triggering recursion limits, the resulting AST structure causes stack overflow in downstream recursive tree-walking components.

Vulnerability Overview

SurrealDB is a multi-model database engine written in Rust that processes queries through its custom query language, SurrealQL. Plaintext queries are processed by a syntactic analyzer that translates statements into an Abstract Syntax Tree (AST) before compiler lowering and execution. The primary attack surface resides in endpoints exposing query-execution capabilities, specifically the HTTP /sql and WebSocket /rpc endpoints.

This vulnerability, tracked under GHSA-jv2j-mqmw-xvv5, is classified under CWE-674 (Uncontrolled Recursion) and CWE-400 (Uncontrolled Resource Consumption). It allows an authenticated user with low privileges to crash the database engine by executing a query containing a highly nested or extremely long flat chain of binary operators (e.g., thousands of additions or logical comparisons).

The impact is a total denial of service (DoS) affecting the SurrealDB node. Because SurrealDB operates as a single-process server, a crash terminates all active client connections and transactions across all database instances, namespaces, and tenants hosted on the affected system.

Root Cause Analysis

The root cause of this vulnerability lies in an architectural mismatch between the iterative query-parsing phase and the subsequent recursive AST-processing phases. SurrealDB's syntax parser uses a Pratt parser to handle operator precedence when parsing flat sequences of expressions and operators. Pratt parsing is executed iteratively using loops to append binary operators directly onto the spine of the AST.

Because this parsing phase operates iteratively rather than recursively, it successfully avoids standard call-stack limits or query-recursion guards. The parser processes arbitrarily long expressions without exhausting the call stack, producing an AST of arbitrary depth. For example, a query containing 50,000 chained addition operations yields a binary AST structure with a depth of 50,000 levels.

After parsing, downstream components walk the resulting deep AST to lower it to execution bytecode, serialize it for logs, or deallocate it from memory. These components perform recursive tree-walking operations. In Rust, the default deallocation (Drop implementation) for nested heap structures recursively destroys child nodes. Walking a 50,000-deep tree requires 50,000 nested stack frames, which quickly exhausts the typical 2MB stack space allocated to thread execution, triggering an uncatchable operating system-level stack overflow and a process abort.

Code Analysis and Remediation

The vulnerable implementation allowed the Pratt parser to build arbitrary tree depths because it lacked checks against the resulting AST height. Downstream components relied on standard recursion, which is highly sensitive to excessive nested structures. This code block shows how the Pratt parser built expression nodes iteratively, neglecting to validate overall depth constraints:

// Vulnerable parser pattern
fn parse_expr(&mut self, precedence: Precedence) -> Result<Expression, Error> {
    let mut left = self.parse_primary()?;
    while precedence < self.peek_precedence() {
        // Iterative loop permits infinite chaining
        // of binary operators, producing nested AST nodes
        left = self.parse_infix(left)?;
    }
    Ok(left)
}

The security patch introduced in SurrealDB version 3.1.5 resolves this vulnerability by establishing a strict recursion-depth budget during expression parsing. The expr_recursion_limit parameter (configurable via SURREAL_MAX_EXPRESSION_PARSING_DEPTH) is enforced directly in the parser logic. This prevents the construction of over-deep ASTs, raising a syntax error before any recursive traversals can be executed:

// Patched parser pattern
fn parse_expr(&mut self, precedence: Precedence, depth: u32) -> Result<Expression, Error> {
    // Enforce depth limit to prevent downstream stack overflow
    if depth > self.expr_recursion_limit {
        return Err(Error::MaxExpressionDepthExceeded);
    }
    let mut left = self.parse_primary(depth + 1)?;
    while precedence < self.peek_precedence() {
        left = self.parse_infix(left, depth + 1)?;
    }
    Ok(left)
}

This fix is complete because it addresses the issue at the ingestion layer, ensuring that no downstream compiler, serializer, or memory-cleanup operation ever encounters an AST that exceeds stack capacity.

Exploitation & Attack Methodology

To exploit this vulnerability, an attacker must have valid credentials with permission to execute arbitrary SurrealQL queries. The attack is performed by sending a single, malformed query consisting of a highly repetitive sequence of binary operators, such as addition (+) or logical operators (AND, OR). This payload can be transmitted via HTTP POST to the /sql endpoint or via persistent WebSocket frames to /rpc.

While the HTTP endpoint enforces a default 1 MiB body limit, a carefully crafted payload well below this limit can easily overflow the 2MB thread stack. The WebSocket /rpc endpoint is a highly reliable delivery vector because it often permits larger payloads. The attack sequence operates as follows:

No specialized tools are required. The following Python execution script demonstrates how a low-privileged authenticated session can trigger the crash:

import requests
 
url = "http://localhost:8000/sql"
headers = {"Accept": "application/json", "NS": "test", "DB": "test"}
# Generate deep operator chain
payload = "RETURN 1" + " + 1" * 45000 + ";"
 
try:
    response = requests.post(url, data=payload, headers=headers, auth=("user", "pass"))
    print("Status:", response.status_code)
except requests.exceptions.ConnectionError:
    print("[+] Success: Connection dropped. SurrealDB process terminated.")

Impact Assessment

The impact of this vulnerability is confined to service availability. Because the operating system terminates the process immediately following a stack overflow, the entire database engine halts. The vulnerability does not allow remote code execution or data extraction, nor does it result in database file corruption, since the crash occurs before transaction commit phases.

The CVSS v3.1 score is calculated as 6.5 (Medium). The score is limited by the requirement of valid credentials (PR:L). However, for multi-tenant SaaS environments or applications exposing raw query endpoints to low-privileged users, the impact is severe. An attacker can repeatedly execute the exploit to maintain a persistent state of denial of service, blocking all database transactions on the targeted host.

Remediation & Mitigation Guidance

The definitive fix for this vulnerability is upgrading SurrealDB to version 3.1.5 or later. If immediate upgrading is not possible, administrators should implement the following workarounds to reduce risk:

  1. Enable the --deny-arbitrary-query command-line capability flag. This restriction blocks ad-hoc user query execution, mitigating the risk from non-admin accounts.

  2. Implement ingress payload limitations on reverse proxies (e.g., NGINX or Envoy) to drop HTTP POST requests and WebSocket frames that exceed 50 KB, preventing large nested operator sequences from reaching the parser.

  3. Configure process supervision policies using systemd or Kubernetes restart policies. Ensure the database process restarts automatically on failure using configuration flags such as Restart=on-failure in the systemd service file.

Technical Appendix

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

Affected Systems

SurrealDB Server

Affected Versions Detail

Product
Affected Versions
Fixed Version
SurrealDB
SurrealDB
>= 3.0.0, < 3.1.53.1.5
AttributeDetail
CWE IDCWE-674, CWE-400
Attack VectorNetwork
CVSS v3.1 Score6.5 (Medium)
Exploit StatusProof-of-Concept
CISA KEV StatusNot Listed
ImpactDenial of Service (Process Abort)

MITRE ATT&CK Mapping

T1499.004Endpoint Denial of Service: Application Exhaustion
Impact
T1078Valid Accounts
Initial Access
CWE-674
Uncontrolled Recursion

The software directs the execution flow using recursion, but does not limit the number of recursive steps, leading to stack consumption and process termination.

References & Sources

  • [1]GitHub Security Advisory GHSA-jv2j-mqmw-xvv5
  • [2]SurrealDB GitHub Repository
  • [3]SurrealQL Operators Documentation

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

•2 days ago•CVE-2026-54068
5.9

CVE-2026-54068: Unauthenticated Server-Side Template Injection and SQLite Exfiltration in SiYuan PKM

An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.

Amit Schendel
Amit Schendel
12 views•5 min read
•2 days ago•CVE-2026-54069
9.1

CVE-2026-54069: Authentication Bypass in SiYuan Note via Origin Header Spoofing

CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.

Alon Barad
Alon Barad
10 views•5 min read
•2 days ago•CVE-2026-54089
9.1

CVE-2026-54089: Authentication Bypass by Spoofing in File Browser

CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.

Amit Schendel
Amit Schendel
8 views•7 min read
•2 days ago•GHSA-99J7-FHR2-XFJ4
10.0

GHSA-99J7-FHR2-XFJ4: Malicious Remote Code Execution Payload in 'exploration' Cargo Crate

The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.

Amit Schendel
Amit Schendel
11 views•6 min read
•2 days ago•CVE-2026-54088
9.3

CVE-2026-54088: Pre-Authentication Remote Code Execution in File Browser Hook Authentication

CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.

Alon Barad
Alon Barad
10 views•6 min read
•2 days ago•GHSA-QV4M-M73M-8HJ7
8.8

GHSA-qv4m-m73m-8hj7: Authenticated Arbitrary File Upload leading to Remote Code Execution in NotrinosERP

An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.

Alon Barad
Alon Barad
8 views•6 min read