CVE-2026-49997 Overview
CVE-2026-49997 is an authorization vulnerability [CWE-285] in SurrealDB, a distributed document-graph database for realtime web applications. Versions prior to 3.1.0 automatically purge graph edge records with permissions disabled when a connected node is deleted. The Document::purge_edges function in surrealdb/core/src/doc/delete.rs invokes opt.clone().with_perms(false), bypassing the edge table's PERMISSIONS FOR delete and PERMISSIONS FOR select clauses. An authenticated user who can delete a node can trigger removal of connected edges they should not be able to modify or observe. The issue is fixed in SurrealDB 3.1.0.
Critical Impact
Authenticated users can bypass edge-table permission checks and cause deletion of graph edges they lack authorization to modify, violating the integrity and confidentiality of graph relationships.
Affected Products
- SurrealDB versions prior to 3.1.0
- SurrealDB core library (surrealdb/core)
- Applications embedding vulnerable SurrealDB releases as a dependency
Discovery Timeline
- 2026-07-15 - CVE CVE-2026-49997 published to NVD
- 2026-07-15 - Last updated in NVD database
Technical Details for CVE-2026-49997
Vulnerability Analysis
SurrealDB models data as a graph where nodes are records and relationships are stored as edge records in their own tables. Each table supports SurrealQL PERMISSIONS clauses that gate select, create, update, and delete operations per row. When a node is deleted, SurrealDB must clean up connected edges to prevent dangling references.
The cleanup path in Document::purge_edges executed the internal delete with a cloned Options object where permissions were disabled via with_perms(false). This mirrored the same class of pre-write permission-ordering flaw addressed by the patch, in which permission checks must run before user-controlled expressions can influence outcomes. As a result, edge deletions proceeded regardless of whether the caller satisfied the edge table's PERMISSIONS FOR delete or PERMISSIONS FOR select clauses.
Any authenticated principal with authority to delete a node could indirectly remove edge records governed by stricter policies. This breaks the security assumption that per-table PERMISSIONS are always enforced during data-modifying operations.
Root Cause
The root cause is improper authorization [CWE-285] introduced by explicitly disabling permission enforcement during the internal edge-purge routine. Cascading cleanup logic treated edge removal as a system-level operation rather than an operation attributable to the calling session, bypassing table-level access controls.
Attack Vector
Exploitation requires network access to a SurrealDB instance and low-privilege authenticated credentials with permission to delete at least one node connected by graph edges. No user interaction is required. The attacker deletes an in-scope node, and SurrealDB purges any connected edges without evaluating the edge table's PERMISSIONS clauses.
// Patch excerpt: surrealdb/core/src/doc/delete.rs
// Reorders permission checks so the table-level permission gate runs
// before user-supplied WHERE expressions are evaluated.
) -> Result<Value, IgnoreError> {
self.check_record_exists().await?;
self.check_permissions_quick(opt, stm).await?;
- self.check_where_condition(stk, ctx, opt, stm).await?;
self.check_permissions_table(stk, ctx, opt, stm).await?;
+ self.check_where_condition(stk, ctx, opt, stm).await?;
self.cleanup_table_references(stk, ctx, opt).await?;
self.clear_record_data();
self.store_index_data(stk, ctx, opt).await?;
Source: GitHub commit 500f4060
Detection Methods for CVE-2026-49997
Indicators of Compromise
- Deletion of edge records in tables where the calling identity lacks PERMISSIONS FOR delete authorization
- Unexpected reductions in edge-table row counts immediately following node DELETE statements from low-privilege sessions
- Audit-log entries showing node deletions performed by users who cannot directly SELECT connected edges
Detection Strategies
- Enable SurrealDB query and audit logging to capture the identity, statement, and affected records for every DELETE executed against node and edge tables.
- Correlate node-delete events with subsequent edge-purge activity to identify permission mismatches between the acting principal and the affected edge tables.
- Baseline expected edge deletion patterns for each namespace and database, then alert on deviations originating from non-privileged roles.
Monitoring Recommendations
- Forward SurrealDB logs to a centralized SIEM or data lake and retain them long enough to reconstruct multi-step graph mutations.
- Monitor deployed SurrealDB binaries and container images for versions earlier than 3.1.0 using software composition analysis.
- Track authentication events for database-scope and namespace-scope users that hold DELETE privileges on node tables but not on connected edge tables.
How to Mitigate CVE-2026-49997
Immediate Actions Required
- Upgrade all SurrealDB deployments to version 3.1.0 or later as documented in the GitHub Release v3.1.0 notes.
- Review GitHub Security Advisory GHSA-whwg-vh4f-pmmf to confirm exposure across every environment.
- Audit existing edge tables for unauthorized deletions performed after node removals since the vulnerable version was deployed.
Patch Information
The fix is delivered in SurrealDB 3.1.0 through commit 500f4060349580b9cbb9c07b8112a487551c4616. The patch reorders permission checks so the table-level permission gate executes before user-supplied WHERE expressions and introduces a check_pre_update helper to enforce the same ordering across UPDATE, UPSERT, INSERT ON DUPLICATE KEY UPDATE, and RELATE paths. Applications embedding SurrealDB as a library must rebuild against the patched crate.
Workarounds
- Restrict DELETE privileges on node tables to trusted roles until the upgrade to 3.1.0 is complete.
- Isolate SurrealDB endpoints behind network controls that limit access to authenticated application tiers.
- Where feasible, remove graph-edge relationships from tables that require stricter access controls than their connected node tables.
# Verify installed SurrealDB version and upgrade
surreal version
# Upgrade to the patched release (example, Linux x86_64)
curl -sSf https://install.surrealdb.com | sh -s -- --version v3.1.0
# Confirm the patched version is running
surreal version | grep -E '3\.(1|[2-9])\.'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

