Cross-Site Request Forgery: Collin Jackson
Cross-Site Request Forgery: Collin Jackson
Collin Jackson
Outline
Classic CSRF
Server-side Defenses
Advanced Attacks
Proposals for client-side changes
Data export
Many ways to send information to other
origins
<formaction="http://www.b.com/">
<inputname="data"type="hidden"value="hello">
</form>
<imgsrc="http://www.b.com/?data=hello"/>
Cookie: SessionID=523FA4cd2E
User credentials
DEFENSES
CSRF Defenses
Secret Validation Token
<inputtype=hiddenvalue=23a3af01b>
Referer Validation
Referer:http://www.facebook.com/home.php
Session-dependent token
ftp://attacker.com/attack.html
data:text/html,<html></html>
javascript:'<html></html>'
Strict Validation Problems
Some sites allow users to post forms
XSS sanitization doesn't include <form>
These sites need another defense
Attackers
credentials
Payments Login CSRF
Payments Login CSRF
Payments Login CSRF
Payments Login CSRF
Rails vs. Login CSRF
Login CSRF Fails
CLIENT-SIDE DEFENSES
Can browsers help with CSRF?
HTTP Headers
Identify the source of requests
Change Referer header or add a new Origin header
Send more information for POST than GET
Experiment: Cross-domain POSTs out of firewall accounted for
~0.0001% of traffic
Problem: Unsafe GET requests
Problem: Third-party content within an origin
Problem: How to handle redirects
Same-origin-only cookies
Doesn't help multi-domain sites: amazon.com and amazon.co.uk
These sites could use other defenses
Conclusion
No easy solution
User does not need to have an existing session for attacks to work
Hard to retrofit existing applications with defenses