Summary
An information exposure vulnerability in Dgraph allows the unauthenticated /debug/vars endpoint on Alpha nodes to leak the process command line, including the admin token when it is supplied via the --security "token=..." startup flag.
An attacker who can reach this debug endpoint may retrieve the admin token and replay it in the X-Dgraph-AuthToken header to access admin-only endpoints and perform privileged operations on the database cluster.
Affected context
This issue affects Dgraph deployments where:
- Alpha nodes expose the
/debug/varsHTTP endpoint without authentication or network-level isolation - The admin token is provided via process command-line flags, such as
--security "token=..." - The default Go HTTP multiplexer (
http.DefaultServeMux) is still serving expvar's/debug/varshandler alongside other Dgraph debug handlers
In these conditions, debug instrumentation intended for diagnostics unintentionally returns sensitive runtime details, including security-critical CLI arguments.
Exploit preconditions
- Attack surface: HTTP interface on Dgraph Alpha nodes, specifically the
/debug/varsendpoint - Required access: Network reachability to the Alpha debug port; no prior authentication is needed if the endpoint is left open
- Trigger point: A simple HTTP GET request to
/debug/varscausing expvar to return process state, including the command line - Why exploitation is possible: The debug handler is served unauthenticated and includes the full command-line string where the admin token is often specified, allowing token disclosure and replay in the
X-Dgraph-AuthTokenheader
Why this happens
The root cause lies in exposing diagnostic debug endpoints that return sensitive runtime information over an unauthenticated channel.
Specifically, the Alpha process relies on Go's default HTTP multiplexer, which includes expvar's /debug/vars handler, and that handler provides access to the process command line.
When operators pass security-sensitive secrets such as the admin token via CLI flags, these secrets become part of the observable process metadata.
This maps to CWE-200: Information Exposure, where a system unintentionally discloses confidential data (the admin token) through an auxiliary interface designed for diagnostics rather than secure operations.
Potential impact
- An attacker may obtain the admin token and perform administrative operations via admin-only HTTP endpoints
- An attacker could modify schema, data, or cluster configuration with full administrative privileges
- An attacker can perform destructive actions such as dropping data, altering ACLs, or disrupting cluster availability
- An attacker may use the disclosed token to maintain persistent unauthorized access or pivot to other components in the environment
General mitigation guidance
Effective mitigation focuses on restricting debug surfaces and avoiding exposure of secrets in runtime metadata:
- Limit or disable unauthenticated debug endpoints in production, especially those under
/debug/*, or place them behind strong authentication and network access controls - Avoid passing secrets such as tokens, passwords, or keys via command-line flags; favor environment variables, dedicated configuration mechanisms, or external secret stores that are not trivially exposed by diagnostics
- Ensure that any diagnostic or profiling interfaces are bound to localhost or management networks, not to public or untrusted interfaces
- Apply least-privilege principles to admin tokens, and rotate them promptly if there is any suspicion of exposure
- Establish configuration baselines where debug handlers are off or locked down by default in production deployments
How teams detect issues like this
Detection commonly combines configuration inspection, network monitoring, and security testing:
- Use configuration and infrastructure-as-code reviews to locate services exposing
/debug/*endpoints, especially on externally reachable interfaces - Employ dynamic application security testing (DAST) and security scanning tools to probe for unauthenticated debug endpoints that disclose process metadata
- Implement network monitoring to identify unexpected access patterns to debug paths such as
/debug/vars, including from unknown or untrusted sources - Add static analysis or policy checks in CI/CD to flag uses of security-sensitive secrets passed as command-line flags and to enforce configuration policies around debug interfaces
- Periodically run manual or automated penetration tests focused on management and diagnostics planes to catch similar exposure patterns

