Skip to content
Access control Disclosed report Intermediate

KILL authorization trusts the presented login name instead of the authenticated anonymous account

KILL authorization compares the client-supplied login name rather than the authenticated account, so an anonymous MariaDB session can terminate another user's connection by presenting that user's name. This allows cross-user denial of service.

dogeshark Follow

Originally disclosed on HackerOne

  • Disclosed after 41 days

Summary

When a supplied username falls back to an anonymous MariaDB account, the security context retains the supplied login name in user while the authenticated identity in priv_user is empty. KILL authorization compares user, allowing the anonymous session to kill a connection whose user matches the attacker-supplied login name.

Preconditions

  • An anonymous account matches the attacker's source address.
  • A victim connection uses a username the attacker can present from an address where the victim's actual account does not match.

Setup

SQL
CREATE USER ''@'127.0.0.1';
CREATE USER 'killvictim'@'localhost'
  IDENTIFIED BY 'victim-test-only';
FLUSH PRIVILEGES;

Start a victim session over the UNIX socket:

SQL
SELECT SLEEP(20);

Record its connection ID from an administrative session.

Connect over TCP while presenting killvictim and no password:

SQL
SELECT USER(), CURRENT_USER();
KILL CONNECTION <victim_connection_id>;

Observed result

Text
USER()          = [email protected]
CURRENT_USER()  = @127.0.0.1
KILL result     = success
victim result   = connection terminated

The attacker command exited successfully and the victim's sleeping client failed because its connection was closed.

Expected result

The anonymous session should receive ER_KILL_DENIED_ERROR because it lacks the cross-user connection-administration privilege and is not the authenticated owner of the victim session.

Root cause

kill_one_thread() accepts the operation when user_matches() succeeds. Security_context::user_matches() compares user, which is the client-supplied login name, rather than priv_user, which identifies the matched ACL account.

Relevant locations:

  • sql/sql_parse.cc:9187-9188
  • sql/sql_class.cc:5091-5095
  • sql/sql_acl.cc:16259-16283

Suggested remediation

Base ownership checks on authenticated priv_user and host/account context. Add an explicit fail-closed check for anonymous authenticated identities before allowing same-user KILL operations.

Impact

An anonymous database account can terminate another principal's connections or queries by presenting that principal's username. This enables cross-user denial of service and can interrupt in-progress database work.

The original report as published on HackerOne, by dogeshark. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ownership check for KILL uses the client-supplied login name (`user`) instead of the authenticated account (`priv_user`), so an anonymous session can match a victim's username.

Impact

An anonymous database account can terminate another principal's connections or queries by presenting that principal's username, enabling cross-user denial of service.

What the attacker needed

Anonymous account matches attacker source; victim connection uses a presentable username; attacker can present victim's username

The fix

Ownership checks should be based on the authenticated `priv_user` and host/account context, with an explicit fail-closed check for anonymous authenticated identities before allowing same-user KILL operations.

How it was found

  1. Create an anonymous account for the attacker's source address and a victim account.
  2. Start a victim session over the UNIX socket and record its connection ID.
  3. Connect over TCP presenting the victim's username with no password.
  4. Run KILL CONNECTION with the victim's connection ID.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In databases, each connection has a login name and an authenticated account. The KILL command lets you stop other connections, but only your own or if you have special privileges. Here, the check used the login name you typed, not the account you actually logged in as, so an anonymous user could stop someone else's connection by typing that person's name.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by dogeshark

View all

4 more disclosed reports, best first.

More from MariaDB

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.