13.17 Lab: Stored XSS into anchor href attribute with double quotes HTML-encoded | 2024

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 | Karthikeyan Nagaraj

Karthikeyan Nagaraj
2 min readMar 22, 2024

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.

Solution

  1. Post a comment with a random alphanumeric string in the “Website” input, then use Burp Suite to intercept the request and send it to Burp Repeater.
  2. Make a second request in the browser to view the post and use Burp Suite to intercept the request and send it to Burp Repeater.
  3. Observe that the random string in the second Repeater tab has been reflected inside an anchor href attribute.
  4. Repeat the process again but this time replace your input with the following payload to inject a JavaScript URL that calls alert:
    javascript:alert(1)
  5. Verify the technique worked by right-clicking, selecting “Copy URL”, and pasting the URL in the browser. Clicking the name above your comment should trigger an alert.

--

--

Karthikeyan Nagaraj

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