Post

PortSwiggerlabs: Stored XSS into anchor href attribute with double quotes HTML-encoded

PortSwiggerlabs: Stored XSS into anchor href attribute with double quotes HTML-encoded

Information :

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 :

First we submit a normal comment to see how the app behaves :

image

Once we submit it we’re redirected to this page :

image

If we go back to check all the comments :

image

Everything looks normal , but when we specify a website inside the comment :

image

Now if we check the code :

image

We see that our website is directly injected inside the href , while href is mainly used for redirections , we can also specify a different URL scheme other than HTTP,HTTPS,ftp://,etc… , which is javascript:

So our payload will simply be :

1
javascript:alert(XSSS)

image

Now if we follow the redirection , and then go back to the post :

image

As soon as we submit our payload :

We will see that the lab is solved .

image

This happened bcs developpers allowed us to inject arbitrary links to the app , which can usually be abused to execute JS code as well directly .

That was all for this lab , see you in the next one :)

This post is licensed under CC BY 4.0 by the author.