gpt4 book ai didi

mysql - mysql协议(protocol)中的身份验证有多安全?

转载 作者:可可西里 更新时间:2023-11-01 06:32:19 24 4
gpt4 key购买 nike

我的用户正在使用 MS Access 和 ODBC 连接器连接到我的远程 MySQL 数据库。我想知道这有多安全,就可能向第三方泄露密码而言。 mysql 协议(protocol)身份验证对窃听甚至中间人攻击是否安全?我会对防止窃听的安全性感到非常满意。请注意,我只关心身份验证,我不关心数据泄露。

请不要回复说我应该使用 SSL。我知道这将是理想的,但设置似乎并不简单。无论如何,我想知道普通 mysql 协议(protocol)的安全级别是多少。

最佳答案

您想“安全地防止窃听甚至中间人攻击”是什么?您的密码,还是您的数据?

您的问题标题专门提到了身份验证。 MySQL 在保护您的密码免遭窃听方面做了合理的工作(它不是明文发送的,并且使用 nonce 可以阻止重放攻击)。引用 MySQL protocol internals :

MySQL 4.1 and later

Remember that mysql.user.Password stores SHA1(SHA1(password))

  • The server sends a random string (scramble) to the client
  • the client calculates:
    • stage1_hash = SHA1(password), using the password that the user has entered.
    • token = SHA1(scramble + SHA1(stage1_hash)) XOR stage1_hash
  • the client sends the token to the server
  • the server calculates
    • stage1_hash' = token XOR SHA1(scramble + mysql.user.Password)
  • the server compares SHA1(stage1_hash') and mysql.user.Password
  • If they are the same, the password is okay.

(Note SHA1(A+B) is the SHA1 of the concatenation of A with B.)

This protocol fixes the flaw of the old one, neither snooping on the wire nor mysql.user.Password are sufficient for a successful connection. But when one has both mysql.user.Password and the intercepted data on the wire, he has enough information to connect.

然而,经过身份验证的 session 以明文形式继续:窃听者将能够看到所有查询和结果;并且 MITM 将能够对其进行更改。如 the manual 中所述:

By default, MySQL uses unencrypted connections between the client and the server. This means that someone with access to the network could watch all your traffic and look at the data being sent or received. They could even change the data while it is in transit between client and server.

虽然您可能不喜欢这个答案,但 SSL 是工具,旨在阻止数据窃听(通信还可以如何加密?)和 MITM 攻击(任何一方还可以如何验证其peer 是它认为的那个人?)。事实上,如果 mysql 客户端-服务器协议(protocol)单独战胜了这些威胁,那么就没有理由通过 SSL 使用 mysql(因此它不太可能成为受支持的配置)。

关于mysql - mysql协议(protocol)中的身份验证有多安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11192689/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com