Building a Web Security Gateway </bhtalk>



Similar documents
Implementation of Web Application Firewall

<Insert Picture Here> Oracle Web Cache 11g Overview

How to scan/exploit a ssl based webserver. by xxradar. mailto:xxradar@radarhack.com. Version 1.

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

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

Web Intrusion Detection with ModSecurity. Ivan Ristic

Basic & Advanced Administration for Citrix NetScaler 9.2

Oracle9i Application Server: Options for Running Active Server Pages. An Oracle White Paper July 2001

Information Supplement: Requirement 6.6 Code Reviews and Application Firewalls Clarified

How To Protect A Web Application From Attack From A Trusted Environment

The mod_proxy Cookbook

Linux Server Support by Applied Technology Research Center. Proxy Server Configuration

Nginx 1 Web Server Implementation

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

LAMP Secure Web Hosting. A.J. Newmaster & Matt Payne 8/10/2005

1Intro. Apache is an open source HTTP web server for Unix, Apache

2013 MONITORAPP Co., Ltd.

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

Introduction to ServerIron ADX Application Switching and Load Balancing. Module 6: Content Switching (CSW) Revision 0310

Information Technology Policy

12. Firewalls Content

Barracuda Syslog Barracuda Web Site Firewall

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

Migrating the SSL Offloading Configuration of the Alteon Application Switch 2424-SSL to AlteonOS version

Information Security Measures and Monitoring System at BARC. - R.S.Mundada Computer Division B.A.R.C., Mumbai-85

Apache httpd v2.4: Reverse Proxy. (The Hidden Gem) Jim Jagielski

Lecture 8a: WWW Proxy Servers and Cookies

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

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

Web Application Firewall

Building Your Firewall Rulebase Lance Spitzner Last Modified: January 26, 2000

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

Advanced Administration for Citrix NetScaler 9.0 Platinum Edition

The course will be run on a Linux platform, but it is suitable for all UNIX based deployments.

Apache Tomcat & Reverse Proxies

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture # Apache.

Imperva s Response to Information Supplement to PCI DSS Requirement Section 6.6

Architecture. The DMZ is a portion of a network that separates a purely internal network from an external network.

Lecture 8a: WWW Proxy Servers and Cookies

Websense Web Security Gateway: Integrating the Content Gateway component with Third Party Data Loss Prevention Applications

THE SMARTEST WAY TO PROTECT WEBSITES AND WEB APPS FROM ATTACKS

Websense Support Webinar: Questions and Answers

Intrusion detection for web applications

Apache 2.2 and mod_proxy_balancer

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP Edge Gateway for Layered Security and Acceleration Services

Policy Guide Access Manager 3.1 SP5 January 2013

Firewalls. Chapter 3

What is Web Security? Motivation

Sophos Mobile Control Technical guide

DEPLOYMENT GUIDE Version 1.1. Deploying F5 with IBM WebSphere 7

Barracuda Web Application Firewall vs. Intrusion Prevention Systems (IPS) Whitepaper

Firewalls. Network Security. Firewalls Defined. Firewalls

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

Integrating the F5 BigIP with Blackboard

SuperLumin Nemesis. Administration Guide. February 2011

Where every interaction matters.

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

Playing with Web Application Firewalls

HTTP Reverse Proxy Scenarios

How To Use Netscaler As An Afs Proxy

304 - APM TECHNOLOGY SPECIALIST

SonicWALL PCI 1.1 Implementation Guide

Deploying the Barracuda Load Balancer with Office Communications Server 2007 R2. Office Communications Server Overview.

Cisco AnyConnect Secure Mobility Solution Guide

CipherMail Gateway Quick Setup Guide

Secure Web Appliance. Reverse Proxy

Cloud Application Security Assessment, Guerrilla Style

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

Configuring Your Gateman Server

Comodo Web Application Firewall Software Version 2.0

DMZ Network Visibility with Wireshark June 15, 2010

Repeater. BrowserStack Local. browserstack.com 1. BrowserStack Local makes a REST call using the user s access key to browserstack.

Exam : 1Y Citrix Access Gateway 8.0 Enterprise Edition: Administration. Title : Version : DEMO

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

How to Configure Captive Portal

Configuration Worksheets for Oracle WebCenter Ensemble 10.3

