Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Basic_Web_Security.pdf

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

 Basic_Web_Security.pdf

A Very high-level look at introductory web application security topics.

Avatar for asalinas9294

asalinas9294

February 13, 2019

Other Decks in Programming

Transcript

  1. © NCC Group 2018. All rights reserved Agenda • OWASP

    • Common Vulnerabilities • How to Identify • Mitigation Techniques • Common Pitfalls
  2. © NCC Group 2018. All rights reserved What Is OWASP?

    OWASP Foundation & OWASP Top 10 • The Open Web Application Security Project • Global non-for-profit established to help improve web security • “Our mission is to make software security visible, so that individuals and organizations are able to make informed decisions.”
  3. © NCC Group 2018. All rights reserved OWASP Foundation &

    OWASP Top 10 OWASP Top 10 • Broad list of most critical security risks to web applications. • Ordered in terms of criticality
  4. © NCC Group 2018. All rights reserved Common Vulnerabilities •

    Security Misconfigurations • Using Components with Known Vulnerabilities • Broken Authentication • Broken Access Controls • Injection Attacks
  5. © NCC Group 2018. All rights reserved Common Vulnerabilities: Security

    Misconfigurations • Encapsulates the entirety of the application stack (it can occur anywhere) • Examples: • Using default credentials for administrative services • Unnecessarily exposing services to the internet • Returning detailed error messages (e.g. stack traces) • Directory listing enabled • Other (somewhat) related examples: • Missing or improperly configured security headers • HTTP Strict-Transport-Security (HSTS) • Content Security Policy (CSP) • Content-Type • COARS • Lack of transport security (TLS) • Weak or improperly configured transport security
  6. © NCC Group 2018. All rights reserved Common Vulnerabilities: Using

    Components with Known Vulnerabilities • Obvious Locations: • Application framework • Application core (e.g. Wordpress, Drupal, Magnolia, etc.) • Extensions & addons • Less Obvious Locations: • Libraries & dependencies • Administrative services • Back-end services/components • Externally-hosted dependencies
  7. © NCC Group 2018. All rights reserved Identifying & Mitigating

    • Review and apply recommendations for application stack at hand • Perform regular audits of application, dependencies, and related services • Ensure all components are up to date with latest stable release
  8. © NCC Group 2018. All rights reserved Common Vulnerabilities: Broken

    Authentication • Pertains to an application’s authentication and session management scheme • Can lead to data disclosure, privilege escalation, and even full compromise of application • Most common example is poor session management: • Long-lived sessions • Session tokens that are not destroyed on logout • Session Fixation (reused session tokens) • Weak session token schemes • Insufficient length • Easily guessable
  9. © NCC Group 2018. All rights reserved Identifying & Mitigating

    • Ensure authentication scheme follows secure best-practice recommendations • Implement secure password policy • Whenever possible, long-lived and concurrent sessions should be avoided • Session tokens should be: • Unique to each session • Cryptographically secure (hard to guess) • Appropriately long (AT LEAST 128 bits or 16 characters) • Never be reused Plenty of libraries and frameworks exist to help properly manage sessions and authentication. USE THEM!!
  10. © NCC Group 2018. All rights reserved Common Vulnerabilities: Broken

    Access Controls • In a nutshell: users can access information or functionality they should not have access to. • Typically happens when user permissions, roles, or session state is not verified. • Can also happen when access controls occur client-side
  11. © NCC Group 2018. All rights reserved Identifying & Mitigating

    • Access Control Checklist: • Does the application check for an active session? • Does the application verify user role and permissions? • Are ALL requests validated via access controls? • Do access controls happen server side? • Is the the integrity of a request verified - i.e. check if the user knowingly submitted a request (Cross-Site Request Forgery protection)? • If the answer to any of the questions above is “No”, Your access control might be broken.
  12. © NCC Group 2018. All rights reserved Practice Scenario 1

    Secure File Sharing Application • Users must create an account and log in to use application • Users can upload files and share them securely with other users • All files a user has access to appear in their dashboard • Files are referenced by their unique identifier (a number unique to each file) • When a user shares a file, the recipient will receive a notification and the file appears in their dashboard • To make sharing more convenient, the recipient also receives an email with a link that lets them directly access the file (https://www.[appname].com/files/[unique_file_id])
  13. © NCC Group 2018. All rights reserved Practice Scenario 2

    Secure File Sharing Application Version 2 • Recipients are no longer emailed a direct link to the file. • When a user shares a file, the recipient receives an email alert with a link to their dashboard. • Recipient must log in to view new files in dashboard. • When a user downloads a file, a “download_file” request is sent to the backend API. • The API checks if the user has a valid session by looking for the “is_logged_in” cookie. • This cookie value is set to TRUE if the user is logged in, and doesn’t exist if the user doesn’t have an active session.
  14. © NCC Group 2018. All rights reserved Common Vulnerabilities: Injection

    Attacks • (over)Simplified Definition: Occurs when user-supplied input is interpreted as a programmatic instruction. • Several different forms of injections exist. Everything from SQL and LDAP to shell commands. • Technically, interpreting user input as code or an expression can also be considered a form of injection.
  15. © NCC Group 2018. All rights reserved Identifying & Mitigating

    • Injection Checklist: • Is user input being properly sanitized and validated? • Are metacharacters being encoded / contextually escaped? • Is the application using a safe API or function that provides sanitization and parameterization?
  16. © NCC Group 2018. All rights reserved Common Pitfalls •

    Don’t reinvent the wheel • Just because you can do something, doesn’t mean you should • Assume all users are EVIL • Don’t prioritize convenience over security • Know all of your applications components • Make security audits a routine task (as in more than once)