這是一個用於XSS攻擊的XSS遊戲網頁。關於第一級,我對錶單的提交方式有疑問,操作是空白的,那麼提交按鈕的作用是什麼? http://www.xssgame.com/f/m4KKGHi2rVUN/? 它的HTML代碼:HTML表單標記操作屬性爲空,但提交按鈕仍然有效?
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #ffffff;
}
</style>
<script src="/static/js/js_frame.js"></script>
</head>
<body>
<center>
<img src="/static/img/foogle.png">
<br>
<form action="" method="GET">
<input id="demo2-query" name="query" value="Enter query here..."
onfocus="this.value=''">
<input id="demo2-button" type="submit" value="Search">
</form>
</center>
</body>
</html>
和js_frame.js文件是:
top.postMessage({url:window.location.toString()},"*");var originalAlert=window.alert;
window.alert=function(b){function a(){document.getElementById("next_level")?originalAlert("Congratulations, you executed an alert:\n\n"+b+"\n\nYou can now advance to the next level."):originalAlert("You executed an alert, but the server side validation of your solution failed. It probably means that your solution requires user interaction, or is not generic enough to work for a different user. Please try to make it work without user interaction and generic enough so that it works for any user.")}console.log("solved");
top.postMessage("success","*");"onvalidationready"in window?window.onvalidationready=a:setTimeout(a,0)};
補充:我看到HTML代碼不包括可接收的代碼提交,或者是因爲鉻控制檯的來源不會顯示所有的代碼?
你的按鈕工作,因爲它是'form'內。順便說一句,如果'
只需從提交切換到其他類型即可 – pkolawa