PortSwigger

Description
This lab contains a stored cross-site scripting vulnerability in the comment functionality. To solve this lab, submit a comment that calls the alert function when the comment author name is clicked.
Solve Steps
Step 1: Identify Vulnerability
-
- Access the Lab and input any alphabetic character in the comment section
- Using DevTools, check where the input is saved

Step 2: Break test
- try simple payload:
test"123 - check where the input is save and HTML break

It means :
- No input sanitize
- Vulnerability chance HIGH
Step 3: Construct the Payload
Since you’re inside an href attribute, you can use the javascript: pseudo-protocol:
Enter this in the Website field:
javascript:alert(1)


Step 4: Test the Exploit
- Post the comment with the payload
- View the blog post
- Click on the author name above your comment
- The alert pops up

Step 5: Solve the Lab
Once the alert appears when clicking the author name, the lab is marked as Solved.

Important Note
Unlike onmouseover or onclick events, javascript: URIs in href attributes execute when the link is clicked, not automatically. The user must click the author name.