In this walk through, we will be going through the Cross Site Scripting Reflected (JSON) vulnerability section from bWAPP Labs. We will be exploring and exploiting Reflected Cross Scripting vulnerability in JSON DOM implementations and learn how application are affected because of it. So, let’s get started with the Hacking without any delay.
Table of Contents
- Setting the security level to Low.
- The application has a search functionality which is used to search for movies in the database. It issues a GET Request to xss_json.php for this. For a True input, it shows that movies is available in the DB otherwise it shows an error that movie not available in the DB.
- Let’s check if we can contaminate the input and get our data stored in the DOM. I used the below payload where i have specified the bold HTML tag and the application parses which makes it vulnerable.
<b> Iron Man </b>
- I used a generic XSS payload and it didn’t work. On checking the source code found out that the response is in double quotes. So when it reaches our payload script tag it ended the execution of the script within the HTML page making the response incomplete, we can circumvent this by either make the statement end first and then execute our script or just don’t use altogether. I chose the latter one.
- I used the below payload to generate a pop up with the user’s cookie on mouse over on our malicious input.
<a onmouseover=alert(document.cookie)>You are Hacked !!!</a>
- Not working with the above payloads in Medium and High level.
So, we finally completed all the security levels for the bWAPP Cross Site Scripting Reflected (JSON) Vulnerability. We looked into the various ways how application has been set up in various levels and how we can bypass the security controls implemented. Reflected-XSS attacks can be mitigated by performing input sanitization on endpoints, whitelist the allowed characters in the input and using a WAF. Along with that, we can prevent data from any untrusted source to be dynamically written to the HTML document. On that note, i will take your leave and will meet you in next one with another bWAPP vulnerability writeup, till then “Keep Hacking”.