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-CC8F-FCX3-GPJR

GHSA-cc8f-fcx3-gpjr: Arbitrary File Disclosure via DEFINE ANALYZER mapper filter in SurrealDB

Alon Barad
Alon Barad
Software Engineer

Jun 20, 2026·6 min read·3 visits

Executive Summary (TL;DR)

Authenticated database users with EDITOR or OWNER roles can read arbitrary files from the host filesystem by registering a DEFINE ANALYZER statement with a malicious path in the mapper() filter.

A local file disclosure vulnerability exists in SurrealDB's full-text search capabilities, allowing authenticated users with database EDITOR or OWNER roles to read arbitrary files from the host system filesystem. This occurs by abusing the mapper() filter inside a DEFINE ANALYZER statement to point to system files.

Vulnerability Overview

SurrealDB is a multi-model database engine designed for highly scalable cloud applications. Among its features is support for full-text search, which allows developers to configure custom tokenizers, filters, and analyzers. An analytical utility within this search engine, the mapper filter, is designed to ingest a mapping file from the local file system. This mapping file allows the tokenization pipeline to translate specified search terms to normalized values.

A local file disclosure vulnerability exists in SurrealDB prior to version 3.1.5. This issue allows authenticated database users possessing EDITOR or OWNER privileges to read arbitrary files from the host server. The vulnerability is tracked under the identifier GHSA-cc8f-fcx3-gpjr. It stems from a combination of insufficient path validation and verbose error logging.

An attacker with administrative database credentials can invoke the DEFINE ANALYZER statement and configure a mapper filter pointing to critical system files. Because the parser attempts to read the targeted file as a two-column term-mapping file, it fails on standard files and leaks the content of the invalid lines within the resulting database error messages. This mechanism can expose credentials, process environment variables, and system configurations.

Root Cause Analysis

The vulnerability is caused by two distinct logical flaws in the handling of the mapper filter paths. First, the database does not restrict file access paths to a specific sandbox directory by default. Although SurrealDB includes a directory checking function in crates/core/src/iam/file.rs designed to enforce access limits, the logic fails when no allowlist is explicitly defined.

If the SURREAL_FILE_ALLOWLIST environment variable is unset, the internal path verification array remains empty. In this state, the validation logic operates in a 'fail-open' manner, immediately canonicalizing and approving any file path requested by the caller. Consequently, the application will attempt to open any file readable by the operating system user account under which SurrealDB is executed.

Second, the parser built for reading mapping files is overly descriptive when encountering parsing errors. The mapper filter expects files formatted in a structured two-column format, such as tab-separated values. When it parses standard configuration files or binary data, the operation fails and generates an error that includes the literal text of the parsed line. This behavior enables the attacker to view the file contents indirectly through database error responses.

Code Analysis

The path validation function, check_is_path_allowed, failed to enforce restrictions when the configuration vector was empty. The following code represents the vulnerable implementation in crates/core/src/iam/file.rs:

fn check_is_path_allowed(path: &Path, allowed_path: &[PathBuf]) -> Result<PathBuf, Error> {
	let canonical_path = fs::canonicalize(path)?;
 
	// VULNERABILITY: An empty allowlist results in unconditional access approval
	if allowed_path.is_empty() {
		return Ok(canonical_path);
	}
 
	if allowed_path.iter().any(|allowed| canonical_path.starts_with(allowed)) {
		Ok(canonical_path)
	} else {
		Err(Error::FileAccessDenied(path.to_string_lossy().to_string()))
	}
}

To remediate this behavior, the patch implements a secure-by-default design where the list is checked properly, and the mapper files are routed through the is_path_allowed validator prior to initialization. The modified crates/core/src/idx/ft/analyzer/mapper.rs file now implements the path verification step before attempting to load file contents:

impl Mapper {
	pub(in crate::idx) async fn new(path: &Path) -> Result<Self, Error> {
		let mut terms = Tree::new();
		// PATCH: Ensure the path is checked against the configured allowlist
		let path = is_path_allowed(path)?;
		Self::iterate_file(&mut terms, &path).await?;
		Ok(Self {
			terms: Arc::new(terms),
		})
	}
}

This modification guarantees that unless SURREAL_FILE_ALLOWLIST is explicitly set to a valid directory, the database prevents the ingestion of files. Furthermore, because canonicalize is executed on both the requested path and the configured allowlist, directory traversal techniques using path segments such as .. are neutralized.

Exploitation Methodology

Exploitation of GHSA-cc8f-fcx3-gpjr requires network access to the SurrealDB SQL query interface and valid credentials with EDITOR or OWNER roles. The attack begins by registering a custom analyzer with a mapper filter pointing to the target local file. This is achieved via a standard SurrealQL statement:

DEFINE ANALYZER read_passwd TOKENIZERS blank FILTERS mapper('/etc/passwd');

When this statement is evaluated, the database attempts to initialize the analyzer and read /etc/passwd. Because /etc/passwd does not conform to the expected two-column schema, the parser triggers an exception on the first line. The resulting database response contains the error message leaking the first line of the file, which usually corresponds to the system's root user account definition.

To retrieve entire files, the attacker can target system files that contain no newline characters. On Linux platforms, pseudo-files in the /proc directory, such as /proc/self/cmdline and /proc/self/environ, use null bytes (\x00) rather than newlines as delimiters. When SurrealDB attempts to parse these files, it processes the entire content as a single line, causing the database to leak all environment variables or startup arguments within the error message.

