【发布时间】:2017-07-11 11:50:21
【问题描述】:
这是一个 XSS 游戏网页来进行 XSS 攻击。而关于第1级,我对表单是如何提交的,动作是空白的,那么是什么让提交按钮起作用呢? http://www.xssgame.com/f/m4KKGHi2rVUN/? 它的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代码没有包含可以接收提交的代码,还是因为chrome控制台的Sources不会显示所有代码?
【问题讨论】:
-
您的按钮工作因为它在
form内。顺便说一句,如果<form action="">为空,则表示数据将发送到当前文件。 -
只需从提交切换到其他类型
标签: javascript html forms submit-button