"The Core Rule Set": Generic detection of application layer attacks. Ofer Shezaf OWASP IL Chapter leader CTO, Breach Security

Similar documents
Positive Security Model for Web Applications, Challenges. Ofer Shezaf OWASP IL Chapter leader CTO, Breach Security

"ModSecurity Core Rule Set": An Open Source Rule Set for Generic Detection of Attacks against Web Applications

IT18 Evasion: Bypassing IDS/IPS Systems

Evaluation Criteria for Web Application Firewalls

ModSecurity 2.0 Webcast: Answers To Common Questions

ModSecurity 2.0 Webcast: Answers To Common Questions

Kishin Fatnani. Founder & Director K-Secure. Workshop : Application Security: Latest Trends by Cert-In, 30 th Jan, 2009

Solutions Business Manager Web Application Security Assessment

DenyAll Protect. accelerating. Web Application & Services Firewalls. your applications. DenyAll Protect

Intrusion Detection - Snort

F5 Big-IP Application Security Manager v11

Configuring BIG-IP ASM v12.1 Application Security Manager

WTF. Amichai Shulman, CTO Yaniv Azaria, Security Research TL

Intrusion Detection - Snort

CIT 480: Securing Computer Systems

Intrusion Detection System (IDS) IT443 Network Security Administration Slides courtesy of Bo Sheng

Base64 The Security Killer

BIG-IP Application Security Manager : Attack and Bot Signatures. Version 13.0

GOING WHERE NO WAFS HAVE GONE BEFORE

WASP ModSecurity Core Rule Set (CRS) Project. Ryan Barnett OWASP CRS Project Leader Senior Security Researcher

86% of websites has at least 1 vulnerability and an average of 56 per website WhiteHat Security Statistics Report 2013

SOLUTION BRIEF CA API MANAGEMENT. Enable and Protect Your Web Applications From OWASP Top Ten With CA API Management

Integrated Web Application Firewall (WAF) & Distributed Denial Of Service (DDoS) Mitigation For Today s Enterprises

Web Application Firewall Subscription on Cyberoam UTM appliances

Web Application Security. Philippe Bogaerts

Web Application Defense with Bayesian Attack Analysis

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

SOLUTION BRIEF. Enabling and Securing Digital Business in API Economy. Protect APIs Serving Business Critical Applications

An Introduction to WASC and its projects

Imperva Incapsula Website Security

Using the Cisco ACE Application Control Engine Application Switches with the Cisco ACE XML Gateway

PHP-security Software lifecycle General Security Webserver security PHP security. Security Summary. Server-Side Web Languages

CISCO NETWORKS BORDERLESS Cisco Systems, Inc. All rights reserved. 1

Penetration Testing. James Walden Northern Kentucky University

Advanced Web Application Defense with ModSecurity. Daniel Fernández Bleda & Christian Martorella

The SANS Institute Top 20 Critical Security Controls. Compliance Guide

CSWAE Certified Secure Web Application Engineer

epldt Web Builder Security March 2017

The Top 6 WAF Essentials to Achieve Application Security Efficacy

Dynamic Datacenter Security Solidex, November 2009

Shortcut guide to Web application firewall deployment

NOTHING IS WHAT IT SIEMs: COVER PAGE. Simpler Way to Effective Threat Management TEMPLATE. Dan Pitman Principal Security Architect

Who am I? Sandro Gauci and EnableSecurity Over 8 years in the security industry Published security research papers Tools - SIPVicious and SurfJack

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

Introduction to Ethical Hacking

How to configure the UTM Web Application Firewall for Microsoft Lync Web Services connectivity

NetDefend Firewall UTM Services

NETWORK THREATS DEMAN

Total Security Management PCI DSS Compliance Guide

CLOUD SECURITY: PROTECTING YOUR CLOUD-BASED IT INFRASTRUCTURE. Stephen Coty Chief Security Evangelist

Citrix NetScaler AppFirewall and Web App Security Service

Web Application Penetration Testing

Web Application Firewall

EMERGING THREATS & STRATEGIES FOR DEFENSE. Paul Fletcher Cyber Security

F5 Application Security. Radovan Gibala Field Systems Engineer

