Summary
Dgraph's restoreTenant admin mutation was exposed without any authorization checks, allowing anyone who could reach the admin endpoint to invoke it.
Because this mutation accepts attacker-controlled backup URLs, credential paths, and key locations, an unauthenticated attacker could overwrite the database, access server-side files, and abuse the server for SSRF-style requests.
Affected context
The vulnerability occurs in Dgraph deployments where the admin GraphQL API is reachable (e.g., from internal networks, Kubernetes clusters, or misconfigured internet-facing endpoints).
The specific issue is in the restoreTenant admin mutation, which was not wired into the same authorization middleware as other sensitive admin operations.
Environments that rely on network boundaries alone, or assume that all admin mutations require Guardian-of-Galaxy authentication, are especially exposed.
Exploit preconditions
- Attack surface: Dgraph admin GraphQL endpoint exposing the
restoreTenantmutation. - Required access: Network access to the admin endpoint; no authentication or prior compromise is required.
- Trigger point: Invoking
restoreTenantwith attacker-supplied parameters for backup source URLs, credential locations, and key file paths. - Why exploitation is possible: The
restoreTenantmutation was omitted from the authorization middleware configuration, so calls execute with full privileges and zero authentication, despite handling highly sensitive restore and file/URL handling logic.
Why this happens
This issue is a classic CWE-862: Missing Authorization vulnerability.
In Dgraph's admin layer, the restoreTenant mutation was introduced or maintained without being registered in the authorization middleware configuration (admin.go).
As a result, it bypassed the Guardian-of-Galaxy or equivalent access control path that protects similar operations like restore.
The underlying pattern is a broken or incomplete authorization mapping, where a new or special-case endpoint handling critical operations is not consistently enforced by the central auth mechanism, leading to a fully unauthenticated but privileged code path.
Potential impact
- An unauthenticated attacker could overwrite tenant data or the entire database using crafted backup sources.
- The attacker could read sensitive files from the server's local filesystem via
file://URLs and referenced key/credential paths. - The server could be coerced into making outbound HTTP(S) requests to arbitrary URLs, enabling Server-Side Request Forgery (SSRF).
- Exfiltration of cloud storage credentials (e.g., S3/MinIO) or secret management configuration (e.g., Vault credential files) could occur indirectly via backup/restore configuration.
- Compromise of data integrity, including destructive restoration from attacker-controlled backups, potentially leading to full application-level data loss or tampering.
General mitigation guidance
Effective mitigation focuses on enforcing consistent, centralized authorization and minimizing the power of administrative endpoints:
- Ensure all admin mutations and endpoints are registered with a unified authorization middleware or policy engine, rather than relying on ad-hoc checks.
- Treat database restore, backup, and migration operations as highly privileged and require strong authentication and authorization (e.g., dedicated admin roles, out-of-band credentials).
- Limit the ability of admin operations to fetch data from arbitrary URLs; restrict to allow-listed storage locations or signed URLs, and avoid accepting arbitrary
file://paths. - Reduce the server's filesystem and network exposure by running it with least-privilege OS accounts, constrained filesystem permissions, and outbound network egress controls.
- Implement network-level protections such as isolating admin APIs on separate interfaces, internal-only subnets, or dedicated admin gateways with additional authentication layers.
How teams detect issues like this
Detection approaches can combine configuration review, code-analysis, and runtime monitoring:
- Use static analysis or policy-as-code to verify that every admin or mutation handler is bound to appropriate authorization middleware; flag any handlers that are missing auth decorators or middleware registration.
- In code reviews, treat any new admin or restore-like functionality as a high-risk area that must demonstrate explicit interaction with the centralized authorization mechanism.
- Implement logging for all admin operations, including
restoreand similar mutations, and monitor for calls originating from unexpected IP ranges, service accounts, or at unusual times. - Use WAFs, API gateways, or service meshes to enforce authentication and authorization on admin endpoints at the network edge, and to detect anomalous patterns like frequent restore attempts.
- Periodically run security tests or automated API scans to enumerate admin operations and confirm they require authentication and proper authorization scopes.

