In this walk through, we will be going through the Cross Site Scripting Reflected (Eval) vulnerability section from bWAPP Labs. We will be exploring and exploiting Reflected Cross Scripting vulnerability in PHP function Eval implementations and learn how application are affected because of it. So, let’s get started with the Hacking without any delay.
Table of Contents
Security: Low
- Setting the security level to Low.
- The application has a page which shows the current time and date on the user’s system. It uses eval function to do that and issues a GET request to xss_eval.php. As per the source code it writes directly to the DOM using document.write and here the date function is used which can be manipulated.
- I intercepted the request and changed the function from date to the below payload which gives us the user’s cookie in a pop-up alert.
alert(document.cookie)
Security: Medium
- Setting the security level to Medium.
- I tried the below payload again and worked.
alert(document.cookie)
Security: High
- Setting the security level to High.
- I tried the below payload again and it didn’t work instead got an “Invalid input” error as it is checking the input is date function or not. If not, it will throw the error.
Also Read: bWAPP – Cross Site Scripting Reflected (AJAX-XML)
Conclusion:
So, we finally completed all the security levels for the bWAPP Cross Site Scripting Reflected (Eval) 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”.