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 session cookie, then use this cookie to impersonate the victim.
Approach
After accessing the lab, I went straight to the comment section and intercepted a request for writing a comment. I started by injecting some HTML tags into all the parameters to see if they would be reflected and executed.
The HTML tags were rendered correctly in the comment section, indicating that the input wasn't sanitized and the parameter was vulnerable to Cross-Site Scripting (XSS).
Next, I injected a malicious script to steal the cookie of anyone who views my comment and send it back to me via Burp Collaborator. The payload I used was:
After submitting the comment, I went to the Burp Collaborator tab and clicked Poll now. I saw some requests and upon checking the HTTP request, I clicked on Request to collaborator to view the details. I found the following request:
This request contained the victim's cookies. By going to the home page, pressing F12 to open the developer tools, navigating to the storage tab, and then to cookies, I replaced the value of my current session cookie with the victim's session cookie. After reloading the page, I was logged in as the administrator. This solved the lab.