Defending Against Web App A0acks Using ModSecurity. Jason Wood Principal Security Consultant Secure Ideas



Similar documents
Web Application Firewall Technology Insight OWASP 22/ The OWASP Foundation. Joakim Sandström Role: OWASP Prospect.

Repsheet. A Behavior Based Approach to Web Application Security. Aaron Bedra Application Security Lead Braintree Payments. tirsdag den 1.

ModSecurity as Universal Cross- pla6orm Web Protec;on Tool. Ryan Barne? Greg Wroblewski

ModSecurity The Open Source Web Application Firewall

Advanced Web Security, Lab

Unlocking Hadoop for Your Rela4onal DB. Kathleen Technical Account Manager, Cloudera Sqoop PMC Member BigData.

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Implementation of Web Application Firewall

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

Monitoring System Status

Adding Value to Automated Web Scans. Burp Suite and Beyond

No Cloud Allowed. Denying Service to DDOS Protection Services

Web Application Vulnerability Testing with Nessus

MatriXay WEB Application Vulnerability Scanner V Overview. (DAS- WEBScan ) The best WEB application assessment tool

VoIP Security How to prevent eavesdropping on VoIP conversa8ons. Dmitry Dessiatnikov

Securing Web Apps with NGINX

HP WebInspect Tutorial

Compliance Solu.ons with a Budget in Mind

INTRUSION DECEPTION CZYLI BAW SIĘ W CIUCIUBABKĘ Z NAMI

NETWORK DEVICE SECURITY AUDITING

Data Breaches and Web Servers: The Giant Sucking Sound

(WAPT) Web Application Penetration Testing

FortiWeb 5.0, Web Application Firewall Course #251

Mobile Applica,on and BYOD (Bring Your Own Device) Security Implica,ons to Your Business. Dmitry Dessiatnikov

SECURE THE DATACENTER. Dennis de Leest Sr. Systems Engineer

Mingyu Web Application Firewall (DAS- WAF) All transparent deployment for Web application gateway

Web Application Security

ModSecurity as Universal Cross-platform Web Protection Tool

Check list for web developers

Cisco Catalyst 4948E NetFlow- lite

FileRunner Security Overview. An overview of the security protocols associated with the FileRunner file delivery application

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

Pervade Software. Use Case PCI Technical Controls. PCI- DSS Requirements

Network Security. Computer Security & Forensics. Security in Compu5ng, Chapter 7. l Network Defences. l Firewalls. l Demilitarised Zones

Hunk & Elas=c MapReduce: Big Data Analy=cs on AWS

Criteria for web application security check. Version

Web Engineering Web Application Security Issues

Using Nessus In Web Application Vulnerability Assessments

Splunk for Networking and SDN

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

Web application security

CCM 4350 Week 11. Security Architecture and Engineering. Guest Lecturer: Mr Louis Slabbert School of Science and Technology.

HackMiami Web Application Scanner 2013 PwnOff

AppSec USA 2014 Denver, Colorado Security Header Injection Module (SHIM)

Where every interaction matters.

Web Application Firewalls: When Are They Useful? OWASP AppSec Europe May The OWASP Foundation

Application Security Testing

Web Application Penetration Testing

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

Information Supplement: Requirement 6.6 Code Reviews and Application Firewalls Clarified

1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Public Information

What is Web Security? Motivation

Introduction to Web Application Firewalls. Dustin Anders

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

New Security Features in Oracle E-Business Suite 12.2

Intrusion detection for web applications

Web Application Security

Semantic based Web Application Firewall (SWAF V 1.6) Operations and User Manual. Document Version 1.0

Conducting Web Application Pentests. From Scoping to Report For Education Purposes Only

Information Technology Policy

Kaseya Fundamentals Workshop DAY THREE. Developed by Kaseya University. Powered by IT Scholars

Passive Logging. Intrusion Detection System (IDS): Software that automates this process

THE SMARTEST WAY TO PROTECT WEBSITES AND WEB APPS FROM ATTACKS

