SlideShare a Scribd company logo
Presented by Tony Bibbs May 20, 2008 Cross Site Request Forgeries
Rasmus Lerdorf “ The Web is broken and it's all your fault.”
“ There is no metric for compliance with a 'culture', and a 'culture of security' is overridden by a culture of 'get the job done' every time.” Jon Espenschied
Common Coding Vulnerabilities Injection Flaws (SQL, LDAP, XPath, etc)‏ Cross Site Scripting (XSS)‏ Cross Site Request Forgeries (CSRF)‏ Buffer Overflows
CSRF Defined Cross-site request forgery, also known as one click attack, sidejacking or session riding and abbreviated as CSRF (Sea-Surf) or XSRF, is a type of malicious exploit of websites. Although this type of attack has similarities to cross-site scripting (XSS), cross-site scripting requires the attacker to inject unauthorized code into a website, while cross-site request forgery merely transmits unauthorized commands from a user the website trusts.
“ Same Origin” Policy document, cookies bank.com blog.net XHR XHR TAG TAG JS
How CSRF Works GET requests are the easiest: - Beware “src” and “href” attributes POST aren't immune: <body onload=”document.forms[0].submit()”> <form method=”POST” action=”_url_”> <input type=”hidden” name=”amount” value=”$1,000” /> </form>
What Can a Hacker Do With CSRF? Anything  an authenticated user can do. Click links, submit forms, complete multi-step wizards. Launch external attacks on Intranet sites. No restrictions on same origin policy but are limited in that hackers can't read responses from other origins
Trivial CSRF Exploit
Exploiting Otherwise Secure Networks
CSRF Prevention Avoid Persistent Sessions Use GET method properly Token-based checks with TTL. Double Authenticate via AJAX (read cookie via JS and submit in the body). Code reviews.
Framework-based Security Framework implementations force security precautions. PHP Examples: Flexy, Tainted Variables CSRF prevention in PHP framework.
CSRF Resources CSRFGuard (Java, .NET and PHP)‏ CSRTTester
Enterprise CSRF Mitigation
Questions?
Contacting Me [email_address] (515)281-6125
Credits Some material in this presentation is covered by the OWASP license, specifically work by Eric Sheridan Any of my own contributions are also covered by the OWASP license which can be found at http://www.owasp.org.

More Related Content

Cross Site Request Forgery

  • 1. Presented by Tony Bibbs May 20, 2008 Cross Site Request Forgeries
  • 2. Rasmus Lerdorf “ The Web is broken and it's all your fault.”
  • 3. “ There is no metric for compliance with a 'culture', and a 'culture of security' is overridden by a culture of 'get the job done' every time.” Jon Espenschied
  • 4. Common Coding Vulnerabilities Injection Flaws (SQL, LDAP, XPath, etc)‏ Cross Site Scripting (XSS)‏ Cross Site Request Forgeries (CSRF)‏ Buffer Overflows
  • 5. CSRF Defined Cross-site request forgery, also known as one click attack, sidejacking or session riding and abbreviated as CSRF (Sea-Surf) or XSRF, is a type of malicious exploit of websites. Although this type of attack has similarities to cross-site scripting (XSS), cross-site scripting requires the attacker to inject unauthorized code into a website, while cross-site request forgery merely transmits unauthorized commands from a user the website trusts.
  • 6. “ Same Origin” Policy document, cookies bank.com blog.net XHR XHR TAG TAG JS
  • 7. How CSRF Works GET requests are the easiest: - Beware “src” and “href” attributes POST aren't immune: <body onload=”document.forms[0].submit()”> <form method=”POST” action=”_url_”> <input type=”hidden” name=”amount” value=”$1,000” /> </form>
  • 8. What Can a Hacker Do With CSRF? Anything an authenticated user can do. Click links, submit forms, complete multi-step wizards. Launch external attacks on Intranet sites. No restrictions on same origin policy but are limited in that hackers can't read responses from other origins
  • 11. CSRF Prevention Avoid Persistent Sessions Use GET method properly Token-based checks with TTL. Double Authenticate via AJAX (read cookie via JS and submit in the body). Code reviews.
  • 12. Framework-based Security Framework implementations force security precautions. PHP Examples: Flexy, Tainted Variables CSRF prevention in PHP framework.
  • 13. CSRF Resources CSRFGuard (Java, .NET and PHP)‏ CSRTTester
  • 17. Credits Some material in this presentation is covered by the OWASP license, specifically work by Eric Sheridan Any of my own contributions are also covered by the OWASP license which can be found at http://www.owasp.org.