Thursday, November 28, 2019

Do you know CSRF attack ? Lets Understand Together

What is CSRF attack ? ✊


Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

Image result for csrf


Impact : Stealing Password / Changing credentials existing logged user 



 How it will be done?


 1. I am simulating this scenario in my internal Lab setup.

 2. I have already setup which is vulnerable to CSRF( cross site scripting request forgery )

 












3.First create the  New user , i have created for testing purpose as  username raj and password as test@xxxx



4.Try to login with created account, remember this user password was test@xxx









5.Now test that web app is really vulnerable for XSS attacks , i found by simple script that it was vulnerable to XSS reflected attack.




6. Now we know webapplication is vulnerable and target the user whom we want to attack.

Note : User must be already logged in that webapplication

7.Now i am writing simple java script that will be executed from browser end and executes when ever user click on it.

<form action="http://192.168.56.103/bWAPP/csrf_1.php" method="GET">
        
        <p><label for="password_new">New password:</label><br />
        <input type="password" id="password_new" name="password_new" value="nasagoni"></p>

        <p><label for="password_conf">Re-type new password:</label><br />
        <input type="password" id="password_conf"  name="password_conf" value="nasagoni"></p>            <button type="submit" name="action" value="change">Change</button>   

    </form>

8.Send the above link to targeted user .(in values feild keep which password you want to keep )



9. Thats all when ever user click it will be redirected to our script page executes , now user password gets changed (as you kept in user value feild)

10. See below screen says password get changed




11.Now you can  do chnages to Raj  account , transfer money if it a bank application :-)
12👐👐✊✊✊✊.Hope you now familiar with this attack

Happy Hacking :0