Security at Scale: Effective approaches to web application security. zane@etsy.com @zanelackey



Similar documents
Building a Modern Security Engineering Organization.

Columbia University Web Security Standards and Practices. Objective and Scope

Magento Security and Vulnerabilities. Roman Stepanov

Check list for web developers

Finding Your Way in Testing Jungle. A Learning Approach to Web Security Testing.

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

elearning for Secure Application Development

External Network & Web Application Assessment. For The XXX Group LLC October 2012

The Past, Present and Future of XSS Defense Jim Manico. HITB 2011 Amsterdam

Finding XSS in Real World

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

SANS Dshield Webhoneypot Project. OWASP November 13th, The OWASP Foundation Jason Lam

Project 2: Web Security Pitfalls

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

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

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

CS 558 Internet Systems and Technologies

BASELINE SECURITY TEST PLAN FOR EDUCATIONAL WEB AND MOBILE APPLICATIONS

HTTPParameter Pollution. ChrysostomosDaniel

Criteria for web application security check. Version

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

Intrusion detection for web applications

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

(WAPT) Web Application Penetration Testing

STABLE & SECURE BANK lab writeup. Page 1 of 21

Lecture 15 - Web Security

Hacking Web Apps. Detecting and Preventing Web Application Security Problems. Jorge Blanco Alcover. Mike Shema. Technical Editor SYNGRESS

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

Workday Mobile Security FAQ

TDAQ Analytics Dashboard

Webapps Vulnerability Report

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Where every interaction matters.

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

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

Web Application Security

Web Application Security

Cloudy with a chance of 0-day

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

Testing the OWASP Top 10 Security Issues

THE BLIND SPOT IN THREAT INTELLIGENCE THE BLIND SPOT IN THREAT INTELLIGENCE

Hack Yourself First. Troy troyhunt.com

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

Automatic vs. Manual Code Analysis

Interactive Application Security Testing (IAST)

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

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Security Research Advisory IBM inotes 9 Active Content Filtering Bypass

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

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

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

Secure Coding. External App Integrations. Tim Bach Product Security Engineer salesforce.com. Astha Singhal Product Security Engineer salesforce.

Web Application Firewalls: What the vendors do NOT want you to know SHAKACON III

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

RIA SECURITY TECHNOLOGY

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

Web-Application Security

Web Application Security

A talk by ,

Implementing 2-Legged OAuth in Javascript (and CloudTest)

Traitware Authentication Service Integration Document

Still Aren't Doing. Frank Kim

Getting Started with WPM

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

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

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

Bypassing Web Application Firewalls (WAFs) Ing. Pavol Lupták, CISSP, CEH Lead Security Consultant

Mike Zusman 3/7/2011. OWASP Goes Mobile SANS AppSec Summit 2011

Improving Web Vulnerability Scanning. Daniel Zulla

A Tale of the Weaknesses of Current Client-Side XSS Filtering

Secure Coding in Node.js

Øredev Web application testing using a proxy. Lucas Nelson, Symantec Inc.

Thomas Röthlisberger IT Security Analyst

Mobile development with Apache OFBiz. Ean Schuessler, Brainfood

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

Enterprise Application Security Workshop Series

Fundamentals of LoadRunner 9.0 (2 Days)

by Jonathan Kohl and Paul Rogers 40 BETTER SOFTWARE APRIL

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Best Practices for Monitoring: Reduce Outages and Downtime. Develop an effective monitoring strategy with the right metrics, processes and alerts.

Introduction: 1. Daily 360 Website Scanning for Malware

I Hunt Penetration Testers!

MAGENTO Migration Tools

InfoSphere Guardium Tech Talk Data privacy and dynamic masking for web applications: InfoSphere Guardium for Applications

Kenna Platform Security. A technical overview of the comprehensive security measures Kenna uses to protect your data

OWASP TOP 10 ILIA

Instructions for Embedding a Kudos Display within Your Website

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

Protecting Applications on Microsoft Azure against an Evolving Threat Landscape

Machine Data Analytics with Sumo Logic

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

Hubcase for Salesforce Installation and Configuration Guide

Front-End Performance Testing and Optimization

Testing Network Performance with Real Traffic

Cloud Security Through Threat Modeling. Robert M. Zigweid Director of Services for IOActive

