Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.

Similar presentations


Presentation on theme: "Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP."— Presentation transcript:

1 Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation OWASP AppSec DC 2009 http://www.owasp.org Don’t Write Security Code! (The OWASP Enterprise Security API) Jeff Williams Aspect Security CEO OWASP Foundation Chair November 12, 2009

2 OWASP AppSec DC 2009 Reality Check  Financial  Government  Technology  Banking  Healthcare  Insurance  Publishing  Retail  Utilities  Education Applications average 20 serious vulnerabilities 90% of applications are vulnerable 2

3 OWASP AppSec DC 2009 OWASP ESAPI Project Charter… To ensure that strong simple security controls are available to every developer in every environment 3 http://www.owasp.org/index.php/ESAPI

4 OWASP AppSec DC 2009 4 Before After

5 OWASP AppSec DC 2009 5 Platform ESAPI Core Ent. Security Services Ent. Security Services LDAP, DB, Web Services, etc.. LDAP, DB, Web Services, etc.. ESAPI Adapters Custom Application Application Framework Enterprise Security API

6 OWASP AppSec DC 2009 Participants 2008 ESAPI Summit  The ESAPI Summit sparked innovation for version 2.0!  Logging  Access Control  Input Validation  Maven  Internationalization  ESAPI WAF!! 6

7 OWASP AppSec DC 2009 Project Scorecard Authentication  Identity  Access Control  **  Input Validation  **  Output Escaping   Canonicalization  Encryption  Random Numbers  Exception Handling  Logging  Intrusion Detection  Security Configuration  WAF  7

8 OWASP AppSec DC 2009 Select ESAPI Early Adopters Many unnamed financial orgs… 8

9 OWASP AppSec DC 2009 // validate request against developer-defined patterns ValidationErrorList errorList = new ValidationErrorList(); String name = ESAPI.validator().getValidInput( "Name", form.getName(), “UserName", 255, false, errorList); Integer weight = ESAPI.validator().getValidInteger( “UserWeight", form.getWeight(), 1, 10000, false, errorList); request.setAttribute(“VERROR”, errorList ); … // get validation errors and update web page ValidationErrorList errors = (ValidationErrorList)request.getAttribute(“VERROR"); // update page Better Input Validation 9

10 OWASP AppSec DC 2009 Escaping Gone Wild Percent Encoding %3c %3C HTML Entity Encoding &#60 &#060 &#0060 &#00060 &#000060 &#0000060 < < < < < < &#x3c &#x03c &#x003c &#x0003c &#x00003c &#x000003c < < < < < < &#X3c &#X03c &#X003c &#X0003c &#X00003c &#X000003c < < < < < < &#x3C &#x03C &#x003C &#x0003C &#x00003C &#x000003C < < < < < < &#X3C &#X03C &#X003C &#X0003C &#X00003C &#X000003C < < < < < < &lt &lT &Lt &LT < &lT; &Lt; &LT; JavaScript Escape \< \x3c \X3c \u003c \U003c \x3C \X3C \u003C \U003C CSS Escape \3c \03c \003c \0003c \00003c \3C \03C \003C \0003C \00003C Overlong UTF-8 %c0%bc %e0%80%bc %f0%80%80%bc %f8%80%80%80%bc %fc%80%80%80%80%bc US-ASCII ¼ UTF-7 +ADw- Punycode <- < < 10

11 OWASP AppSec DC 2009 Rule #1: HTML Element Content ESAPI.encoder.encodeForHTML(input)encodeForHTML(input) Rule #2: HTML Common Attributes ESAPI.encoder.encodeForHTMLAttribute(input)encodeForHTMLAttribute(input) Rule #3: HTML Javascript Data Values ESAPI.encoder.encodeForJavaScript(input)encodeForJavaScript(input) Rule #4: HTML Style Property Values ESAPI.encoder.encodeForCSS(input)encodeForCSS(input) Rule #5: HTML URL Attributes ESAPI.encoder.encodeForURL(input)encodeForURL(input) Use these in components and developers won’t even know! Stamping Out XSS 11

12 OWASP AppSec DC 2009 String input = request.getParameter( "input" ) String safeMarkup = ESAPI.validator().getValidSafeHTML( "input", input, 2500, true ); … Rich Content 12

13 OWASP AppSec DC 2009 // setup a map and store somewhere safe - like the session! Set fileSet = new HashSet(); fileSet.addAll(...); AccessReferenceMap map = new AccessReferenceMap( fileSet );... // create an indirect reference to send to browser String ref = map.getIndirectReference( file1 ); String href = "esapi?file=" + ref );... // get direct reference String ref = request.getParameter( "file" ); File file = (File)map.getDirectReference( ref ); Stopping Insecure Direct Object References 13

14 OWASP AppSec DC 2009 // check the current user’s credentials User user = ESAPI.authenticator().login(); // display their last login time User user = ESAPI.authenticator().getCurrentUser() ; out.println( “Login: “ + user.getLastLoginTime() ); // rotate their session id ESAPI.httpUtilities().changeSessionIdentifier(); // kill their session and session cookie ESAPI.authenticator().logout; You can rotate your session without losing the contents Identity Everywhere 14

15 OWASP AppSec DC 2009 ESAPI Web App Firewall (WAF) attacker user ESAPI WAF Critical Application? PCI requirement? 3 rd party application? Legacy application? Incident response? Virtual patches Authentication rules URL access control Egress filtering Attack surface reduction Real-time security 15

16 OWASP AppSec DC 2009 Documentation  Javadoc  http://owasp-esapi- java.googlecode.com/svn/trunk_d oc/index.html http://owasp-esapi- java.googlecode.com/svn/trunk_d oc/index.html  Banned APIs  http://www.owasp.org/index.php/ ESAPI_Secure_Coding_Guideline http://www.owasp.org/index.php/ ESAPI_Secure_Coding_Guideline  Release Notes  http://www.owasp.org/images/d/d 0/JavaEE- ESAPI_2.0a_ReleaseNotes.doc http://www.owasp.org/images/d/d 0/JavaEE- ESAPI_2.0a_ReleaseNotes.doc  Install Guide  http://www.owasp.org/images/4/4 c/JavaEE-ESAPI_2.0a_install.doc http://www.owasp.org/images/4/4 c/JavaEE-ESAPI_2.0a_install.doc 16

17 OWASP AppSec DC 2009

18

19 Questions and Answers Jeff Williams Aspect Security CEO OWASP Foundation Chair jeff.williams@aspectsecurity.com http://www.aspectsecurity.com twitter @planetlevel 410-707-1487 You can send me application security questions anytime! 19


Download ppt "Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP."

Similar presentations


Ads by Google