Web Security Overview and Demo

Post on 13-May-2015

4.253 views 0 download

Tags:

Transcript of Web Security Overview and Demo

Web Application Security

Presented by Tony BibbsOctober 9, 2008

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

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.”

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.”

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

XHR

XHR

document, cookies

TAG

TAG

JS

bank.com

blog.net

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

tony.bibbs@iowa.gov(515)281-6125

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.