Dgraph Vulnerable to DQL Injection via checkUserPassword GraphQL Query
The checkUserPassword GraphQL query in Dgraph is vulnerable to DQL (Dgraph Query Language) injection. User-supplied password values are interpolated directly into a DQL checkpwd() query via fmt.Sprintf without any escaping or parameterization. An attacker can inject a password containing a double-quote character to break out of the DQL string literal and append arbitrary DQL query blocks.
The vulnerability exists in the GraphQL-to-DQL query rewriting layer:
1. query_rewriter.go (~line 364) — The checkpwd() DQL function is constructed using fmt.Sprintf:
```go
fmt.Sprintf(checkpwd(User.password, "%s"), password)
```
The raw password string from the GraphQL query input is embedded directly into the DQL query without escaping double quotes or other special characters.
2. graphquery.go — The constructed query attribute is serialized into the final DQL string via b.WriteString(query.Attr), passing the unsanitized content directly to the Dgraph query engine.
A password value containing a double-quote (") terminates the string literal in the checkpwd() function. Any content after the escaped quote is parsed as additional DQL, allowing the attacker to inject arbitrary query blocks.
CVE-2026-41328 and CVE-2026-41327 address DQL injection in edgraph/server.go, where GraphQL mutation inputs (upsert/delete) are embedded unsafely into DQL mutations. Those fixes sanitize the mutation path.
This vulnerability is in a completely different code path — the GraphQL query rewriter (query_rewriter.go → graphquery.go). The checkUserPassword GraphQL query triggers a DQL *query* via checkpwd(), and this query construction was not covered by the patches for CVE-2026-41328/CVE-2026-41327.
```bash
curl -s -X POST http://TARGET:8080/graphql \
-H "Content-Type: application/json" \
-d '{ "query": "query { checkUserPassword(name: \"admin\", password: \"x\\\") { uid } injected(func: has(User.name)) { User.name User.email } dummy(func: eq(x, \\\"x\") { msg } }") { msg } }" }'
```
What to observe:
touched_uids field in the extensions section of the response will be elevated (indicating the injected blocks executed)dgraph alpha output) will show the injected query blocks being parsed and executedtouched_uids metrics and server logs.schema {} blocks or has() queries.CVSS 3.1: 7.5 High — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
checkUserPassword is an unauthenticated query)All versions of Dgraph that include GraphQL support with the @secret directive are affected:
query_rewriter.go constructs checkpwd() via string interpolationEscape or parameterize the password value before embedding it in the DQL query. At minimum, double-quote characters in the password must be escaped:
```go
// Before (vulnerable):
fmt.Sprintf(checkpwd(User.password, "%s"), password)
// After (escaped):
escaped := strings.ReplaceAll(password, \, \\)
escaped = strings.ReplaceAll(escaped, ", \")
fmt.Sprintf(checkpwd(User.password, "%s"), escaped)
```
Ideally, Dgraph should implement parameterized query support for the checkpwd() function to avoid string interpolation entirely, consistent with best practices for injection prevention.
Kai Aizen ([email protected])
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity none, availability none.
The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
CVE-2026-44840 is recorded against 4 packages.
Published on 7 July 2026 and last revised on 23 July 2026. No public exploit is currently recorded for this entry. A vendor advisory or fix has been published. Record sourced from NVD.
github.com (Advisory)
github.com (Fix)
github.com (Web)
github.com/dgraph-io/dgraph has other advisories on record. If you are patching this one, these are worth checking on the same host:
Details
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| github.com/dgraph-io/dgraph | — | — |
| github.com/dgraph-io/dgraph/v25 | — | — |
| github.com/hypermodeinc/dgraph/v24 | — | — |
| unknown | — | — |
References
Similar Threats
Site Security Check
CVE-2026-44840 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.