[MDEV-27541] Nonsense error "alter routine command denied" Created: 2022-01-18 Updated: 2022-02-14 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Christopher Yeleighton | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The server reports an access error when it is expected to do nothing. Server version: 10.6.5-MariaDB
ERROR 1370 (42000): alter routine command denied to user ''@'localhost' for routine 'test.THIS_PROCEDURE_DOES_NOT_EXIST' |
| Comments |
| Comment by Daniel Black [ 2022-01-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The server in all SQL aspects is implemented to check access before running the SQL. Without a denied error, it could lead users to believe it could DROP PROCEDURE. If we extended the pattern would there be no access denied for SELECT * FROM protected_table WHERE id=MISSING_ID? Is removal of access denied errors what you are asking for? This behaviour is probably defined in the SQL standard. Or is "alter routine" inaccurate for a "drop routine" SQL? There are only ALTER PROCEDURE and EXECUTE grants on procedures - https://mariadb.com/kb/en/grant/#procedure-privileges. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Christopher Yeleighton [ 2022-01-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If we extended the pattern would there be no access denied for SELECT * FROM protected_table WHERE id=MISSING_ID? SELECT WHERE FALSE is not a no-op, so no. DROP IF EXISTS is, by definition, a no-op. I am not asking for removal of ACCESS DENIED checks. ALTER ROUTINE is accurate for DROP PROCEDURE. It is accurate for DROP PROCEDURE IF EXISTS if the procedure exists. Please observe that I get no error if it exists. Thank you for your consideration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-01-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To return a non-error result on DROP PROCEDURE IF EXISTS THIS_PROCEDURE_DOES_NOT_EXIST; where the procedure doesn't exist is an information disclosure vulnerability. The user may not have even the permissions EXECUTE let alone ALTER PROCEDURE so disclosing the existence of the procedure where they don't have access is an information disclosure vulnerability. Keeping the Access denied, even though its a no-op, removes the vulnerability. Even a basic attempt at checking if the procedure exists before access control checks introduces potential timing based disclosure of the procedure's existence. CC serg just in case am I missing something, or as the security responder you have anything to add. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Christopher Yeleighton [ 2022-02-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There can be no security vulnerabilities related to the test database. It is there for everyone to see and use as they wish. It offers no integrity guarantees whatsoever. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-02-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Apologizes, I see what you are saying now. An anon user can remove procs on test, but gets denied because of the if exist, when it doesn't. |