What should a hacker know about WebDav? Vulnerabilities in various WebDav implementations

Architecture and Data Flow Overview. BlackBerry Enterprise Service Version: Quick Reference

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

Rails Cookbook. Rob Orsini. O'REILLY 8 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

Web Application Security. Radovan Gibala Senior Field Systems Engineer F5 Networks

PRODUCT VERSION: LYNC SERVER 2010, LYNC SERVER 2013, WINDOWS SERVER 2008

Agenda. Understanding of Firewall s definition and Categorization. Understanding of Firewall s Deployment Architectures

Hack Yourself First. Troy troyhunt.com

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

Firewalls. Ingress Filtering. Ingress Filtering. Network Security. Firewalls. Access lists Ingress filtering. Egress filtering NAT

Safety measures in Linux

McAfee Web Gateway Administration Intel Security Education Services Administration Course Training

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

NSFOCUS Web Application Firewall White Paper

Apache HTTP Server. Load-Balancing with Apache HTTPD 2.2 and later. Erik Abele

FortiOS Handbook - Load Balancing VERSION 5.2.2

Anonymity on the Internet Over Proxy Servers

HAProxy 1.5 and beyond

IIS 8 TROUBLESHOOTING FEATURES FOR CF/RAILO ADMINS (UPDATED MAY 18, 2013)

2 Downloading Access Manager 3.1 SP4 IR1

Blackbox Reversing of XSS Filters

Transcription:

<bhtalk> Defending Black Box Web Applications: Building a Web Security Gateway </bhtalk> Building an Open Source Web Security Gateway shawn. moyer : CISO :: agura digital security :: blackhat@agurasec.com

The Black Box App Defined Black Box Web App: You own the security, but not the code Canned apps, appliances, abandonware Legacy apps with minimal dev time available Required by business, but can't be properly secured Vulns are there, but app must remain in production Examples: home-baked stuff, webmail, HRMSes, CMSes, insert your crapware here

Bad news / Disclaimers Front-ending security is not a panacea Reusable input val, secure coding standards, aggressive code auditing, are the optimal path Sorry, no free lunch - unless the vendor pays =) Sooner or later you will have to fix this stuff.

Good news / Nuggets of hope Still You can do more than you're doing now Relatively simple to stop known (CVE / OSVDB, etc) attacks Skiddies / anklebiters are mostly preventable Net benefit is high with minimal cost / effort Better than waiting to get 0wnzored

Meet the WSGW Web Security Gateway: HTTP(s) proxy... on crack OSS version of what a lot of vendors are doing Bundle web security modules and tools in a hardened frontend proxy Central enforcement / auth / auditing point for all web traffic

Meet the WSGW (cont.) More features: Hide / rewrite generated content Scan and validate POSTs / GETs / params Wrap SSL, authentication, other goodies Bonus points: XML firewalling Bonus points: Content caching and acceleration

WSGW Architecture: Placement

Getting Started: Platform Apache proxy on extensively hardened host with minimal install OpenBSD, Trustix, Engarde, Bastille-ified generic distro Minimal services / users No compilers, all apps built with stack protection SSH with two-factor auth from specific hosts Log to remote syslog(-ng) Note: load up on proc / mem: we are parsing all www traffic!

Why Apache? Arguably not secure by default, but highly configurable We need an HTTP proxy that is content-aware. Why reinvent the wheel? mod_filter and the FilterChain directive == efficient inline content inspection with multiple filters, especially w/ 2.x and PCRE Substantial number of free modules and tools to aggregate into an app firewall

WSGW Architecture: Data flow

Building Apache Modules we need (disable everything else): mod_proxy, mod_(disk mem)cache, mod_log_forensic, mod_log_config, mod_auth(dbm ldap), mod_headers, mod_rewrite Static compile of built-in and external modules is a good idea. Note: Off-by-one in mod_rewrite < 2.3 / 2.0.59...

Building Apache Chroot / Jail! Typically a PitA, but mod_security does internal, pre-fork chroot for Apache! (Similar to Postfix / QMail, etc) SecChrootDir /var/www mod_security should be first module loaded in conf for this to behave

External Modules mod_security*: multipurpose IPS / security toolkit for Apache http://www.modsecurity.org mod_proxy_html: content rewriting of proxied (x)html mod_line_edit: sed-fu for any proxied data mod_publisher: rewrite proxied XML http://apache.webthing.com mod_evasive: limit per-ip requests to a reasonable number http://www.nuclearelephant.com/projects/mod_evasive/ * Go home and put ModSec on everything you can. Now. And send Ivan money and cookies.

Headers / Cookies Header rewrites: Header set Server Cern-HTTP/3.0a (no ErrorHeader w/ 2.x! Eeep!) SecServer SecServerSignature "CernHTTP/3.0A (via ModSec) Header set X-Pad "Free the mallocs Header set X-Powered-By Hamsters.NET Header set Public REBOOT, PEEK, POKE, OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK" Header add set-cookie "ASPSESSIONI%d34db33fc4f3; path=/ Header set Via "1.1 squidcache.sporkworks.com (Squid/2.2.STABLE3)" Header set X-Cache "MISS from squishymiddle.sporkworks.com" Mod_headers and mod_usertrack should be capable of cookie rewriting with minimal effort. Map PHPSESSIONID / ASPSESSIONID to new values and track state. In progress...

Headers / Cookies (Cont.) Header Kung-Fu: Modify http_protocol.c (re-order Date / Server) and httpd.h (error codes and messages) in Apache src to further obfuscate.* Not foolproof, but sufficiently random / anomalous headers will fool HTTPrint / scanners / etc. Experiment with HTTPrint and various header / error codes until you get the result you want. * Thanks much to the WASC (webappsec.org) folks for this idea.

Rip out meta tags / info leaks mod_line_edit rewrites content with PCRE: Strip generator and author tag: LeRewriteRule <meta(.*)name=\"generator\"(.*)content=(.*)> <> Ri LeRewriteRule <meta(.*)name=\"author\"(.*)content=(.*)> <> Ri Strip comments. Be careful with Javascript. ProxyHTMLStripComments On XML firewalling : Strip info leakage, fault codes, etc from XML with mod_line_edit. Or, use mod_transform / mod_publisher.

Impersonate static content mod_rewrite and mod_proxy_html: RewriteRule ^/(.*)/(.*)/(.*)/(.*) /index.aspx?$1=$2&$3=$4 [P,L] Normally requires modification to site code, but with mod_proxy_html ProxyHTMLUrlMap (.*)/index.aspx\?(.*)=(.*)&(.*)=(.*) $1/$2/$3/$4/$5/ http://www.sporkworks.com/index.aspx?spork=foon&fork=spoon Presents as: http://www.sporkworks.com/spork/foon/fork/spoon/

And... With input val! Same example, with input validation via mod_rewrite: RewriteRule ^/([a-z]{4})/([a-z]{4,5})/([a-z]{2,7})/([a-za-z0-9]{5,6}) /index.aspx?$1=$2&$3=$4 [P,L] Create regexp for valid param contents, with a max param length for your app. Anything not matching your patterns will be stripped at proxy. Cool, huh? Now add a clean-up rule as the last rule to send any non-matches to the main page, or a canned error page.this is key. RewriteCond!%{REMOTE_HOST} Your.Proxy.IP.ADDY RewriteRule ^/(.*) /error.aspx? [P,L] Note we exclude the proxy itself, otherwise we go into flailing death loop. Also note? to strip query string. Also need rules for any.js,.css, graphics, etc.

Form / POST validation Validate form posts with Mod_Security: SecFilterScanPost On SecFilterSelective POST_PAYLOAD!({a-zA-Z0-9}+) deny,status:403 SecFilterSelective POST_PAYLOAD!CCNUM={0-9} deny,status:403 SecFilterSelective POST_PAYLOAD!LAUNCH_CODE=0s4m42006 deny,status:403... etc.

Belt and suspenders / extras Lots of great ModSec rules at http://www.gotroot.com Write ModSec sigs for any error leakage in your environment (IIS /.NET errors, anything with a path, version info, etc. Redirect to a canned error. Stunnel in client mode allows you to proxy / filter for SSL-only sites. Mod_auth_(ldap dbm vas) allows you to wrap auth here. Mod_evasive can throttle scans, DoS, etc WSGW is a good place to run snort_inline, too. Why not? :)

Thanks! You guys rawk! Thanks much! Updated version of this talk, plus configs, examples, build scripts, recipes, other stuff at SourceForge: http://wsgw.sf.net