Monday, 21 March 2016

OWASP : Cross Site Request Forgery

Cross Site Request Forgery:
  1. Here attacker studies the website functionality.
  2. After studying the functionality attacker can create similar page with same functionality but changes the values of attributes/parameters. 
  3. Here victim user should be already logged into intended website, that is they should already have active session.
  4. Victim should already be logged into the web application then only this vulnerability will work.
Identifying CSRF Vulnerability:
  1. Study the web application functionalities.
  2. Below are some of the functionalities where CSRF may be possible:
  • Change passwords
  • Transfer money
  • Add users
  • Delete users
  • Change roles
  • Post data on behalf of users
How to avoid CSRF:
Use CSRF Token


  1. In DVWA (Damn Vulnerable Web Application) Attacker can go through change password functionality.
  2. We can see that when we try to change password, password can be visible in clear text in URL
  3. http://192.168.0.7/vulnerabilities/csrf/?password_new=abcd&password_conf=abcd&Change=Change#
  4. Now we can change the password value in URL i.e craft the URL and send it to victim user who is already logged into same application.
  5. As mentioned below we changed the password value to new value.
  6. http://192.168.0.7/vulnerabilities/csrf/?password_new=dddd&password_conf=dddd&Change=Change#
  7. Here we have created new HTML page in linux ubuntu
  8. Type notepad in command prompt.
  9. Enter below html text in notepad, i.e. change password value in it and enter forged URL in anchor tag of HTML Save it as html page
  10. <html>
    <body>

    <a href="192.168.0.7/vulnerabilities/csrf/?password_new=dddd&password_conf=dddd&Change=Change#"> Click Here </a>

    </body>
    <html>
  11. Save this forged html page in attacker's domain /var/www
  12. /var/www - here web pages are hosted in linux so that anyone will be able to open web pages in their browser by typing the address.
  13. Provide this link to victim user, who is already logged into DVWA.
  14. Once user clicks on that link his password will be changed , that is without knowledge of victim.



     

No comments:

Post a Comment