[MDEV-31855] validate ssl certificates using client password Created: 2023-08-05 Updated: 2024-02-05 Resolved: 2024-02-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System, Plugins, SSL |
| Fix Version/s: | 11.4.1 |
| Type: | New Feature | Priority: | Critical |
| Reporter: | Sergei Golubchik | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Preview_11.3 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Description |
|
This needs a change in the client auth plugin API
The new authentication will work like this Client side, when sending client reply packet:
Server side, when sending the OK packet after successful authentication:
Client side, when receiving OK packet:
Notes
|
| Comments |
| Comment by Daniel Lenski [ 2023-08-10 ] | ||||||||||||||||||
What security properties of the client-server connection would actually be improved by doing this? It seems to me that this will greatly complicate the MariaDB client and server code. In my opinion, it is a bad design, because it further entrenches the entangling of two logically-separate concerns:
Entangling these is an extremely bad design choice, that has already led to several security vulnerabilities and greatly complicates solving them in a clean and backwards-compatible way, including at least CONC-648, CONC-654, and MDEV-31585. I wrote at greatly length about this in a comment on CONC-648. So, I would say that it's important to step back and think about what the goal is here, in terms of improving the security properties of the system, and then think about how to achieve that in ways that reduce, rather than exacerbate, existing security vulnerabilities and design flaws. | ||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-08-10 ] | ||||||||||||||||||
|
The goal is to prevent active MitM of course by validating SSL certificates. And no, the implementation (V1) of this is quite small and simple. | ||||||||||||||||||
| Comment by Daniel Lenski [ 2023-08-16 ] | ||||||||||||||||||
The title of this JIRA is “validate ssl certificates using client password”. How is validation of the server’s SSL certificate (that's a transport-layer concern) conceivably related to the client’s MariaDB user password (that's an application-layer concern)? | ||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-09-08 ] | ||||||||||||||||||
|
in bb-11.3-serg branch, commits:
| ||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2023-09-12 ] | ||||||||||||||||||
|
OK to push (after adding coments about format of the protocol extention (SSL info)) | ||||||||||||||||||
| Comment by Daniel Lenski [ 2023-09-15 ] | ||||||||||||||||||
|
sanja wrote:
Yikes. Do you understand that serg is essentially proposing a new TLS key exchange mechanism here? Have you solicited the help of experts in cryptographic protocol design who can evaluate the security of this mechanism? If I were to provide a step-by-step explanation of how this mechanism could be attacked and the client's password stolen undetectably, would you change you mind about "okay to push"? In a comment on
Yes, I already have a detailed step-by-step attack against it. Using this attack, it is possible for a MITM to fool the client into thinking that it has connected to a server, when it has in fact connected to the MITM, and for the MITM to obtain the client's password. This attack is exacerbated by a (seemingly-unrelated) security flaw in MariaDB which has never been reported, to my knowledge. It is a very good illustration of why it is dangerous to mix authentication at different protocol layers, as I've been explaining over and over. Do you want me to explain it? | ||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-09-16 ] | ||||||||||||||||||
|
of course, if you were to provide a step-by-step explanation of how this mechanism could be attacked, we won't push this feature in this form. | ||||||||||||||||||
| Comment by Daniel Lenski [ 2023-09-18 ] | ||||||||||||||||||
|
I have already reported several practical TLS attacks against actual production MariaDB code which has existed for many years, e.g. CONC-648, CONC-654, I would describe all these bugs as "pretty obvious": I didn't set out to find TLS bugs in MariaDB, but once I started looking at the relevant code for other reasons, they started to jump out at me all over the place. I've also explained several times (e.g. comment on CONC-648 from 3 months ago how these vulnerabilities are largely a consequence of improper entanglement between different conceptually separate layers of networking protocols. This is not some very specialized knowledge: it's included in basically every guide to programming with TLS, and in many reports of previous real-world TLS vulnerabilities. What you have proposed here, serg, is yet another new entanglement between the application-layer authentication (e.g. MariaDB native password auth) and the transport-layer security mechanism (TLS), as I mentioned in a comment right above).
I am less concerned about the particular vulnerability that you are going to introduce if you merge this code, than I am with what appears to be broken or missing processes in MariaDB development. It appears that there must be little or no review of the security implications of code changes like the one proposed here. | ||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-09-19 ] | ||||||||||||||||||
|
Neither issue you mentioned above is a TLS attack, and 3 out of four are not even at "attack" as such. Thank you for confirming that you're less concerned about this particular protocol extension, supposedly it means that there is no step-by-step explanation of how this mechanism could be attacked. | ||||||||||||||||||
| Comment by Lena Startseva [ 2023-10-20 ] | ||||||||||||||||||
|
serg, please, make a small changes in test main.ssl_autoverify in cases with "- - no-defaults" option - add option "--character-sets-dir" with value otherwise on some environments I get warnings in this cases:
| ||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-10-20 ] | ||||||||||||||||||
|
Fixed, thanks | ||||||||||||||||||
| Comment by Lena Startseva [ 2024-01-23 ] | ||||||||||||||||||
|
Testing done. Ok to push |