- In your /etc/hosts file, add
127.0.0.1 child.window parent.window
- Clone the directory and cd into it.
- Run
python -m SimpleHTTPServer
- Go to http://parent.window:8000/parent to test the 2 added vulnerabilities.
Two vulnerabilities have been added, namely:
- Sender's origin not verified.
- targetOrigin not specified.
If you go through the JS code of the pages, you will see that the following vulnerabilities exist:
- In lab 1, a message is sent from the main application (parent window) to the contact form (child window). This message contains the user's personal details from the parent window, and populates the contact form. Your goal here is to achieve XSS by sending a malicious message to window containing the contact form.
- In lab 2, the message is sent from the child window to the parent window. The message here takes the login details (from the child window) and posts it to the parent window. Your goal here is to setup an attacker website which will steal the login details of the user from the aforementioned login page.
To exploit both these vulnerabilities:
- Add your custom entry in /etc/hosts eg.
127.0.0.1 attacker.window
. - Make a new directory and add your HTML page with the JS exploit.
- With the above simpleHTTPServer already running, run
python -m SimpleHTTPServer <port-here>
- Go to http://attacker.window:/ and access your exploit page.
The complete exploit demonstration can be viewed from Farah Hawa's youtube video for postMessage().