Impact Assessment

The impact of this vulnerability is classified as High, with a CVSS v3.1 score of 7.7. The confidentiality impact is high because unauthorized actors can read arbitrary files within the security boundaries of the operating system user account under which SurrealDB is running. This bypasses the typical isolation boundaries between the database engine and the host environment.

By accessing files such as /proc/self/environ, attackers can retrieve sensitive environment variables. This often includes cloud service provider keys, API tokens, and database access credentials. Accessing /proc/self/cmdline can expose the plain-text passwords used to start the SurrealDB database server, directly facilitating administrative takeover of other database instances.

There is no integrity or availability impact associated with this flaw, as the vulnerability is restricted to read operations. However, the exposure of environment secrets often serves as a key pivot point for lateral movement and privilege escalation inside the targeted network infrastructure.

Remediation & Detection

The primary remediation path is upgrading the SurrealDB binary to version 3.1.5 or later. In this and subsequent versions, the system prevents directory access when SURREAL_FILE_ALLOWLIST is unconfigured, and error messages no longer leak line contents.

For systems where upgrading is not immediately possible, administrators must configure the SURREAL_FILE_ALLOWLIST environment variable. This variable must point to a specific, restricted directory containing only legitimate mapping files. This forces the validation algorithm to enforce directory limits and prevents access to system locations such as /etc or /proc.

Administrators can detect potential exploitation attempts by auditing the database metadata for suspicious analyzer definitions. Executing the statement INFO FOR DB; allows teams to review all registered analyzers and identify any custom mapper paths referencing system paths. In addition, network logs can be parsed for SurrealQL query strings containing the DEFINE ANALYZER keyword associated with the mapper filter.

Fix Analysis (1)

Technical Appendix

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

Affected Systems

SurrealDB

Affected Versions Detail

Product
Affected Versions
Fixed Version
SurrealDB
SurrealDB
< 3.1.53.1.5
AttributeDetail
CWE IDCWE-22
Attack VectorNetwork
CVSS Score7.7 (High)
Exploit StatusPoC
ImpactHigh (Arbitrary File Read)
Fixed Version3.1.5

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize elements within the pathname that can resolve to locations outside of the restricted directory.

References & Sources

  • [1]Official Security Advisory
  • [2]Fix Pull Request

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 1 hour ago•GHSA-H5RG-8P7F-47G2
4.1

GHSA-h5rg-8p7f-47g2: Server-Side Request Forgery (SSRF) in SurrealDB Identity & Access Management (IAM) JWKS Fetcher

A Server-Side Request Forgery (SSRF) vulnerability exists in SurrealDB's Identity & Access Management (IAM) module prior to version 3.1.5. When configuring JSON Web Key Set (JWKS) URLs for token verification, the remote fetcher follows HTTP redirects by default without validating redirect targets against configured network capabilities. This allows high-privileged users to bypass network access limits and perform blind port scanning of internal network resources.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 3 hours ago•GHSA-H4H3-3RFJ-X6FQ
4.3

GHSA-H4H3-3RFJ-X6FQ: Value-Ordering Oracle Side-Channel via Indexed ORDER BY in SurrealDB

SurrealDB versions 3.0.0 through 3.1.4 contain an information exposure vulnerability (CWE-203) where the query planner optimizes sorted queries using indexes on fields with field-level SELECT restrictions. Because the query planner performs index-based sorting before enforcing permission-based redaction, unauthorized users can observe the physical order of returned rows to deduce the relative values of protected fields.

Alon Barad
Alon Barad
2 views•8 min read
•about 3 hours ago•GHSA-HV6H-HC26-Q48P
4.3

GHSA-HV6H-HC26-Q48P: Field-level SELECT permissions bypassed via graph and reference traversals in SurrealDB

A security vulnerability exists in SurrealDB's streaming query planner where streaming graph edge traversals or reverse-reference traversals bypass field-level SELECT permissions. This vulnerability allows an authenticated database user with valid, low-privileged credentials holding table-level SELECT permissions to bypass field-level access controls and read highly confidential or restricted fields.

Alon Barad
Alon Barad
4 views•6 min read
•about 5 hours ago•GHSA-JV2J-MQMW-XVV5
6.5

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

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.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 8 hours ago•GHSA-869J-R97X-HX2G
8.7

GHSA-869J-R97X-HX2G: Local Path Traversal and Cross-Origin Resource Sharing Bypass in Anki Desktop

The local media server (mediasrv.py) in Anki up to and including version 25.09.2 fails to validate incoming HTTP requests. The server does not validate the Origin header, enabling cross-origin requests. Additionally, several endpoints suffer from directory traversal vulnerabilities. Combined, these flaws permit an unauthenticated remote attacker to exfiltrate arbitrary files from a local file system when a user visits a malicious website.

Alon Barad
Alon Barad
4 views•8 min read
•about 10 hours ago•GHSA-C7JM-38GQ-H67H
8.1

GHSA-C7JM-38GQ-H67H: Authentication Bypass via Replay Attack in http4k-security-digest due to Insecure Default Nonce Verifier

The http4k-security-digest module within the http4k library fails to validate HTTP Digest Access Authentication nonces by default. Due to an always-true nonce verifier lambda implementation, applications using default configurations do not enforce session freshness or uniqueness. This design flaw allows remote attackers to perform replay attacks, gaining unauthorized access to protected endpoints by intercepting and retransmitting valid authorization headers.

Amit Schendel
Amit Schendel
5 views•5 min read