Enterprise Security API (ESAPI) Java Java User Group San Antonio. Jarret Raim June 3 rd, 2010



Similar documents
Don t Write Your Own Security Code The Enterprise Security API Project OWASP. The OWASP Foundation

Building & Measuring Security in Web Applications. Fabio Cerullo Cycubix Limited 30 May Belfast

Points of View. CxO s point of view. Developer s point of view. Attacker s point of view

OWASP Enterprise Security API (ESAPI)

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

Criteria for web application security check. Version

elearning for Secure Application Development

DISA's Application Security and Development STIG: How OWASP Can Help You. AppSec DC November 12, The OWASP Foundation

Intrusion detection for web applications

Development. Resilient Software. Secure and. Mark S. Merkow Lakshmikanth Raghavan. CRC Press. Taylor& Francis Croup. Taylor St Francis Group,

Where every interaction matters.

Top Ten Web Application Vulnerabilities in J2EE. Vincent Partington and Eelco Klaver Xebia

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

Magento Security and Vulnerabilities. Roman Stepanov

Enterprise Application Security Workshop Series

Check list for web developers

Web application security

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Web Application Guidelines

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

Web Application Security

Adobe Systems Incorporated

Web Application Security Guidelines for Hosting Dynamic Websites on NIC Servers

Columbia University Web Security Standards and Practices. Objective and Scope

Sitefinity Security and Best Practices

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

JVA-122. Secure Java Web Development

05.0 Application Development

The Top Web Application Attacks: Are you vulnerable?

What is Web Security? Motivation

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

Using Foundstone CookieDigger to Analyze Web Session Management

Secure development and the SDLC. Presented By Jerry

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Architectural Design Patterns. Design and Use Cases for OWASP. Wei Zhang & Marco Morana OWASP Cincinnati, U.S.A.

OWASP Secure Coding Practices Quick Reference Guide

Web Application Penetration Testing

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

OWASP Top Ten Tools and Tactics

Attack Vector Detail Report Atlassian

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Sichere Software- Entwicklung für Java Entwickler

OWASP TOP 10 ILIA

Web Application Security Assessment and Vulnerability Mitigation Tests

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

Introduction:... 1 Security in SDLC:... 2 Penetration Testing Methodology: Case Study... 3

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

Nuclear Regulatory Commission Computer Security Office Computer Security Standard

How We Implemented Security in Agile for 20 SCRUMs- and Lived to Tell

Chapter 1 Web Application (In)security 1

Columbia University Web Application Security Standards and Practices. Objective and Scope

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Implementation of Web Application Firewall

Top 10 Web Application Security Vulnerabilities - with focus on PHP

Security features of ZK Framework

Security vulnerabilities in new web applications. Ing. Pavol Lupták, CISSP, CEH Lead Security Consultant

Certified Secure Web Application Security Test Checklist

Still Aren't Doing. Frank Kim

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Application Security Vulnerabilities, Mitigation, and Consequences

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Testing the OWASP Top 10 Security Issues

Application Security. Petr Křemen.

How To Protect A Web Application From Attack From A Trusted Environment

Web Application Firewall on SonicWALL SSL VPN

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Web Application Vulnerability Testing with Nessus

Validation Procedure. ANNEX 4. Security Testing Basis

Overview of the Penetration Test Implementation and Service. Peter Kanters

WHITE PAPER FORTIWEB WEB APPLICATION FIREWALL. Ensuring Compliance for PCI DSS 6.5 and 6.6

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Cloud Security Framework (CSF): Gap Analysis & Roadmap

Spigit, Inc. Web Application Vulnerability Assessment/Penetration Test. Prepared By: Accuvant LABS

Rational AppScan & Ounce Products

Certified Secure Web Application Secure Development Checklist

WHITE PAPER. FortiWeb Web Application Firewall Ensuring Compliance for PCI DSS 6.5 and 6.6

(WAPT) Web Application Penetration Testing

WEB APPLICATION SECURITY

Passing PCI Compliance How to Address the Application Security Mandates

Web Application Firewall on SonicWALL SRA

Automatic vs. Manual Code Analysis

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

Promoting Application Security within Federal Government. AppSec DC November 13, The OWASP Foundation

Information Supplement: Requirement 6.6 Code Reviews and Application Firewalls Clarified

Web Application Security

Thick Client Application Security