How to effect change in the Epistemological Wasteland of Application Security. James Wickett

[state of the internet] / SEO Attacks. Threat Advisory: Continuous Uptick in SEO Attacks

LEVERAGING PROACTIVE DEFENSE TO DEFEAT MODERN ADVERSARIES. Jared Greenhill RSA Incident Response. September 17 th, 2015

Strategic Information Security. Attacking and Defending Web Services

Transcription:

Security at Scale: Effective approaches to web application security zane@etsy.com @zanelackey

Who am I? Engineering Manager @ Etsy Lead appsec/netsec/seceng teams Formerly @ isec Partners Books/presentations primarily focused on application and mobile security

What is Etsy? Online marketplace for creative independent businesses

Scale at Etsy 1.5B pageviews/mo 40M uniques/mo #51 by US traffic * * April 2012, Alexa site ranking

About this talk Real world approaches to web application security challenges

About this talk Specifically, techniques that are simple and effective

Continuous deployment?

Continuous deployment <- What it (hopefully) isn t

Continuous deployment Three words: iterate, iterate, iterate

Continuous deployment

Continuous deployment Etsy pushes to production 30 times a day on average

Continuous deployment (dogs push too)

But Doesn t the rapid rate of change mean things are less secure?

Actually, the opposite Being able to deploy quick is our #1 security feature

Compared to We ll rush that security fix. It will go out in the next release in about 6 weeks. - Former vender at Etsy

What it boils down to (spoiler alert) Make things safe by default Detect risky functionality / Focus your efforts Automate the easy stuff Know when the house is burning down

Safe by default

Safe by default Traditional defenses for XSS Input validation Output encoding How have they worked out?

Safe by default

Safe by default Problems? Often done on a per-input basis Easy to miss an input or output May use defenses in wrong context Input validation pattern may blocks full HTML injection, but not injecting inside JS May put defenses on the client side in JS Etc These problems miss the point

Safe by default The real problem is that it s hard to find where protections have been missed How can we change our approach to make it simpler?

Safe by default Input validation Output encoding

Safe by default Input validation Output encoding

Safe by default Encode dangerous HTML characters to HTML entities at the very start of your framework To repeat Before input reaches main application code

Safe by default On the surface this doesn t seem like much of a change

Safe by default Except, we ve just made lots of XSS problems grep-able

Safe by default

Safe by default Now we look for a small number of patterns: HTML entity decoding functions or explicit string replacements Data in formats that won t be sanitized Ex: Base64 encoded, double URL encoded, etc Code that opts out of platform protections

Safe by default Fundamentally shifts us: From: Where is my app missing protections? (hard) To: Where is it made deliberately unsafe? (easy)

Safe by default Obviously not a panacea DOM based XSS Javascript: URLs Can be a pain during internationalization efforts

Focus your efforts

Focus your efforts Continuous deployment means code ships fast Things will go out the door before security team knows about them How can we detect high risk functionality?

Detect risky functionality Know when sensitive portions of the codebase have been modified Build automatic change alerting on the codebase Identify sensitive portions of the codebase Create automatic alerting on modifications

Detect risky functionality Doesn t have to be complex to be effective Approach: sha1sum sensitive platform level files Unit tests alert if hash of the file changes Notifies security team on changes, drives code review

Detect risky functionality At the platform level, watching for changes to site-wide sensitive functionality CSRF defenses Session management Encryption wrappers Login/Authentication Etc

Detect risky functionality At the feature level, watching for changes to specific sensitive methods Identifying these methods is part of initial code review/pen test of new features

Detect risky functionality Watch for dangerous functions Usual candidates: File system operations Process execution/control HTML decoding (if you re input encoding) Etc

Detect risky functionality Unit tests watch codebase for dangerous functions Split into separate high risk/low risk lists Alerts are emailed to the appsec team, drive code reviews

Detect risky functionality Monitor application traffic Purpose is twofold: Detecting risky functionality that was missed by earlier processes Groundwork for attack detection and verification

Detect risky functionality Regex incoming requests at the framework Sounds like performance nightmare, shockingly isn t Look for HTML/JS in request This creates a huge number of false positives That s by design, we refine the search later

Detect risky functionality We deliberately want to cast a wide net to see HTML entering the application From there, build a baseline of HTML Entering the application in aggregate Received by specific endpoints

