Metabase Password Reset SQL Injection (CVE-2026–72898): Deep Dive
The password reset endpoint accepted an extra, undeclared field in the request body and used its value as a raw SQL fragment when deciding which user's password to update. An unauthenticated attacker could therefore reset any user's password, including an administrator's, and take over the instance.
Published on medium.com
Database
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Metabase is a business intelligence platform that provides dashboards and a query builder. Its backend is written in Clojure, and it assembles SQL internally through a query-builder library called HoneySQL. The feature at the centre of this write-up is the password reset API: the reset_password endpoint, which is designed to take an emailed token and a new password and then update that user's password.
The intended flow is straightforward:
- The user clicks "Forgot password".
- The server generates a temporary token and emails it.
- The user calls
reset_passwordwith the token and the new password. - The server looks up the user by the token and updates only that user's password.
The vulnerability, tracked as CVE-2026-72898, comes from the password reset API taking values outside the fields the developers expected and letting them flow, unvalidated, all the way into the query builder. In one line: if you slip one extra, undeclared field into the request body, that value gets used verbatim as part of the raw SQL string. Since the endpoint requires no authentication, a single request is enough for an attacker to reset the password of any user, including an admin, to whatever they choose.


Setup
No special prerequisites are needed beyond network access to a Metabase instance. The endpoint is unauthenticated, so no account, role or token of your own is required to reach the vulnerable code path. The report does not name a specific Metabase version, and the code snippets it shows are explicitly reconstructed to illustrate the mechanism rather than copied line for line from Metabase's source.
Finding it
The problem sits in step 4 of the intended flow. Instead of anchoring the update to "the user looked up via the token", there was a code path where the server trusted whatever value showed up in the request body to decide which record to update. Because that value passed through HoneySQL's query builder unvalidated, it hit a spot where it was interpreted not as a bind parameter but as a raw SQL expression.
Metabase's backend pulls request bodies apart with Clojure destructuring. The intended shape looks like this:
(defn reset-password [{{:keys [token password]} :body}] ;; intended: only pull token and password out of the body ...)
This reads as "only take token and password from the request body". In the vulnerable version, however, there was a path that also bound the entire body via :as body, and downstream logic mixed in code that read extra fields straight out of that body map:
(defn reset-password [{{:keys [token password] :as body} :body}] ;; some downstream helper reaches back into `body` ;; for a key that was never declared in :keys ...)
Two things stand out.
First, "only declared fields are read" was not actually enforced. Clojure's map destructuring is convenient, but binding the whole original map alongside it via :as body does nothing to stop another piece of code from reaching into body for a key that was never declared. So even if the API spec only documents token and password, if the actual code references another key on body, that value survives and gets passed along.
Second, when that value landed in the :where clause of a HoneySQL query map, it passed through a spot where it was treated as a raw SQL fragment instead of a bind parameter. HoneySQL is safe by default: ordinary values get auto-bound to ? placeholders. But somewhere in the codebase this value either got wrapped in something like [:raw ...], or an equivalent helper that treats a string as literal SQL, or it was passed through a dynamic condition-building utility that carried the incorrect assumption that "this value is already safe SQL". Either way, an attacker-supplied string ends up executed as part of the actual SQL syntax.
The attack conditions, summarised:
- Request body validation worked by pulling out whatever key happened to be present, rather than enforcing a whitelist of allowed keys.
- The value pulled out was treated as code, not data, at the point the query string was assembled.
Put those two together on an endpoint with no authentication at all, and you get SQL injection.
Exploitation
Step 1: Confirm the normal request shape
Start from the documented reset_password request shape, which carries token and password. Looking only at these documented parameters, there is nothing to suggest a vulnerability.
Step 2: Add an extra, undeclared key
Add an extra, undeclared key to the body, for example one that functions as a user identifier. The report does not give the literal key name or a sample payload.
Step 3: The server accepts it without validation
The server accepts this extra key without validation and hands it to the query builder.
Step 4: The value becomes raw SQL
The value gets interpreted as a raw SQL fragment, tampering with the query that decides whose password gets updated.
Step 5: The target's password changes
The password of whatever user the attacker specified, including an admin account, gets changed to a value the attacker controls.
Step 6: Log in as the target
The attacker logs in normally with that account and has full admin access.
Root cause
The mistake is a combination of two design and coding failures on the same unauthenticated endpoint.
On the input side, the handler bound the entire request body with :as body and downstream code read keys from it that were never declared in :keys. Validation therefore behaved as "pull out whatever key happened to be present" rather than as a whitelist of allowed keys.
On the query side, the value taken from that map reached the :where clause of a HoneySQL query map and was treated as a raw SQL fragment rather than a bind parameter. HoneySQL binds ordinary values to ? placeholders automatically, so the safety was lost at the point where the value was wrapped in something like [:raw ...] or passed through a helper that assumed the string was already safe SQL. The report notes that its code snippets are reconstructed from public technical analysis rather than copied from the source.
Existing defences did not stop it because the documented parameters looked harmless, and because a query builder that is "designed to be safe" loses that safety the moment a value passes through even one helper function that treats it as raw SQL. The endpoint also requires no authentication, so there was no privilege boundary to cross before reaching the vulnerable code.
Impact
A successful exploit skips privilege escalation entirely and lands directly on admin access. Once you have admin, you can read credentials for connected data sources, view every piece of data exposed in dashboards, change settings, and create new admin accounts or API keys, which amounts to full takeover of the instance.