Essential IT Security Testing

APPLICATION SECURITY AND ITS IMPORTANCE

Application Layer Encryption: Protecting against Application Logic and Session Theft Attacks. Whitepaper

Web Security Testing Cookbook*

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

Hardening Moodle. Concept and Realization of a Security Component in Moodle. a project by

Transcription:

Enterprise Security API (ESAPI) Java Java User Group San Antonio Jarret Raim June 3 rd, 2010

What is it? ESAPI (The OWASP Enterprise Security API) is a free, open source, web application security control library that makes it easier for programmers to write lower-risk applications. The ESAPI libraries are designed to make it easier for programmers to retrofit security into existing applications. The ESAPI libraries also serve as a solid foundation for new development.

Who cares?

How Does it Work? Allowing for language-specific differences, all OWASP ESAPI versions have the same basic design: There is a set of security control interfaces. They define for example types of parameters that are passed to types of security controls. There is a reference implementation for each security control. The logic is not organization specific and the logic is not application specific. An example: string based input validation. There are optionally your own implementations for each security control. There may be application logic contained in these classes which may be developed by or for your organization. An example: enterprise authentication.

There are several supported languages Java EE PHP Classic ASP.NET Coldfusion Python JavaScript Haskell Force.com And they have a plan. Maybe.

Tyranny of Choice Write Spring Custom Java Jasypt Java Code Pattern URL Commons xml-enc EncoderLog4j Validator Cryptix JAAS JCE ACEGI Stinger Struts BouncyCastle Reform Anti-XSS Many xml-dsig HDIV Java Logging More Standard Control

Vulnerability Theory Threat Agent Vector Vulnerability Control Technical Impact Business Impact Vector Business Impact Vector Vulnerability Control Vector Vulnerability Missing Control Asset Business Impact Vector Vulnerability Function Business Impact Asset Vector Vulnerability Control

Where do Vulnerabilities Come From? Missing Controls Lack of encryption Failure to perform access control Broken Controls Weak hash algorithm Fail open Ignored Controls Failure to use encryption Forgot to use output encoding ESAPI Solves Missing Broken Process Solves Ignored

Authenticator User AccessController AccessReferenceMap Validator Encoder HTTPUtilities Encryptor EncryptedProperties Randomizer Exception Handling Logger IntrusionDetector SecurityConfiguration Custom Enterprise Web Application Enterprise Security API Existing Enterprise Security Services/Libraries

Encoder Typical output in most web frameworks leads to XSS and CSRF vulnerabilities. The ESAPI encoder allows direct encoding depending on context. Web (HTML, JavaScript, CSS) Databases (MySQL, Oracle) URL Shells (Unix, Windows) XML LDAP Also provides a canonnicalize method to remove any encodings. <p>hello, <%=name%></p> <p>hello, <%=ESAPI.encoder().encodeForHTML(name)%> </p>

User Controller Business Functions Data Layer Backend isvalidcreditcard isvaliddatafrombrowser isvaliddirectorypath isvalidfilecontent isvalidfilename isvalidhttprequest isvalidlistitem isvalidredirectlocation isvalidsafehtml isvalidprintable safereadline encodeforjavascript encodeforvbscript Validator Encoder encodeforurl Canonicalization Double Encoding Protection Sanitization Normalization encodeforhtml encodeforhtmlattribute encodeforldap encodefordn encodeforsql encodeforxml encodeforxmlattribute encodeforxpath

Validator EXAMPLE: <script>alert(document.cookie)</script> ESAPI.validator().getValidInput(String context,string input,string type,int maxlength,boolean allownull,validationerrorlist errorlist) assertisvalidhttprequest() assertisvalidhttprequestparameterset() assertisvalidfileupload() getvalidcreditcard() getvaliddate() getvaliddirectorypath() getvaliddouble() getvalidfilecontent() getvalidfilename() The Validator interface defines a set of methods for canonicalizing and validating untrusted input. Returns booleans as not all validation problems are security issues. Invalid input will generate a descriptive ValidationException which will be stored in the ValidationErrorList Input that is clearly an attack will generate a descriptive IntrusionException

Validator Example ESAPI provides the ValidationRule and Validator interfaces. Implement your own validators for your data. Reference Regex codes in the ESAPI properties from generic to specific.

