[MDEV-30840] "Auth Switch Request" is sent with a specific user Created: 2023-03-13 Updated: 2023-03-17 Resolved: 2023-03-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System, Protocol |
| Affects Version/s: | 10.11.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | David Rodrigues | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Description |
|
Hello, in an absurdly strange way, depending on the username sent by the package, the server sends an Auth Switch Request to another plugin. For example, suppose I send a request with the following format: {{0000 62 00 00 01 08 82 28 01 ff ff ff ff 2d 00 00 00
In this case, the user submitted is "random-user-0.5318529997882292". And it works perfectly and I get an intentional ERR Packet saying the user doesn't exist: {{0000 61 00 00 02 ff 15 04 23 32 38 30 30 30 41 63 63
However, if I send the user "random-user-0.5318529997882291" (same amount of data, I just changed the "2" at the end to "1"), the response is: {{0000 30 00 00 02 fe 63 6c 69 65 6e 74 5f 65 64 32 35
For some reason I don't know what it is, some usernames will request a different protocol than the required one, which in this case would be "mysql_native_password". |
| Comments |
| Comment by David Rodrigues [ 2023-03-16 ] |
|
I did a test with a clean install of MariaDB 10.11.2 and all works fine, without Auth Switch Request. So I found the reason. I have build the mariadb node driver and run the tests. It creates a lot of testing users. For some reason, when I try to connect and it fails, it try to connect to another users with different connection plugins, but strangely it depends on user name (as examplified before). Anyway, I just droped users and all works again. |
| Comment by Sergei Golubchik [ 2023-03-17 ] |
|
This is an intentional obfuscation feature. Imagine, all users use ed25519 plugin. Then if the server would immediately reply with an ERR packet for all non-existent users, one would be able use it to find whether a user exists. Because for an existing user it would've been "auth switch request" to ed25519. Say, you have many users with ed25519 and only one with mysql_native_password. Then one wouldn't be able to say for sure that a given username doesn't exist (because it could've been a user with mysql_native_password), but "auth switch request" would've definitely mean an existing user. MariaDB counters that by pretending that all usernames (even from non-existent users) have some auth plugin, with the same probability as for randomly selected existing user. So if 10% existing users use mysql_native_password and 90% users use ed25519, then with random user names you'll get 10% ERR packets and 90% "auth switch to ed25519" packets. And it'll leak no information about what usernames are real. And it's important to return always the same reply to a given incoming username. If the reaction would be random, sometimes ERR and sometimes "auth switch" for the same username — that would also mean that the user doesn't exist |
| Comment by David Rodrigues [ 2023-03-17 ] |
|
It's pretty confusing, but upon reflection, it's an amazing strategy indeed! |