Java Web Application Security
Java Web Application Security
Matt Raible
http://raibledesigns.com
@mraible
Photos by Trish - http://mcginityphoto.com
Blogger on raibledesigns.com
2013 Raible Designs
Why am I here?
Purpose
To learn more about Java webapp security and
transform myself into a security expert.
Goals
Show how to implement Java webapp security.
Show how to penetrate a Java webapp.
Show how to fix vulnerabilities.
2013 Raible Designs
Session Agenda
Security Development
Java EE 6, Spring Security, Apache Shiro
SSL and Testing
Verifying Security
OWASP Top 10 & Zed Attack Proxy
Commercial Tools and Services
Conclusion
Develop
Penetrate
2013 Raible Designs
Protect
Relax
Develop
Java EE 6
Security constraints defined in web.xml
web resource collection - URLs and methods
authorization constraints - role names
user data constraint - HTTP or HTTPS
User Realm defined by App Server
Declarative or Programmatic Authentication
Annotations Support
2013 Raible Designs
Java EE 6 Demo
http://www.youtube.com/watch?v=8bXBGU7uo4o
2013 Raible Designs
Servlet 3.0
HttpServletRequest
authenticate(response)
login(user, pass)
logout()
getRemoteUser()
isUserInRole(name)
Spring Security
Filter defined in web.xml
Separate security context file loaded by Spring
Defines URLs, Roles and Authentication Providers
Defines UserService (provided or custom)
Password Encoding
Remember Me
Securing Methods
<global-method-security secured-annotations="enabled"/>
@Secured("IS_AUTHENTICATED_ANONYMOUSLY")
public Account readAccount(Long id);
@Secured("IS_AUTHENTICATED_ANONYMOUSLY")
public Account[] findAccounts();
@Secured("ROLE_TELLER")
public Account post(Account account, double amount);
<global-method-security jsr250-annotations="enabled"/>
Apache Shiro
Filter defined in web.xml
shiro.ini loaded from classpath
[main], [urls], [roles]
Cryptography
Session Management
Ajax Login
http://raibledesigns.com/rd/entry/implementing_ajax_authentication_using_jquery
2013 Raible Designs
OAuth
Penetrate
OWASP Testing Guide and Code Review Guide
OWASP Top 10
OWASP Zed Attack Proxy
Burp Suite
OWASP WebGoat
OWASP
The Open Web Application Security Project (OWASP) is
a worldwide not-for-profit charitable organization
focused on improving the security of software.
At OWASP youll find free and open ...
Application security tools, complete books, standard
security controls and libraries, cutting edge research
http://www.owasp.org
http://raibledesigns.com/rd/entry/java_web_application_security_part4
2013 Raible Designs
7 Security (Mis)Configurations
in web.xml
1. Error pages not configured
2. Authentication &
Authorization Bypass
3. SSL Not Configured
4. Not Using the Secure Flag
http://software-security.sans.org/blog/2010/08/11/security-misconfigurations-java-webxml-files
2013 Raible Designs
7 Security (Mis)Configurations
5. Not Using the HttpOnly
Flag
6. Using URL Parameters for
Session Tracking
7. Not Setting a Session
Timeout
http://software-security.sans.org/blog/2010/08/11/security-misconfigurations-java-webxml-files
2013 Raible Designs
Protect
[SWAT] Checklist
Firewalls
IDS and IDPs
Audits
Penetration Tests
Code Reviews with Static
Analysis Tools
Firewalls
Stateless Firewalls
Stateful Firewalls
Invented by Nir Zuk at
Check Point in the mid-90s
Web App Firewalls
Inspired by the 1996 PHF
CGI exploit
WAF Market $234m in 2010
2013 Raible Designs
Gartner on Firewalls
Relax
Web App Firewalls: Imperva, F5, Breach
Open Source: WebNight and ModSecurity
Stateful Firewalls: Juniper, Check Point, Palo Alto
IDP/IDS: Sourcefire, TippingPoint
Open Source: Snort
Audits: ENY, PWC, Grant Thornton
Pen Testing: WhiteHat, Trustwave, Electric Alchemy
Open Source: OWASP ZAP
Static Analysis: Fortify, Veracode
2013 Raible Designs
Remember...
Security is a quality, and as all other quality, it is
important that we build it into our apps while we are
developing them, not patching it on afterwards like
many people do. -- Erlend Oftedal
From a comment on my blog: http://bit.ly/mjufjR
Action!
Use OWASP and Open Source Security Frameworks
Dont be afraid to contribute!
Follow the Security Street Fighter Blog
http://software-security.sans.org/blog
Use OWASP ZAP to pentest your apps
Dont be afraid of security!
Additional Reading
Securing a JavaScript-based Web Application
http://eoftedal.github.com/WebRebels2012
Michal Zalewskis The Tangled Web
http://lcamtuf.coredump.cx/tangled
Additional Resources
OWASP Denver
https://www.owasp.org/index.php/Denver
Next Meeting: Wednesday, February 20, 6-8pm
Front Range OWASP Security Conference
March 28 - 29 in Denver
David Campbell of Electric Alchemy
http://www.electricalchemy.net
2013 Raible Designs
Questions?
Contact Information
http://raibledesigns.com
@mraible
My Presentations
http://slideshare.net/mraible