The conditions are minimal: network access to a Metabase instance is enough, and a single request suffices.
Fix
Two principles were applied together in the patched version.
- Enforce the input schema as a whitelist. Anything outside the explicitly allowed keys (
token,password) now gets dropped at the destructuring step itself, and the path that let code reach back into the full original map via:as bodywas removed entirely. - Pin the update target to a server-side lookup, not client input. The user is now looked up by the token first, and only that lookup result's
idis used as the update target, removing any way for the client to specify the update target itself.
For detection and response, the report suggests three measures:
- Check WAF or reverse-proxy logs for
/api/session/reset_passwordrequests whose body contains keys beyondtokenandpassword. - Cross-reference admin password-change history, new account creation, and API key issuance around the relevant time window.
- Until you can upgrade to the patched version, add an extra layer of request-body schema validation at the reverse-proxy level, rejecting anything outside the allowed keys, as a stopgap mitigation for the
reset_passwordendpoint.
Variants to test
- Undeclared body keys on other unauthenticated endpoints. Send a request with the documented fields plus one extra key that names a record identifier, and watch whether the response or the affected record changes. A positive result is that the extra key influences which record is updated, deleted or returned.
- Destructuring with
:as bodyin Clojure services. Grep handlers for:as bodyand trace every downstream read of that map. A positive result is a helper that reads a key never listed in:keysand passes it into a query. - HoneySQL
:whereclauses built from strings. Look for[:raw ...]or equivalent helpers wrapping request-derived values. A positive result is a value that appears as SQL syntax rather than as a?bind parameter in the generated query. - Password reset and account recovery flows generally. Add an identifier key alongside the token and password, then check whether the reset applies to the account named by the token or to the one named by the extra key. A positive result is a password change on an account whose token you never held.
- Log review for the same pattern. Search proxy logs for requests to reset endpoints whose bodies carry keys beyond the documented set. A positive result is any such request from an unexpected source, which is worth correlating with admin password changes, new accounts and new API keys.
What happened, in plain words
Metabase is a piece of software that companies install to look at their own data. You point it at a database, and it gives you dashboards (charts and tables on a screen) and a query builder (a friendly way to ask the database questions without writing database code). It is written in a programming language called Clojure, and when it needs to talk to a database it builds the database's own language, SQL, using a helper library called HoneySQL.
SQL is the language databases understand. A typical SQL statement asks for rows, or changes them, for example "update the row for user 42 and set their password to this new value".
This write-up is about one feature of Metabase: the password reset. You know the pattern from any website. You forget your password, you click "Forgot password", the site emails you a link containing a long random string, and you use that link to set a new password. The long random string is called a token. It is a temporary proof that you control the email address on the account.
The bug, tracked as CVE-2026-72898, is that the part of Metabase that handles this reset could be tricked. If you send it one extra field that the developers never expected, the value of that field is pasted straight into the SQL statement that decides whose password gets changed. The endpoint needs no login at all, so a single request is enough for an attacker to set the password of any user, including an administrator, to whatever they like.


