CVE-2026-44840: Github.com/dgraph io/dgraph/v25 Dgraph Vulnerable To DQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-q2m9-6jp9-c6mc
CVSS 7.5
CWE-943
Published
Advisory Summary

CVE-2026-44840 is a HIGH (CVSS 7.5) dgraph vulnerable to dql injection vulnerability (CWE-943: Improper Neutralization of Special Elements in Data Query Logic) affecting Github.com/dgraph io/dgraph/v25 libraries in the Go ecosystem. The issue involves dgraph vulnerable to dql injection via checkuserpassword graphql query. Remediation is available by upgrading affected packages to version 25.3.4.

CVE-2026-44840 at a Glance

CVE Identifier CVE-2026-44840
GHSA Identifier GHSA-q2m9-6jp9-c6mc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-943: Improper Neutralization of Special Elements in Data Query Logic
Affected Product Github.com/dgraph io/dgraph/v25
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-44840

To remediate this vulnerability, upgrade all affected Github.com/dgraph io/dgraph/v25 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/dgraph-io/dgraph/v25 fixed: 25.3.4
Upgrade github.com/dgraph-io/dgraph/v25 to 25.3.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/dgraph-io/dgraph/v25

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-44840, inspect your project dependencies for Github.com/dgraph io/dgraph/v25:

inspect dependencies for github.com/dgraph-io/dgraph/v25

Analyze the terminal output to locate any version of Github.com/dgraph io/dgraph/v25 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 25.3.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-943: Improper Neutralization of Special Elements in Data Query Logic, where the product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. In Github.com/dgraph io/dgraph/v25, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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. ## Details ### Vulnerable Code Path 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. ### Attack Mechanism 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. ### Distinction from CVE-2026-41328 and CVE-2026-41327 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. ## PoC ```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:** - The `touched_uids` field in the `extensions` section of the response will be elevated (indicating the injected blocks executed) - Dgraph server logs (`dgraph alpha` output) will show the injected query blocks being parsed and executed - The response itself may be filtered by the GraphQL layer, but server-side execution is confirmed ## Impact - **Data enumeration**: Injected query blocks execute server-side and can probe for the existence of predicates, types, and nodes via `touched_uids` metrics and server logs. - **Schema discovery**: An attacker can enumerate all predicates and types in the database by injecting `schema {}` blocks or `has()` queries. - **Resource exhaustion**: Expensive injected queries (recursive traversals, large aggregations) execute at the DQL layer, consuming server resources regardless of whether results are returned to the attacker. - **Potential data disclosure**: Depending on Dgraph configuration (e.g., debug mode, custom extensions), injected query results may leak into the response. **CVSS 3.1: 7.5 High** — `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N` - Network-accessible via any GraphQL endpoint - No authentication required (`checkUserPassword` is an unauthenticated query) - Low attack complexity (single crafted HTTP request) - High confidentiality impact (server-side query execution confirmed, data enumeration possible) ## Affected Versions All versions of Dgraph that include GraphQL support with the `@secret` directive are affected: - <= v25.3.3 - Any version where `query_rewriter.go` constructs `checkpwd()` via string interpolation ## Suggested Fix Escape 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. ## Credit Kai Aizen (kai.aizen.dev@gmail.com)

CVE-2026-44840 Affected Github.com/dgraph io/dgraph/v25 Versions

1 component(s)
Fixed Versions:
25.3.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/dgraph-io/dgraph/v25
Go
< 25.3.4
25.3.4

References

Frequently Asked Questions