Detect risky functionality What to watch for: Did a new endpoint suddenly show up? A new risky feature might ve just shipped Did the amount of traffic containing HTML just significantly go up? Worth investigating

Detect risky functionality Aggregate increased, time to investigate

Automate the easy stuff

Automate the easy stuff Automate finding simple issues to free up resources for more complex tasks Use attacker traffic to automatically drive testing We call it Attack Driven Testing

Automate the easy stuff Some cases where this is useful: Application faults Reflected XSS SQLi

Automate the easy stuff Application faults (HTTP 5xx errors) As an attacker, these are one of the first signs of weakness in an app As a defender, pay attention to them!

Automate the easy stuff Just watching for 5xx errors results in a lot of ephemeral issues that don t reproduce Instead: Grab last X hours worth of 5xx errors from access logs Replay the original request Alert on any requests which still return a 5xx

Automate the easy stuff Cron this script to run every few hours If a request still triggers an application fault hours later, it s worth investigating

Automate the easy stuff Similar methodology for verifying reflected XSS For reflected XSS we: Identify requests containing basic XSS payloads Replay the request Alert if the XSS payload executed

Automate the easy stuff Basic payloads commonly used in testing for XSS: alert() document.write() unescape() String.fromCharCode() etc

Safe by default We created a tool to use NodeJS as a headless browser for verification

Automate the easy stuff 1. Fetch URL containing potential XSS Test webserver

Automate the easy stuff 2. Page contents returned to a temp buffer, not interpreted yet Test webserver

Automate the easy stuff 3. Inject our instrumented JS into page contents + Our JS Page contents Test webserver

Automate the easy stuff 4. Combination of instrumented JS + page contents interpreted + Our JS Page contents Test webserver

Automate the easy stuff 5. If instrumented JS is executed, alert appsec team for review Test webserver

Automate the easy stuff Sample instrumented JS: (function() { var proxiedalert = window.alert; window.alert = function() { location="xssdetected"; }; })();

Automate the easy stuff Open sourced NodeJS tool https://github.com/zanelackey/projects Combine this approach with driving a browser via Watir/Selenium Make sure to use all major browsers

Know when the house is burning down

Know when the house is burning down Graph early, graph often

Know when the house is burning down Which of these is a quicker way to spot a problem?

Know when the house is burning down

Know when the house is burning down

Know when the house is burning down Methodology: Instrument application to collect data points Fire them off to an aggregation backend Build individual graphs Combine groups of graphs into dashboards We ve open sourced our instrumentation library https://github.com/etsy/statsd

Know when the house is burning down

Know when the house is burning down

Know when the house is burning down Now we can visually spot attacks

Know when the house is burning down But who s watching at 4AM?

Know when the house is burning down In addition to data visualizations, we need automatic alerting Look at the raw data to see if it exceeds certain thresholds Works well for graphs like this

Know when the house is burning down

Know when the house is burning down But not like this

Know when the house is burning down

Know when the house is burning down We need to smooth out graphs that follow usage patterns Use exponential smoothing formulas like Holt- Winters Math is hard, let s look at screenshots!

Know when the house is burning down

Know when the house is burning down Now that we ve smoothed out the graphs Use the same approach as before: Grab the raw data Look for values above/below a set threshold Alert

Know when the house is burning down What about exposure of internal info?

Know when the house is burning down Paste sites are extremely useful gist, pastebin, etc If you don t have one internally, external ones will be used Or if you have a bad one internally

Know when the house is burning down Use Google Alerts to monitor paste sites for internal info exposures Ex: Hostnames, class names

Know when the house is burning down Monitor cloud storage for ACLs that publicly expose data S3 buckets Google Docs Open sourced S3 monitoring tool: https://github.com/zanelackey/projects Google Docs tool soon

Conclusions

Conclusions

Conclusions Have the ability to deploy/respond quickly

Conclusions Make things safe by default Focus your efforts / Detect risky functionality Automate the easy stuff Know when the house is burning down

Thanks! zane@etsy.com @zanelackey

References / Thanks DevOpsSec: http://www.slideshare.net/nickgsuperstar/dev opssec-apply-devops-principles-to-security Special Thanks: Nick Galbreath, Dan Kaminsky, Marcus Barczak