First make sure nodejs and npm are installed on your host machine. After installation, we go to the folder of the lab we want to practice. "i.e /skf-labs/XSS, /skf-labs/RFI/" and run the following commands:
$ npm install
$ npm start
Now that the app is running let's go hacking!
The application invites you to fill a website in the input box, that will be used from the "visit my website!" link to redirect to it.
If we insert https://google.com, and click on "visit my website!" we will be redirected to the Google website. As we can see in the screenshot below our input is reflected in the page inside an href attribute.
Autoescape is disabled by default so every characters will be reflected in the following snippet in the template.
<center><pstyle="font-size:2em;"><astyle="font-size:20px;"href="<%- xss %>">visit my website!</a></p></center>
Now we have seen where the user input is being reflected in the href, we can craft the payload to trigger an alert box and exploit our XSS.
and clicking the button, we achieve what we were looking for.
Please refer to the OWASP testing guide for a full complete description about cross site scripting!