Invest in security to secure investments. Breaking SAP Portal. Dmitry Chastuhin Principal Researcher at ERPScan

Architec;ng Splunk for High Availability and Disaster Recovery

Snare System Version Release Notes

Preventing credit card numbers from escaping your network

Web Application Security

Please Complete Speaker Feedback Surveys. SecurityTube.net

Web Applica+on Security: Be Offensive! About Me

Google App Engine f r o r J av a a v a (G ( AE A / E J / )

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

NSFOCUS Web Vulnerability Scanning System

Web Application Firewalls Evaluation and Analysis. University of Amsterdam System & Network Engineering MSc

Ethical Hacking as a Professional Penetration Testing Technique

April 23, 2015 ACME Company. Security Assessment Report

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

Lucid Key Server v2 Installation Documentation.

Java Web Application Security

The Top Web Application Attacks: Are you vulnerable?

Course Content: Session 1. Ethics & Hacking

The Wide World of WAFs

How To Perform a SaaS Applica7on Inventory in. 5Simple Steps. A Guide for Informa7on Security Professionals. Share this ebook

CSE/ISE 311: Systems Administra5on Logging

Still Aren't Doing. Frank Kim

FortiOS Handbook - Hardening your FortiGate VERSION 5.2.3

Host/Platform Security. Module 11

05.0 Application Development

How To Protect Virtualized Data From Security Threats

Transcription:

Defending Against Web App A0acks Using ModSecurity Jason Wood Principal Security Consultant Secure Ideas

Background Info! Penetra?on Tester, Security Engineer & Systems Administrator!!!! Web environments for over 11 years Infrastructure Windows, Linux, UNIX Moved to Security in 2006! CyberPatriot Mentor

Secure Ideas! Established in 2009! Penetra?on Tes?ng, Architecture Reviews and Educa?on! Highly experienced consultants in technology opera?ons and development! Professionally Evil! 2013 Secure Ideas LLC www.secureideas.com 3

Outline! ModSecurity 101! Audit Logging! Prepara?on and Configura?on! Iden?fying A0ackers! Custom Rules! Analysis

ModSecurity 101! Web applica?on firewall engine! Runs on Apache, IIS7 and Nginx! Tradi?onal and Anomaly Scoring! Inspect request and response data! Greatly increased informa?on logged! OWASP ModSecurity Core Rule Set (CRS)! h0ps://www.owasp.org/index.php/ Category:OWASP_ModSecurity_Core_Rule_Set_Project! Commercial rules also available from Trustwave

Processing Phases h0p://?nyurl.com/modsecphases

Example OWASP ModSecurity CRS Rule SecRule RESPONSE_BODY "<h2>site Error<\/h2>.{0,20} <p>an error was encountered while publishing this resource\." \ "phase: 4,rev:'2.2.0',t:none,capture,ctl:auditLogParts= +E,block,msg:'Zope Information Leakage',id:'970007',tag:'LEAKAGE/ ERRORS_ZOPE',tag:'WASCTC/WASC-13',tag:'OWASP_TOP_10/ A6',tag:'PCI/6.5.6',severity:'3',setvar:'tx.msg=% {rule.msg}',setvar:tx.outbound_anomaly_score=+% {tx.error_anomaly_score},setvar:tx.anomaly_score=+% {tx.error_anomaly_score},setvar:tx.%{rule.id}- LEAKAGE/ERRORS-%{matched_var_name}=%{tx.0}"

Tradi?onal vs Anomaly Processing! Tradi?onal! Rule match - > Take the ac?on configured in the rule! Easy to understand! No sharing of informa?on between rules! SecDefaultAc?on "phase:2,deny,log"! Anomaly! Rule match - > Increase an anomaly score! If anomaly score exceeds a threshold, then take an ac?on! More difficult to understand! Provides increased flexibility in response! SecDefaultAc?on "phase:2,pass,log"

Audit Logging! Two different logging types! Serial! Concurrent! NOT line separated log files! Events are broken up into blocks of text! Block Separators! - - <unique_hexidecimal_boundary>- <sec?on_id>- -! - - 7d234671- H- -

Log Sec?on Defini?ons! A Audit log header! B Request headers! C Request body! E Intermediary response body! F Final response headers! H Audit log trailer! J Informa?on about uploaded files! K Every rule matched by an event, in order of match! Z Final boundary! h0ps://github.com/spiderlabs/modsecurity/wiki/reference- Manual#wiki- SecAuditLogParts

Log Event Example

Avoid Logging Sensi?ve Data! ModSecurity log tons of data, which could include.! Credit card numbers! Social Security numbers! Passwords! Implement ModSecurity s data sani?za?on! CRS op?onal rules

Audit Log Sani?za?on! sani?searg remove any data parameters by name! Sec?onAc?on phase:5,nolog,pass,sani%searg:password! sani?serequestheader remove any HTTP headers by name! Sec?onAc?on phase:5,nolog,pass, \ sani%serequestheader:authoriza%on! sani?sematched remove any data parameters whose name you don t know yet! SecRule ARGS @verifycc \d{13,16} phase: 5,nolog,pass, \ sani%sematched! ModSecurity Handbook, page 69

Prepara?on and Configura?on! Harden the web server! Configure ModSecurity! Use Detec?onOnly (to start)! Increase log verbosity! Tes?ng as a good user and a bad guy! Determine the processing mode! Tuning! Custom rules! Going for bonus points! Implement honey traps! Track bad guys across the applica?on

Iden?fying A0ackers! Ac?ve vs Passive Defense! Ac?ve defense doesn t necessarily mean hacking back! Configure ModSecurity to en?ce bad guys to iden?fying themselves! Techniques for making bad guys stand out! HTML comments! <!- - - shorten to /e/t/applogic to get error - - - >! robots.txt entries! /admin/remotecontrol.aspx! Hidden parameters! Bogus cookies! Use honey traps to take specific ac?ons based on someone taking the bait

Custom Rules! Why write custom rules?! Every web applica?on is a bit different! Need to put in a patch while development works on a fix! Need to mask data that shouldn t be logged! Want to lay traps for the bad guys to fall into! Don t mix custom rules with distributed rules!

Example Custom Rule SecRule REQUEST_URI REQUEST_BODY REQUEST_HEADERS_NAMES REQUEST_HEADERS "history.pushstate history.replacestate" "phase:4,deny,log,msg:'sh5ark historybased attacks detected'

Analysis! Manually analyzing the ModSecurity audit log may be hazardous to your mental health! Decide what to look for, then find some tools

What Are We Looking For?! Recent ModSecurity Alerts! SQL Injec?on! Cross Site Scrip?ng (XSS)! Command Injec?on! Cookie Tampering, etc! Any interac?on with our honey traps! Changes in the volume of applica?on errors! Changes in the volume of login a0empts! Applica?on ac?vity in odd?me frames! What data did an a0acker send and what did he receive?

Audit Console! Java applica?on wri0en for ModSecurity log analysis! Creates a sensor which receives informa?on via RPC interface! Configure mlogc in Apache and ModSecurity to send events to the Audit Console listener

Audit Console Dashboard

Audit Console Event Viewer

Splunk! Takes pre0y much any data and makes it searchable! Very flexible query language! Easily combine your Apache and ModSecurity logs! Build your own applica?ons to monitor and search ModSecurity! h0p://kura2gurun.blogspot.com/2011/11/mod- security2- apps- for- splunk.html! Regex for source type:! - - [a- f0-9]+- [A B C I J D E F H Z]- -

ModSecurity Resources! Reference Manual! h0ps://github.com/spiderlabs/modsecurity/wiki/ Reference- Manual! Data Formats! h0ps://github.com/spiderlabs/modsecurity/wiki/ ModSecurity- 2- Data- Formats! Presenta?ons! h0p://vimeo.com/search?q=ryan+barne0+modsecurity! Books! ModSecurity Handbook! Web Applica?on Defender s Cookbook

Thank You! Jason Wood Email: jason@secureideas.com Twi0er: @Jason_Wood