9 Ways To Hack A Web Application
9 Ways To Hack A Web Application
Source: www.owasp.org
2005 JavaOneSM Conference | Session TS-5935 | 10
#1: Unvalidated Input
• Attacker can easily change any part of the
HTTP request before submitting
– URL
– Cookies
– Form fields
– Hidden fields
– Headers
• Input must be validated on the server
• Countermeasures
– Code reviews (check variable against list of allowed
values, not vice-versa)
– Don’t accept unnecessary input from user
– Store in session or trusted back-end store
– Sanitize input with regex
login.jsp
<form method="POST" action= "j_security_check" >
<input type="text" name= "j_username" >
<input type="password" name= "j_password" >
</form>
2005 JavaOneSM Conference | Session TS-5935 | 19
#3: Broken Account and Session Management
• Weak user authentication
– Password-only
– Easily guessable usernames (admin, etc.)
– Poorly implemented single sign-on (SSO)
• Weak resource authentication
– How are database passwords stored?
• Could it be disclosed via browser?
– Using IP to authenticate?
• Can be spoofed
• Countermeasures
– Use vetted single sign-on and session
mgmt solution
– Netegrity SiteMinder
– RSA ClearTrust
– Strong passwords
– Remove default user names
– Protect sensitive files
2005 JavaOneSM Conference | Session TS-5935 | 20
What’s wrong with this picture?
String query =
+ req.getParameter(“ACCT_NUM”) + “’”;
try {
connection = DatabaseUtilities.makeConnection(s);
} // end while
} catch (Exception e) {
} // end catch
} // end doPost
References
• Top 10 Web Application Vulnerabilities
• OWASP
• Innocent Code, by Sverre H. Huseby
Tools used in this preso
• WebGoat – vulnerable web applications for demonstration
• VMWare – runs Linux & Windows 2000 virtual machines on demo laptop.
• nmap – host/port scanning to find vulnerable hosts
• Mozilla Firefox – browser that supports plug-ins for proxied HTTP, source
browsing
• SwitchProxy plug-in lets you quickly switch your proxies
• WebDeveloper plug-in lets you easily clear HTTP auth
• WebScarab – HTTP proxy