The words you need first
Before the details, a few everyday comparisons.
- API: the set of doors a program offers to other programs. Think of a restaurant: the menu is the API, the kitchen is the server, and you never walk into the kitchen yourself. You send an order (a request) and get a dish back (a response).
- Endpoint: one specific door on that menu, identified by a URL path. Here it is
reset_password, the door that handles "I forgot my password". - Request body: the contents of the order form you hand in. It is a small bundle of named fields, each with a value, like
tokenandpassword. - Authentication: proving who you are, usually by logging in. An endpoint that requires no authentication is a door anyone on the network can knock on, no key needed.
- SQL injection: a class of bug where data supplied by a user is treated as part of the database command instead of as a plain value. The classic comparison is a form where you write your name and the clerk reads it out loud to the kitchen as an instruction. If you write "Bob, and also give me the safe keys", a careless clerk repeats the whole sentence as an order. The fix is to keep data and instructions in separate boxes.
- Bind parameter: the safe box. The database command contains a placeholder, a
?, and the value travels separately and is slotted in as pure data. It can never become an instruction. - Raw SQL: the unsafe box. A string is glued directly into the command text, so whatever it contains is read as part of the command.
The feature as it is meant to work
The reset_password endpoint is designed to take an emailed token and a new password, and then update that user's password. The intended flow is:
- The user clicks "Forgot password".
- The server generates a temporary token and emails it.
- The user calls
reset_passwordwith the token and the new password. - The server looks up the user by the token and updates only that user's password.
Step 4 is the important one. The token is the anchor. Whatever account the token belongs to is the account that gets changed, and nothing the user sends can move that anchor.
Where the bug lives
The problem is in step 4. Instead of anchoring the update to "the user looked up via the token", there was a code path where the server trusted whatever value showed up in the request body to decide which record to update. That value then passed through HoneySQL's query builder without validation, and it reached a spot where it was treated not as a bind parameter but as a raw SQL expression.
In one line: slip one extra, undeclared field into the request body, and its value is used verbatim as part of the raw SQL string.
Looking at the code
Metabase's backend pulls request bodies apart with a Clojure feature called destructuring. Destructuring is just pattern matching on a bundle of named fields: you describe the shape you want and get the pieces out by name. The intended shape looks like this:
(defn reset-password [{{:keys [token password]} :body}] ;; intended: only pull token and password out of the body ...)
Line by line:
defn reset-passworddefines a function, a named block of code, calledreset-password.- The square brackets hold the function's inputs. Here there is one input, the whole request.
{:keys [token password]}says: from the request body, take out only the fields namedtokenandpassword, and give me them under those names.:bodysays which part of the request to look in, namely the body.- The comment after
;;is a note for humans and is ignored by the computer. It states the intention: only these two fields are read.
This reads as "only take token and password from the request body". In the vulnerable version, however, there was a path that also bound the entire body via :as body, and downstream logic read extra fields straight out of that body map:
(defn reset-password [{{:keys [token password] :as body} :body}] ;; some downstream helper reaches back into `body` ;; for a key that was never declared in :keys ...)
Line by line:
- Everything is the same as before, except for
:as body. :as bodymeans: in addition to pulling outtokenandpassword, also keep the entire original bundle of fields under the namebody.- The comments say that some other helper function later reaches back into that
bodybundle and reads a field that was never listed in:keys.
The report is explicit that these snippets are reconstructed to illustrate the mechanism, based on public technical analysis. They are not a line-for-line copy of Metabase's actual source.
Two things stand out.
First, "only declared fields are read" was not actually enforced. Keeping the whole bundle around with :as body does nothing to stop another piece of code from reaching into it for a field that was never declared. So even if the API documentation only mentions token and password, if the real code reads another field from body, that value survives and gets passed along. The comparison: a receptionist who is told to note only your name and appointment time, but who also keeps your whole form in a drawer. Anyone in the back office can later pull out the extra line you wrote at the bottom.
Second, when that value landed in the :where clause of a HoneySQL query map, it was treated as a raw SQL fragment instead of a bind parameter. The :where clause is the part of a database command that says which rows to act on, the "for user 42" part. HoneySQL is safe by default: ordinary values get auto-bound to ? placeholders. But somewhere in the codebase this value was either wrapped in something like [:raw ...], a helper that treats a string as literal SQL, or passed through a dynamic condition-building utility that assumed "this value is already safe SQL". Either way, an attacker-supplied string ends up executed as part of the actual SQL syntax.
So the two conditions are:
- Request body validation worked by pulling out whatever key happened to be present, rather than enforcing a whitelist of allowed keys.
- The value pulled out was treated as code, not data, at the point the query string was assembled.
Put those together on an endpoint with no authentication at all, and you get SQL injection.
What the attacker needs
Nothing special. Just network access to a Metabase instance. The endpoint is unauthenticated, so no account, role or token of your own is required to reach the vulnerable code path. The report does not name a specific Metabase version.
The attack, step by step
Step 1: Confirm the normal request shape
Start from the documented reset_password request shape, which carries token and password. Looking only at these documented parameters, there is nothing to suggest a vulnerability. This step matters because you first need to know what a normal order looks like before you can add a line to it.
Step 2: Add an extra, undeclared key
Add an extra, undeclared key to the body, for example one that functions as a user identifier. A user identifier is the number or name the database uses to tell accounts apart. The report does not give the literal key name or a sample payload.
Step 3: The server accepts it without validation
The server accepts this extra key without validation and hands it to the query builder. Validation here means checking the order form against a list of allowed lines. The server did not have such a list; it took whatever was on the form.
Step 4: The value becomes raw SQL
The value gets interpreted as a raw SQL fragment, tampering with the query that decides whose password gets updated. In other words, the attacker's text changes the instruction itself, tampering with the query that decides whose password gets updated.
Step 5: The target's password changes
The password of whatever user the attacker specified, including an admin account, gets changed to a value the attacker controls.
Step 6: Log in as the target
The attacker logs in normally with that account and has full admin access. No trickery is needed at this point: the password is genuinely changed, so the normal login screen accepts it.
Why this one is nasty
Typical SQL injection shows up somewhere visible, a login form, a search box, some spot where user input clearly goes into a query. This case is different:
- Looking only at the documented parameters (
token,password), there is nothing to suggest a vulnerability. The actual bug lived in a field that was never documented, one the developers never explicitly declared as something the endpoint accepts. - Even a query builder that is "designed to be safe", like Clojure and HoneySQL, loses that safety the moment a value passes through even one helper function that treats it as raw SQL.
- Because the endpoint requires no authentication, a successful exploit skips privilege escalation entirely and lands directly on admin access. Privilege escalation means climbing from a normal user to an administrator in steps; here there is no climbing, the attacker starts at the top.
What an attacker can do afterwards
Once you have admin, you can read credentials for connected data sources, view every piece of data exposed in dashboards, change settings, and create new admin accounts or API keys, which amounts to full takeover of the instance. An API key is a long secret string that lets a program act on your behalf.

