The core of the vulnerability (GHSA-vvf7-6rmr-m29q) lies in the use of Go's default HTTP server multiplexer, http.DefaultServeMux, across multiple components of Dgraph (alpha, bulk loader, live loader, and debug tools). The Go expvar package, which is imported by Dgraph for metrics, automatically registers a handler on this default multiplexer at the /debug/vars path.
This handler, by default, exposes sensitive process information, including the full command-line arguments used to start the Dgraph process. It is a common practice to provide the admin authentication token via a command-line flag (e.g., --security "token=..."). Consequently, any unauthenticated user with network access to the Dgraph HTTP port could make a GET request to the /debug/vars endpoint and retrieve the admin token from the cmdline field in the JSON response.
This vulnerability is a variant of a previously patched issue that only blocked the /debug/pprof/cmdline endpoint, leaving the /debug/vars endpoint exposed. An attacker could then use the leaked token to gain full administrative access to the Dgraph instance.
The patch addresses this by introducing a custom, sanitized HTTP handler function, x.SanitizedDefaultServeMux. This new handler wraps the default multiplexer and implements two key security checks:
- It explicitly blocks requests to
/debug/pprof/cmdline.
- It provides a custom handler for
/debug/vars (filteredExpvarHandler) that deliberately filters out and omits the cmdline key from the JSON output, preventing the token from being exposed.
This sanitized handler is then applied to all HTTP servers started by the various Dgraph components, effectively closing the information disclosure vector across the entire application.