Global Validate Canonicalize Specific Validate Any Interpreter Any Encoding Sanitize Web Service Controller Database Mainframe User Business Functions Data Layer Etc User Interface Set Character Set Encode For HTML File System Canonicalize Validate

Authenticator Interface with a simple, file based example implementation Log In / Log Out Password Verification Create User Password Generation Change Password Expirations Logging Per User Session Anonymous User Locale Roles Disable / Enable Locked / Unlocked CSRF Tokens Last Login Last Invalid Login Password Age Screen Name Failed Log In Count Last Logged in Host

Authentication Access Control Logging Intrusion Detection User Controller Business Functions Data Layer Backend Users ESAPI Note that the ESAPI project does not have out of the box support for projects like Spring, but can be made to work.

isauthorizedforurl isauthorizedfordata isauthorizedforfunction isauthorizedforservice Web Service Controller Database Mainframe User Business Functions Data Layer Etc isauthorizedforfile User Interface File System isauthorizedforfunction

Encryption Encryption failures can lead to violations of the Big Three Confidentiality Integrity Availability (maybe) Encryption is surprisingly difficult to get right. You are probably doing it wrong right now. The Encryptor interface provides a set of methods for performing common encryption, random number, and hashing operations. encrypted = ESAPI.encryptor().encrypt( decrypted ); decrypted = ESAPI.encryptor().decrypt( encrypted );

User Controller Business Functions Data Layer Backend Integrity Seals Encrypted Properties Encryptor Encryption Strong GUID Digital Signatures Safe Config Details Random Tokens Timestamp Salted Hash

Direct Object Reference Occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, database record, or key, as a URL or form parameter. Fix is to generate suitably random garbage, then internally map that to the appropriate IDs. Doing this is surprisingly annoying, especially if there are no sessions. Not really scalable friendly. ESAPI provides a random access map which also helps protect against CSRF. String directreference = "This is a direct reference."; RandomAccessReferenceMap instance = new RandomAccessReferenceMap(); String ind = instance.adddirectreference((object)directreference);

ref=jfo8we4oji Acct:9182374 Web Service Database User Access Reference Map Mainframe Etc Report123.xls File System Indirect References Direct References

Logging & Exceptions For many applications, logging is only used to detect application errors. Is usually geared to solving problems in development Hopefully with an eye to production. ESAPI provides a logging implementation that integrates with the security substructure. Logs security exceptions that are ESAPI generated with identify information Can be used by normal business code to log security exceptions or just log information with identify Integrates an intrusion detection system that can respond to different types of intrusions by disabling accounts or other actions.

User Controller Business Functions Data Layer Backend User Message (no detail) Enterprise Security Exceptions Logger Log Message (w/identity) AccessControlException AuthenticationException AvailabilityException EncodingException EncryptionException ExecutorException IntegrityException IntrusionException ValidationException Intrusion Detector Configurable Thresholds Responses Log Intrusion Logout User Disable Account

Handling HTTP Many applications make heavy use of HTTP for functionality Classic ASP uses redirects for flow control, error handing, etc. The use of data from the request accounts for most web security defects ESAPI provides methods to interact with the request Helper methods for encryption CSRF tokens Etc. Deals with Characters Sets and Encodings

User Controller Business Functions Data Layer Backend Add Safe Header No Cache Headers Set Content Type Add Safe Cookie Kill Cookie Change SessionID CSRF Tokens HTTP Utilities issecurechannel Safe Request Logging Safe File Uploads sendsafeforward sendsaferedirect Encrypt State in Cookie Hidden Field Encryption Querystring Encryption

OWASP Top Ten 2007 OWASP ESAPI A1. Cross Site Scripting (XSS) A2. Injection Flaws A3. Malicious File Execution A4. Insecure Direct Object Reference A5. Cross Site Request Forgery (CSRF) A6. Leakage and Improper Error Handling A7. Broken Authentication and Sessions A8. Insecure Cryptographic Storage A9. Insecure Communications A10. Failure to Restrict URL Access Validator, Encoder Encoder HTTPUtilities (Safe Upload) AccessReferenceMap, AccessController User (CSRF Token) EnterpriseSecurityException, HTTPUtils Authenticator, User, HTTPUtils Encryptor HTTPUtilities (Secure Cookie, Channel) AccessController

Special Thanks Supports OWASP and ESAPI Many of the diagrams for in the slides are from a similar presentation by Aspect.