owasp khartoum - top 10 a5 - 7th meeting - cross site request forgery

19
OWASP Khartoum owasp.org/index.php/Khar Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. 7 TH Meeting University of Ba TOP 10#A5 Cross Site Request Forgery Obay Osman OWASP Khartoum 15 Sept 2012

Upload: owasp-khartoum

Post on 25-May-2015

611 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

OWASP Khartoumowasp.org/index.php/Khartoum

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

7TH Meeting Univers i ty o f Bahr i

TOP 10#A5 Cross Site Request Forgery

Obay OsmanOWASP Khartoum

15 Sept 2012

Page 2: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

ToC• Definition.

• OWASP Rating.

• Attack Scenarios.

• CSRF in the wiled.

• Demo time.

• Detection

• Protection.

• Summery & Discussion.2

Page 3: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

DefinitionA CSRF attack is forcing a logged-on

victim’s browser to send a forged HTTP request, including the victim’s session cookie and any other automatically included authentication information, to a vulnerable web application.

Synonyms: XSRF, "Sea Surf", Session Riding, Cross-Site Reference Forgery, Hostile Linking, One-Click (Microsoft).

3

Page 5: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

5

Attack Scenarios

http://bank.com/app/transferFunds?amount=1500&destinationAccount=4673243243

<img src= "http://bank.com/app/transferFunds?amount=1500&destinationAccount=attackersAcct#“ width="0" height="0" />

User:

Attacker:

Page 6: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

6

#1

Page 7: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

7

#2

Page 8: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

It is Demo Time..

9

Let us break something…

Page 9: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

In the wield..- Firewall web management.

- Stored CSRF flaws.(Self-vulnerable applications)

- Sammy Worm.

Methodologies: XSS, Social Engineering….

10

Page 10: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

11

DetectionCode Review:

• see if each link and form contains an unpredictable token for each user.

• focus on state-changing functions.

• check multistep transactions.

PenTesting:

• Manual Testing.

• OWASP’s CSRF Tester tool.

Page 11: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

Protection[Developers]

• Check referrer, Really help?!(open redirect/HTTPS/subdomains)

• Double Submit Cookies.

• Challenge-Response. (CAPTCHA/Re-Authentication)

• Put unique token in the URL/URL parameter.

• Include the unique token (per request/session) in a hidden field.

12

No XSS & Share a ‘Secret’ With The User.

Page 12: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

13

Protection[Tokens]

Good Tokens:

Nonce:

One-time cryptographically random token that is returned to the client per request.

HMAC:

#(PageUrl+Session/userID+Timestamp)

(eg In .net encrypted ‘ViewState’)

Page 13: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

14

Protection [Defense in depth]

Do not use GET parameters.

Do not put the secret in the URL/Cookies.(log/history/referer exposure,!)

Send successful logins to a well-known location instead of automatic redirection.(Top10 A10)

Do not resubmit POST parameters if you need to perform redirection.

Page 14: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

15

Protection [Users]

Logoff immediately after using a web application

Do not allow your browser to save username/passwords, and do not allow sites to “remember” your login

Do not use the same browser to access sensitive applications and to surf freely the Internet.

Be careful when clicking untrusted Links.

Page 15: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

OWASP’s Tools

OWASP’s CSRF Guard can be used to automatically include such tokens in your Java EE, .NET, or PHP application.

OWASP’s ESAPI token generators and validators.

+ OWASP’s CSRF Tester.

16

Page 16: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

Summary & Conclusion

Page 17: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

A1 –InjectionA2 –Cross-Site Scripting (XSS)A3 –Broken Authentication and Session ManagementA4 –Insecure Direct Object ReferenceA5 –Cross Site Request Forgery (CSRF)A6 –Security Misconfiguration(NEW)A7 –Insecure Cryptographic StorageA8 –Failure to Restrict URL AccessA9 –Insufficient Transport Layer ProtectionA10 –Unvalidated Redirects and Forwards (NEW)

OWASP Top 10 2010:

Page 19: OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery

Q & A

20