<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Admin-Token-Disclosure — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/admin-token-disclosure/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Thu, 02 May 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/admin-token-disclosure/feed.xml" rel="self" type="application/rss+xml"/><item><title>Dgraph Unauthenticated Admin Token Disclosure via /debug/vars</title><link>https://feed.craftedsignal.io/briefs/2024-05-dgraph-auth-bypass/</link><pubDate>Thu, 02 May 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-05-dgraph-auth-bypass/</guid><description>Dgraph versions prior to 25.3.3 expose the admin token via the `/debug/vars` endpoint, allowing unauthenticated attackers to bypass authentication and gain administrative access.</description><content:encoded><![CDATA[<p>Dgraph, a graph database, exposes sensitive information through an unauthenticated endpoint, <code>/debug/vars</code>, in versions prior to 25.3.3. The vulnerability arises because the admin token is often passed as a command-line argument using the <code>--security &quot;token=...&quot;</code> flag. This argument is exposed through the <code>/debug/vars</code> endpoint, which is enabled by default via Go&rsquo;s <code>expvar</code> package. An attacker can retrieve this token without authentication and then use it to gain administrative privileges by including it in the <code>X-Dgraph-AuthToken</code> header of subsequent requests. This is a bypass of previous attempts to mitigate similar issues via <code>/debug/pprof/cmdline</code>, which were addressed incompletely. This issue impacts deployments where the Alpha HTTP port is reachable by untrusted parties, allowing for a full authentication bypass.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker sends an unauthenticated GET request to the <code>/debug/vars</code> endpoint on the Dgraph Alpha server (e.g., <code>GET /debug/vars HTTP/1.1</code>).</li>
<li>The server responds with a JSON payload containing the <code>cmdline</code> field.</li>
<li>The attacker parses the JSON response and extracts the value of the <code>cmdline</code> field.</li>
<li>The attacker searches the <code>cmdline</code> output for the <code>--security token=...</code> argument.</li>
<li>The attacker extracts the admin token from the <code>--security</code> argument string.</li>
<li>The attacker sends a request to an admin-only endpoint (e.g., <code>GET /admin/config/cache_mb HTTP/1.1</code>).</li>
<li>The attacker includes the extracted admin token in the <code>X-Dgraph-AuthToken</code> header of the request.</li>
<li>The Dgraph Alpha server validates the token, granting the attacker administrative access.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows an unauthenticated attacker to gain complete administrative control over the Dgraph database. This includes the ability to read and modify admin configurations, and perform operational control actions. In deployments where the Alpha HTTP port is publicly accessible, this vulnerability poses a significant risk, leading to potential data breaches, service disruption, and unauthorized manipulation of the database. While the number of affected deployments is not explicitly stated, any Dgraph instance running a vulnerable version with an exposed Alpha HTTP port is at risk.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade Dgraph to version 25.3.3 or later to address the vulnerability.</li>
<li>As a temporary workaround, restrict access to the Alpha HTTP port to trusted networks only.</li>
<li>Deploy the Sigma rule below to detect unauthorized access attempts to the <code>/admin/config/cache_mb</code> endpoint using the <code>X-Dgraph-AuthToken</code> header.</li>
<li>Deploy the Sigma rule below to detect access to <code>/debug/vars</code> endpoint.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>dgraph</category><category>authentication-bypass</category><category>admin-token-disclosure</category></item></channel></rss>