bWAPP - Cross Site Scripting Reflected (JSON)

bWAPP – Cross Site Scripting Reflected (JSON)

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.

Cross Site Scripting Reflected (JSON)

Table of Contents

Security: Low

  • Setting the security level to Low.

Security level 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.

XSS - Reflected (JSON)

Burpsuite intercept

Movie found

Movie not found

  • 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>

HTML Injection Confirmed

  • 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.

Page source code

  • 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>

Payload

cookie pop up alert

  • Not working with the above payloads in Medium and High level.

Also Read: bWAPP – Cross Site Scripting Reflected (Eval)

Conclusion:

Conclusion

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”.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top