The conditions are minimal: network access to a Metabase instance is enough, and a single request suffices.
The fix
Two principles were applied together in the patched version.
- Enforce the input schema as a whitelist. Anything outside the explicitly allowed keys (
token,password) now gets dropped at the destructuring step itself, and the path that let code reach back into the full original map via:as bodywas removed entirely. A whitelist means a list of what is allowed, and everything else is thrown away, rather than a list of what is banned. - Pin the update target to a server-side lookup, not client input. The user is now looked up by the token first, and only that lookup result's
idis used as the update target, removing any way for the client to specify the update target itself. The anchor is back on the server side, where the user cannot move it.
Detection and response notes
If you run a Metabase instance, the report suggests three measures.
- Check WAF or reverse-proxy logs for
/api/session/reset_passwordrequests whose body contains keys beyondtokenandpassword. A WAF is a web application firewall, a filter that sits in front of a site and inspects traffic. A reverse proxy is the server that receives visitors first and passes them on to the application, so its logs record every request. - Cross-reference admin password-change history, new account creation, and API key issuance around the relevant time window. Cross-reference means compare the different records against each other to spot a pattern.
- Until you can upgrade to the patched version, add an extra layer of request-body schema validation at the reverse-proxy level, rejecting anything outside the allowed keys, as a stopgap mitigation for the
reset_passwordendpoint. A stopgap mitigation is a temporary shield while the real repair is pending.
Variants to test
If you look after software of your own, the same pattern is worth checking elsewhere.
- Undeclared body keys on other unauthenticated endpoints. Send a request with the documented fields plus one extra key that names a record identifier, and watch whether the response or the affected record changes. A positive result is that the extra key influences which record is updated, deleted or returned.
- Destructuring with
:as bodyin Clojure services. Grep handlers for:as bodyand trace every downstream read of that map. Grep means search text for a pattern. A positive result is a helper that reads a key never listed in:keysand passes it into a query. - HoneySQL
:whereclauses built from strings. Look for[:raw ...]or equivalent helpers wrapping request-derived values. A positive result is a value that appears as SQL syntax rather than as a?bind parameter in the generated query. - Password reset and account recovery flows generally. Add an identifier key alongside the token and password, then check whether the reset applies to the account named by the token or to the one named by the extra key. A positive result is a password change on an account whose token you never held.
- Log review for the same pattern. Search proxy logs for requests to reset endpoints whose bodies carry keys beyond the documented set. A positive result is any such request from an unexpected source, which is worth correlating with admin password changes, new accounts and new API keys.
Glossary
- API: the set of doors a program offers to other programs, each with a defined way to ask and a defined answer.
- Endpoint: one specific door in an API, identified by a URL path such as
reset_password. - Request body: the named fields and values a client sends to an endpoint, like a filled-in order form.
- An unauthenticated endpoint needs no proof.
- Token: a long random string, usually temporary, that proves you control something, such as an email address.
- SQL: the language databases use to read and change data.
- SQL injection: a bug where user-supplied data is treated as part of the database command instead of as a plain value.
- Bind parameter: a safe placeholder, a
?, in a database command, where the value travels separately and is inserted as pure data. - Raw SQL: command text with values glued directly into it, so the values are read as part of the command.
- Clojure: the programming language Metabase's backend is written in.
- Destructuring: a Clojure feature for pulling named fields out of a bundle of data by describing the shape you want.
:keys: the part of a destructuring pattern that lists which fields to pull out by name.:as body: a destructuring option that keeps the entire original bundle of fields under a name, alongside the pulled-out fields.- HoneySQL: a Clojure library that builds SQL commands from data structures, binding ordinary values safely by default.
:whereclause: the part of a database command that says which rows to act on.[:raw ...]: a HoneySQL helper that marks a string as literal SQL, bypassing the safe binding.- Whitelist: a list of what is allowed, with everything else rejected.
- Privilege escalation: climbing from a lower level of access to a higher one, for example from a normal user to an administrator.
- Administrator (admin): an account with full control over an instance, including settings, data sources and other accounts.
- API key: a long secret string that lets a program act on your behalf without a password.
- WAF: a web application firewall, a filter in front of a site that inspects incoming traffic.
- Reverse proxy: the server that receives visitors first and passes their requests on to the application, keeping logs of them.
- CVE: a public identifier for a known vulnerability, here CVE-2026-72898.
- CVSS: a standard score for how severe a vulnerability is.
- Grep: searching text for a pattern.
- Stopgap mitigation: a temporary measure that reduces risk while a proper fix is applied.