Hacking Intranet Websites from the Outside

Cyber Security. Our part of the journey

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt

Activating Intrusion Prevention Service

Fundamentals of Information Systems Security Lesson 5 Auditing, Testing, and Monitoring

Locking down a Hitachi ID Suite server

Practical Automated Web Application Attack Techniques Justin Clarke Gotham Digital Science Gotham Digital Science Ltd

Web Security. Thierry Sans

Security Architect Northeast US Enterprise CISSP, GCIA, GCFA Cisco Systems. BRKSEC-2052_c Cisco Systems, Inc. All rights reserved.

Sucuri Technical Overview

Study of Snort Ruleset Privacy Impact

Web 2.0 and AJAX Security. OWASP Montgomery. August 21 st, 2007

Security+ Guide to Network Security Fundamentals, Third Edition. Chapter 3 Protecting Systems

Intrusion Detection - Snort. Network Security Workshop April 2017 Bali Indonesia

SaaS as a Security Hazard The Google Apps example

Textual Manipulation for SQL Injection Attacks

Integrated Web Application Firewall & Distributed Denial of Service (DDoS) Mitigation Solution

Introduction Who needs WAF anyway? The Death of WAF? Advanced WAF Why F5?

dotdefender User Guide Applicure Web Application Firewall

ANTIVIRUS SITE PROTECTION (by SiteGuarding.com)

How were the Credit Card Numbers Published on the Web? February 19, 2004

Key Considerations in Choosing a Web Application Firewall

Defense-in-Depth Against Malicious Software. Speaker name Title Group Microsoft Corporation

Security

Forum XWall and Oracle Application Server 10g

En partenariat avec CA Technologies. Genève, Hôtel Warwick,

Security Principles SNORT - IDS

Topics. Principles of Intrusion Detection. Intrusion Detection. Characteristics of systems not under attack

Chapter 7. Network Intrusion Detection and Analysis. SeoulTech UCS Lab (Daming Wu)

Advanced Diploma on Information Security

Barracuda Web Application Firewall Foundation - WAF01. Lab Guide

ANTIVIRUS SITE PROTECTION (by SiteGuarding.com)

Web Application Security Evaluation

Cyber Security Audit & Roadmap Business Process and

OUTLINE PERFORMANCE BENCHMARKING 7/23/18 SUB BENCHMARKING THE SECURITY OF SOFTWARE SYSTEMS OR TO BENCHMARK OR NOT TO BENCHMARK

IDS: Signature Detection

The Intrusion Rules Editor

SQL Injection: From Basics To Botnet-Based Attack Automation

Venusense UTM Introduction

The Intrusion Rules Editor

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

Future-ready security for small and mid-size enterprises

THUNDER WEB APPLICATION FIREWALL

The Intrusion Rules Editor

Overview Intrusion Detection Systems and Practices

Transcription:

"The Core Rule Set": Generic detection of application layer attacks Ofer Shezaf OWASP IL Chapter leader CTO, Breach Security

About Breach Security, Inc. The market leader in web application security Headquarters in Carlsbad, CA, with R&D Center in Herzliya, Israel and London, UK. Sales offices in Boston, Austin, Chicago, London and Tel-Aviv Experience with Web security solutions since 1999 Managed by an experienced group of security professionals 55 Employees

ModSecurity Technology An Open Source Application Firewall. The most popular WAF in the world with more than 10,000 installations. An Apache module. Supports either embedded or reverse proxy deployment. Advanced Rules Language. A Swiss Army knife for the experienced user. Also available for free: Core Rule Set An entry level console Professionally Supported by Breach Security. Proxy Mode Embedded Mode

ModSecurityPro M1000 Hardened reverse-proxy Web application firewall appliance based on ModSecurity technology, and additionally: Packaged tested and certified by Breach Security. Web based management. Enhanced Rule Set tailored for specific applications. Support packaged rule sets such as PCI compliance. Plug-and-play Web application security for organizations of any size. Highly competitive pricing

Top Notch Web App Sec Expertise Ivan Ristic, Chief Evangelist Creator of ModSecurity Leads WASC s Web Application Firewall Evaluation Criteria project Written Apache Security for O'Reilly. Ofer Shezaf, CTO WASC Board Member, OWASP IL chapter leader Leader of WASC Web Hacking Incidents Database Project Israeli National Security Background Ryan Barnett, Directory of Training: SANS and Foundstone instructor Written Preventing Web Attacks with Apache for O Reilly Leads WASC s Distributed Honeypot Project

Web Application Firewalls vs. Intrusion Prevention Systems

Multiple Deployment Modes In-Line mode Embedded mode Out of line mode

Three Protection Strategies for WAFs 1. External patching Also known as "just-in-time patching" or "virtual patching". 2. Positive security model An independent input validation envelope. Rules must be adjusted to the application. Automated and continuous learning (to adjust for changes) is the key. 3. Negative security model Looking for bad stuff, Mostly signatures based. Generic but requires some tweaking for each application. IPS?

Virtual Patching Testing reveals that the login field is vulnerable to SQL injection. Login names cannot include characters beside alphanumerical characters. The following rule will help: <LocationMatch "^/app/login.asp$"> SecRule ARGS:username "!^\w+$" "deny,log" </LocationMatch>

Positive security The same, but for every field in every application <LocationMatch "^/exchweb/bin/auth/owaauth.dll$"> SecDefaultAction "log,deny,t:lowercase" SecRule REQUEST_METHOD!POST SecRule ARGS:destination " URL" "t:urldecode" SecRule ARGS:flags "[0-9]{1,2}" SecRule ARGS:username "[0-9a-zA-Z].{256,}" SecRule ARGS:password ".{256,}" SecRule ARGS:SubmitCreds "!Log.On" SecRule ARGS:trusted "!(0 4)" </LocationMatch> Very hard to create, requires learning by: Monitoring outbound traffic (match input to web server request) Caveats: JavaScript, Web Services Monitoring inbound traffic (normal behavior): Caveats: Statistics, attacks in learning period.

Positive Security Site Site Status Site Map URLs Parameters Parameter Types

Negative Security An IPS, but: Deep understanding of HTTP and HTML Breaking up to individual fields: headers, parameters, uploaded files. Validation of field attributes such as content, length or count Correct breakup and matching of transactions and sessions. Compensation for protocol caveats and anomalies, for example cookies. Robust parsing: Unique parameters syntax XML requests (SOAP, Web Services) Anti Evasion features: Decoding Path canonizations Thorough understanding of application layer issues: Apache request line delimiters, PHP parameter names anomalies. Rules instead of signatures: Sessions & state management, Logical operators, Control structures.

IDPS signatures vs. WAF Rules Signatures: Simple text strings or regular expression patterns matched against input data. Usually detect attack vectors for known vulnerabilities, while web applications are usually custom made. Variations on attack vectors are very easy to create Rules: Multiple operators and logical expressions: Is password field length > 8? Selectable anti-evasion transformation functions. Control structures such as IF: Apply different rules based on transactions. Variables, Session & state management: Aggregate events over a sessions. Detect brute force & denial of service. Audit user name for each transaction

The Core Rule Set

Detection of generic app layer attacks Core Rule Set available for ModSecurity at: http://www.modsecurity.org/projects/rules/index.html Probably translatable to any App Firewall Benefits from ModSecurity features: Anti Evasion Granular Parsing Detection Mechanisms: Protocol Validation Generic Attack Signatures Known Vulnerabilities Signatures More

Protocol Validation

Protocol Violations Protocol vulnerabilities such as Response Splitting, Request Smuggling, Premature URL ending: Content length only for none GET/HEAD methods Non ASCII characters or encoding in headers. Valid use of headers (for example, content length is numerical) Proxy Access Attack requests are different due to automation: Missing headers such as Host, Accept, User-Agent. Host is an IP address.

Protocol Policy Policy is usually application specific: Some restrictions can usually be applied generically. White lists can be build for specific environments. Items that can be allowed or restricted: Methods - Allow or restrict WebDAV, block abused methods such as CONNECT, TRACE or DEBUG. File extensions backup files, database files, ini files. Content-Types (and to some extent other headers) Limitations on sizes: Request size, Upload size, # of parameters, length of parameter.

Application Layer Signatures

Snort signature for Bugtraq vulnerability #21799 Exploit: alert tcp $EXTERNAL_NET Does the any -> $HTTP_SERVERS Signature built $HTTP_PORTS ( application for specific exploit accepts POST msg:"bleeding-edge WEB Cacti cmd.php Remote Arbitrary requests? SQL Command Execution Attempt"; flow:to_server,established; uricontent:"/cmd.php?"; nocase; uricontent:"union"; nocase; uricontent:"select"; nocase; reference:cve,cve-2006-6799; reference:bugtraq,21799; An SQL injection does not have to use classtype: web-application-attack; sid:2003334; rev:1; SELECT or UNION ) UNION and SELECT are common English words. So is SELECTION /cacti/cmd.php?1+1111)/**/union/**/select/**/2,0,1,1,127.0.0.1,null,1,null,null,161,500, proc,null,1,300,0, ls - la >./rra/suntzu.log,null,null/**/from/**/host/*+11111 Snort Signature:

Case study: 1=1 Classic example of an SQL injection attacks. Often used as a signature. But, can be avoided easily using: Encoding: 1%3D1 White Space: 1 =%091 Comments 1 /* This is a comment */ = 1 Actually not required at all by attacker. Any true expression would work: 2 > 1 In some cases, a constant would also work. In MS-Access all the following are true: 1, 1, a89, 4-4. No simple generic detection

Generic application layer signatures Detect attack indicators and not attack vectors: xp_cmdshell, <, single quote - Single quote is very much needed to type O'Brien select, union which are English words Aggregate indicators to determine an attack: Very strong indicators: xp_cmdshell, varchar, Sequence: union. select, select top 1 Amount: script, cookie and document appear in the same input field. Sequence over multiple requests from the same source.

Back to Bugtraq vulnerability #21799 The Core Rule Set Generic Detection Supports any type of parameters, SecRule POST, REQUEST_FILENAME ARGS ARGS_NAMES GET or any other REQUEST_HEADERS!REQUEST_HEADERS:Referer \ "(?:\b(?:(?:s(?:elect\b(?:.{1,100}?\b(?:(?:length count top)\b.{1,100 }?\bfrom from\b.{1,100}?\bwhere).*?\b(?:d(?:ump\b.*\bfrom ata_type) (?: to_(?:numbe cha) inst)r)) p_(?:(?:addextendedpro sqlexe)c (?:oacreat prep ar)e execute(?:sql)? makewebtask) ql_(?: \ Every SQL injection related keyword is checked capture,log,deny,t:replacecomments, t:urldecodeuni, t:htmlentitydecode, t:lowercase,msg:'sql Injection Attack. Matched signature <%{TX.0}>',id:'950001',severity:'2' Common evasion techniques are mitigated SQL comments are compensated for

Back to Bugtraq vulnerability #21799 Virtual Patching <LocationMatch :"/cmd.php$"> SecRule QUERY_STRING "^[\d\s]*$ deny,log" </LocationMatch> Or SecRule REQUEST_FILENAME :"/cmd.php$" deny,log" Parameters Must Be Numeric Actually script should not be run remotely Simpler, isn t it?

Odds and Ends

Malicious Robots Detection of malicious robots: Unique request attributes: User-Agent header, URL, Headers Black list of IP addresses Not aimed against targeted attacks, but against general malicious internet activity: Offloads a lot of cyberspace junk & noise Effective against comment spam. Reduce event count. In addition: Detection of security scanners Detection of non malicious robots (such as search engines). Confusing security testing software (HTTPrint)

Trojans and Viruses Major problem at hosting environments Uploading is allowed. Some sites may be secure while others not. Generic detection: Check upload of Viruses. Check upload of Trojans AV software is not very good at that. Check for access to Trojans: Known signatures (x_key header) Generic file management output (gid, uid, drwx, c:\)

Error conditions Last line of defense if all else fails Provide feedback to application developers Important for customer experience Makes life for the hacker harder

Future Plans

Session bases protection: Brute force detection. Scanner and automation detection based on rate and result code. Anomaly scoring. XML protection: Schema validation for known XML payloads, such as SOAP. Context based signature check in XML using XPath.

Thank You! Ofer Shezaf ofers@breach.com