I came across a scenario, where userinput is reflecting in anchor tag href value. So if i put test there it reflects as <a href="/test">
Due to this default slash added in the code, javascript:alert(1)
will not execute since, it will be treated as URL. Also "
is not allowed and gives 400.
In this case, is there a possibility to bypass the check, or any way to XSS.
1 Answer
For the sake of keeping things simple, let's assume that you cannot break out of the href
attribute and that your input is always prefixed by a /
. Unfortunately, there is not trivial bypass for this scenario since as you pointed out, the /
renders your payload harmless.