What is CVE-2026-44840?
CVE-2026-44840 is a security vulnerability in Github.com/dgraph io/dgraph/v25 involving Dgraph Vulnerable to DQL Injection via checkUserPassword GraphQL Query under CWE-943: Improper Neutralization of Special Elements in Data Query Logic.
Which Github.com/dgraph io/dgraph/v25 versions are affected?
Affected versions include releases prior to 25.3.4 across affected packages: github.com/dgraph-io/dgraph/v25.
What version fixes CVE-2026-44840?
Upgrading to 25.3.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/dgraph-io/dgraph/v25 affected?
Yes, github.com/dgraph-io/dgraph/v25 is affected in releases prior to 25.3.4. Upgrade your dependency to 25.3.4 or later.
What is the CVSS score of CVE-2026-44840?
CVE-2026-44840 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-44840?
CVE-2026-44840 is classified under CWE-943: Improper Neutralization of Special Elements in Data Query Logic (The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query.).
How can I check Go dependencies for CVE-2026-44840?
Run the dependency tree command: 'inspect dependencies for github.com/dgraph-io/dgraph/v25'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q2m9-6jp9-c6mc",
  "modified" : "2026-06-29T22:53:52Z",
  "published" : "2026-06-29T22:53:52Z",
  "aliases" : [ "CVE-2026-44840" ],
  "summary" : "Dgraph Vulnerable to DQL Injection via checkUserPassword GraphQL Query",
  "details" : "## Summary\n\nThe `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.\n\n## Details\n\n### Vulnerable Code Path\n\nThe vulnerability exists in the GraphQL-to-DQL query rewriting layer:\n\n1. **`query_rewriter.go` (~line 364)** — The `checkpwd()` DQL function is constructed using `fmt.Sprintf`:\n\n   ```go\n   fmt.Sprintf(`checkpwd(User.password, \"%s\")`, password)\n   ```\n\n   The raw password string from the GraphQL query input is embedded directly into the DQL query without escaping double quotes or other special characters.\n\n2. **`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.\n\n### Attack Mechanism\n\nA 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.\n\n### Distinction from CVE-2026-41328 and CVE-2026-41327\n\nCVE-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.\n\nThis 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.\n\n## PoC\n\n```bash\ncurl -s -X POST http://TARGET:8080/graphql \\\n  -H \"Content-Type: application/json\" \\\n  -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 } }\" }'\n```\n\n**What to observe:**\n\n- The `touched_uids` field in the `extensions` section of the response will be elevated (indicating the injected blocks executed)\n- Dgraph server logs (`dgraph alpha` output) will show the injected query blocks being parsed and executed\n- The response itself may be filtered by the GraphQL layer, but server-side execution is confirmed\n\n## Impact\n\n- **Data enumeration**: Injected query blocks execute server-side and can probe for the existence of predicates, types, and nodes via `touched_uids` metrics and server logs.\n- **Schema discovery**: An attacker can enumerate all predicates and types in the database by injecting `schema {}` blocks or `has()` queries.\n- **Resource exhaustion**: Expensive injected queries (recursive traversals, large aggregations) execute at the DQL layer, consuming server resources regardless of whether results are returned to the attacker.\n- **Potential data disclosure**: Depending on Dgraph configuration (e.g., debug mode, custom extensions), injected query results may leak into the response.\n\n**CVSS 3.1: 7.5 High** — `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`\n\n- Network-accessible via any GraphQL endpoint\n- No authentication required (`checkUserPassword` is an unauthenticated query)\n- Low attack complexity (single crafted HTTP request)\n- High confidentiality impact (server-side query execution confirmed, data enumeration possible)\n\n## Affected Versions\n\nAll versions of Dgraph that include GraphQL support with the `@secret` directive are affected:\n\n- <= v25.3.3\n- Any version where `query_rewriter.go` constructs `checkpwd()` via string interpolation\n\n## Suggested Fix\n\nEscape or parameterize the password value before embedding it in the DQL query. At minimum, double-quote characters in the password must be escaped:\n\n```go\n// Before (vulnerable):\nfmt.Sprintf(`checkpwd(User.password, \"%s\")`, password)\n\n// After (escaped):\nescaped := strings.ReplaceAll(password, `\\`, `\\\\`)\nescaped = strings.ReplaceAll(escaped, `\"`, `\\\"`)\nfmt.Sprintf(`checkpwd(User.password, \"%s\")`, escaped)\n```\n\nIdeally, Dgraph should implement parameterized query support for the `checkpwd()` function to avoid string interpolation entirely, consistent with best practices for injection prevention.\n\n## Credit\n\nKai Aizen (kai.aizen.dev@gmail.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/dgraph-io/dgraph/v25"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "25.3.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 25.3.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dgraph-io/dgraph/security/advisories/GHSA-q2m9-6jp9-c6mc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgraph-io/dgraph/commit/cee702c93f141eeb0c96a81f70830ec9e459efac"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dgraph-io/dgraph"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgraph-io/dgraph/releases/tag/v25.3.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-943" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-29T22:53:52Z",
    "nvd_published_at" : null
  }
}