web security overview and demo

19
Web Application Security Presented by Tony Bibbs October 9, 2008

Upload: tony-bibbs

Post on 13-May-2015

4.253 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Web Security Overview and Demo

Web Application Security

Presented by Tony BibbsOctober 9, 2008

Page 2: Web Security Overview and Demo

Rasmus Lerdorf

“The Web is broken and it's all your fault.”

Page 3: Web Security Overview and Demo

“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

Page 4: Web Security Overview and Demo

Common Coding Vulnerabilities

Injection Flaws (SQL, LDAP, XPath, etc) Cross Site Scripting (XSS) Cross Site Request Forgeries (CSRF) Buffer Overflows

Page 5: Web Security Overview and Demo

Injection Flaws

“SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.”

Page 6: Web Security Overview and Demo

Cross Site Scripting (XSS)

“Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. An exploited cross-site scripting vulnerability can be used by attackers to bypass access controls such as the same origin policy. Vulnerabilities of this kind have been exploited to craft powerful phishing attacks and browser exploits. As of 2007, cross-site scripting carried out on websites were roughly 80% of all documented security vulnerabilities.”

Page 7: Web Security Overview and Demo

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.

Page 8: Web Security Overview and Demo

“Same Origin” Policy

XHR

XHR

document, cookies

TAG

TAG

JS

bank.com

blog.net

Page 9: Web Security Overview and Demo

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>

Page 10: Web Security Overview and Demo

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

Page 11: Web Security Overview and Demo

Trivial CSRF Exploit

Page 12: Web Security Overview and Demo

Exploiting Otherwise Secure Networks

Page 13: Web Security Overview and Demo

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.

Page 14: Web Security Overview and Demo

Framework-based Security

Framework implementations force security precautions.

PHP Examples: Flexy, Tainted Variables CSRF prevention in PHP framework.

Page 15: Web Security Overview and Demo

CSRF Resources

CSRFGuard (Java, .NET and PHP) CSRTTester

Page 16: Web Security Overview and Demo

Enterprise CSRF Mitigation

Page 17: Web Security Overview and Demo

Questions?

Page 18: Web Security Overview and Demo

Contacting Me

[email protected](515)281-6125

Page 19: Web Security Overview and Demo

Credits

Download this presentation and sample code from here.

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.