injecting security controls into software applications
play

Injecting Security Controls into Software Applications Katy Anton - PowerPoint PPT Presentation

Injecting Security Controls into Software Applications Katy Anton Principal Application Security Consultant About me Katy Anton Software development background Project co-leader for OWASP Top 10 Proactive Controls (@OWASPControls)


  1. Injecting Security Controls into Software Applications Katy Anton Principal Application Security Consultant

  2. About me Katy Anton • Software development background • Project co-leader for OWASP Top 10 Proactive Controls (@OWASPControls) • Principal Application Security Consultant @Veracode @KatyAnton

  3. @KatyAnton

  4. Common Developer Questions “My website is behind the firewall. Why do I have to fix the SQL injection ?“ @KatyAnton

  5. Common Developer Questions “I validated the input. Isn’t this enough to prevent SQL Injection ?” @KatyAnton

  6. Common Developer Questions “ I have parameterized. Look I use preparedStatement - why is not correct ?” @KatyAnton

  7. Injection @KatyAnton

  8. CWEs in Injection Category • CWE-78: OS Cmd Inj CWE-77: Commmand Injection CWE-78: Argument CWE-78: XSS CWE-91: XML Injection CWE-74 Injectio CWE-93: CRLF Injection CWE-94: Code Injection CWE-89: SQL CWE-943: Improper Neutr. of Special El in CWE-90: LDAP @KatyAnton Source: NVD

  9. Types of SQL Injection • In-Band SQLi • Error based SQLi • Union based SQLi • Blind SQL injection • Boolean • Time based • Out-of-Band SQLi • Compounded SQLi (SQL + XSS) • Second Order SQL Injection @KatyAnton

  10. @KatyAnton

  11. Injection First mentioned in Phrack magazine in 1998 20 years anniversary 2004 2009 2010 2013 2017 Injection A6 A2 A1 A1 A1 @KatyAnton

  12. Is there another way to look at it? @KatyAnton

  13. Decompose the Injection Data interpreted as Code Input Parser Output Get / Post Data SQL Parser SQL File Uploads HTML Parser HTML HTTP Headers XML Parser XML Database Data Shell Bash Script Config files LDAP Parser LDAP Query @KatyAnton

  14. Extract Security Controls Output Input Parser Vulnerability Encode Output Parameterize Validate Input ! ! SQL Injection ! ! XSS ! ! XML Injection ! ! Code Injection ! ! LDAP Injection ! ! ! Cmd Injection Primary Controls Defence in depth @KatyAnton

  15. Security Controls Recap Application Server Operating System OS Command Software Application Param Data Param Queries Validate Input Encode Output @KatyAnton

  16. Intrusions (or lack of Intrusion Detection) “If a pen tester is able to get into a system without being detected, then there is insufficient logging and monitoring in place“ @KatyAnton

  17. Security Controls: Security Logging The security control developers can use to log security information during the runtime operation of an application. @KatyAnton

  18. The 6 Best Types of Detection Points Good attack identifiers: 1. Authorisation failures 2. Authentication failures 3. Client-side input validation bypass 4. Whitelist input validation failures 5. Obvious code injection attack 6. High rate of function use Source: https://www.owasp.org/index.php/AppSensor_DetectionPoints @KatyAnton

  19. Examples of Intrusion Detection Points Request Exceptions • Application receives GET when expecting POST • Additional form or URL parameters submitted with request Authentication Exceptions • The user submits a POST request which only contains the username variable. The password variable has been removed. • Additional variables received during an authentication request (like ‘admin=true’') Input Exceptions • Input validation failure on server despite client side validation • Input validation failure on server side on non-user editable parameters (hidden fields, checkboxes, radio buttons, etc) Source: https://www.owasp.org/index.php/AppSensor_DetectionPoints @KatyAnton

  20. Vulnerable Components Using Software Components with Known Vulnerabilities @KatyAnton

  21. Root Cause • Difficult to understand • Easy to break • Difficult to test • Difficult to upgrade • Increase technical debt @KatyAnton

  22. Components Examples Example of external components: • Open source libraries - for example: a logging library • APIs - for example: vendor APIs • Libraries / packages by another team within same company @KatyAnton

  23. Example 1: Implement Logging Library • Third-party - provides logging levels: • FATAL, ERROR, WARN, INFO, DEBUG. • We need only: • DEBUG, WARN, INFO. @KatyAnton

  24. Simple Wrapper Helps to: • Expose only the functionality required. • Hide unwanted behaviour. • Reduce the attack surface area. • Update or replace libraries. • Reduce the technical debt. @KatyAnton

  25. Example 2: Implement a Payment Gateway Scenario: • Vendor APIs - like payment gateways • Can have more than payment gateway one in application • Require to be inter-changed @KatyAnton

  26. Adapter Design Pattern • Converts from provided interface Your Code to the required interface. • A single Adapter interface can work with many Adaptees. Adapter • Easy to maintain. Third-party code @KatyAnton

  27. Example 3: Implement a Single Sign-On • Libraries / packages created by another team within same company • Re-used by multiple applications • Common practice in large companies @KatyAnton

  28. Façade Design Pattern • Simplifies the interaction with a complex sub-system • Make easier to use a poorly designed API • It can hide away the details from the client. • Reduces dependencies on the outside code. @KatyAnton

  29. Secure Software Starts from Design !

  30. Secure Software Starts from Design ! Wrapper Adapter Pattern Façade Pattern To expose only required To convert from the required To simplify the interaction with functionality and hide unwanted interface to provided interface a complex sub-system. behaviour. Your Code Adapter Third-party code

  31. How often ? @KatyAnton

  32. Rick Rescorla • United States Army office of British origin • Born in Hayle, Cornwall, UK • Director of Security for Morgan Stanley at WTC @KatyAnton

  33. Security Controls Recap @KatyAnton

  34. Security Controls In Development Cycle Application Server OS Command Logs Operating System Log Exception Software Application Param Data Encode output Secure Date Key Management Encapsulation Param Queries Mo Mo Mo Mo Mo Mo Encode Validate Harden Mo output Enca Input TLS XML Parser Libra TLS TLS XML @KatyAnton

  35. Final Takeaways Focus on CWEs Security which prevent Controls @KatyAnton

  36. Final Takeaways Focus on CWEs Security Verify Early and Often Controls @KatyAnton

  37. Thank you very much Katy Anton Principal Application Security Consultant @KatyAnton

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend