bWAPP - Cross Site Scripting Reflected (Eval)

bWAPP – Cross Site Scripting Reflected (Eval)

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.

Cross Site Scripting Reflected (Eval)

Security: Low

  • Setting the security level to Low.

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

Eval

Page source code

Burpsuite intercept

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

Burpsuite intercept payload

Cookie pop up alert

Security: Medium

  • Setting the security level to Medium.

Security level Medium

  • I tried the below payload again and worked.

alert(document.cookie)

Burpsuite intercept

Cookie pop up alert

Security: High

  • Setting the security level to High.

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

Burpsuite intercept

Invalid Input detected

Page source code

Also Read: bWAPP – Cross Site Scripting Reflected (AJAX-XML)

Conclusion:

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

Leave a Comment

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

Scroll to Top