Skip to content
Access control Disclosed report Advanced CVE-2026-107822

ACL cache collision lets a role inherit privileges from a same-named socket user

MariaDB's privilege cache key does not distinguish a role lookup from a UNIX-socket user with the same name. A socket connection can warm the cache with the user account's database privileges, and a different account that activates the same-named role then receives those cached user privileges even though they were never granted to the role.

dogeshark Follow

Originally disclosed on HackerOne

Medium 6.4 View original
  • Disclosed after 44 days

Summary

MariaDB's database privilege cache key does not distinguish a role lookup from a UNIX-socket user with the same name. A socket connection can warm the cache with the user account's database privileges. A different account that activates the same-named role then receives the cached user privileges even though those privileges were never granted to the role

Preconditions

  1. A role and a UNIX-socket-accessible user have the same name.
  2. The user has database privileges that the role does not.
  3. Another account has permission to activate the role.
  4. The socket user warms the relevant database privilege-cache entry first.

Reproduction

As an administrator:

SQL
CREATE DATABASE vhrole;
CREATE TABLE vhrole.secret(marker VARCHAR(40));
INSERT INTO vhrole.secret VALUES ('role-cache-collision-row');

CREATE ROLE vhcollision;
CREATE USER 'vhcollision'@'localhost'
  IDENTIFIED BY 'collision-user-only';
CREATE USER 'vhholder'@'127.0.0.1'
  IDENTIFIED BY 'holder-test-only';

GRANT SELECT ON vhrole.* TO 'vhcollision'@'localhost';
GRANT vhcollision TO 'vhholder'@'127.0.0.1';
FLUSH PRIVILEGES;

Warm the cache using the same-named user over the UNIX socket:

SQL
SELECT marker FROM vhrole.secret;

Connect as [email protected]:

SQL
SET ROLE vhcollision;
SELECT CURRENT_ROLE;
SELECT marker FROM vhrole.secret;

Observed result

Text
vhcollision
role-cache-collision-row

The role holder read the row even though SELECT was granted only to 'vhcollision'@'localhost', not to role vhcollision.

Expected result

The final SELECT should return an access-denied error because the active role has no privilege on vhrole.

Root cause

acl_get() constructs a cache key from (ip, user, db) but caches a result derived from (host, ip, user, db). A UNIX-socket user has an empty IP, while role lookups use synthetic empty host and IP values. Same-named principals therefore generate the same key despite requiring different ACL resolution.

Impact

A low-privilege role holder can inherit database-level privileges assigned to a different principal. Depending on the colliding account's grants, this can disclose or modify data outside the role holder's authorization.

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 privilege cache key is built from (ip, user, db) but the cached result depends on (host, ip, user, db), so a UNIX-socket user with an empty IP and a role lookup with synthetic empty host and IP collide.

Impact

A low-privilege role holder can inherit database-level privileges assigned to a different principal, which could disclose or modify data outside the role holder's authorization.

What the attacker needed

Role and socket user share a name; socket user has extra database privileges; another account can activate the role; socket user warms the cache first

How it was found

  1. As administrator, create a database, a role, a socket user with the same name as the role, and another user who can activate the role.
  2. Grant SELECT on the database to the socket user and grant the role to the other user.
  3. Connect as the socket user over the UNIX socket and run a SELECT to warm the privilege cache.
  4. Connect as the other user and activate the role.
  5. Run the same SELECT and observe that it succeeds even though the role has no privilege.

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 MariaDB, roles and users are different things, but they can share a name. The database keeps a cache of who is allowed to do what, and the cache key for a role and for a socket user with the same name is identical. So if the user first loads their permissions into the cache, someone else who activates the role gets those permissions by mistake.

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.