Securing Web Applications with Information Flow Tracking

Slides:



Advertisements
Similar presentations
Runtime Prevention & Recovery Protect existing applications Advantages: Prevents vulnerabilities from doing harm Safe mode for Web application execution.
Advertisements

Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems © 2002, Predictive Systems.
Webgoat.
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.
Hands-on SQL Injection Attack and Defense HI-TEC July 21, 2013.
Infosec 2012 | 25/4/12 Application Performance Monitoring Ofer MAOR CTO Infosec 2012.
Finding Application Errors and Security Flaws Using PQL: a Program Query Language MICHAEL MARTIN, BENJAMIN LIVSHITS, MONICA S. LAM PRESENTED BY SATHISHKUMAR.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
OWASP WEBGOAT Alaa Darabseh Department of Computer Science
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
ReferencesReferences DiscussionDiscussion Vulnerability Example: SQL injection Auditing Tool for Eclipse LAPSE: a Security Auditing Tool for Eclipse IntroductionIntroductionResultsResults.
1 Static Analysis for Bug Finding Benjamin Livshits.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
Information Networking Security and Assurance Lab National Chung Cheng University 1 Top Vulnerabilities in Web Applications (I) Unvalidated Input:  Information.
Context-Sensitive Program Analysis as Database Queries Team: John Whaley, Ben Livshits, Michael Martin, Dzintars Avots, Michael Carbin, Chris Unkel.
Web Application Security An Introduction. OWASP Top Ten Exploits *Unvalidated Input Broken Access Control Broken Authentication and Session Management.
Dec 13 th CS555 presentation1 Yiwen Wang --“Securing the DB may be the single biggest action an organization can take to protect its assets” David C. Knox.
The 10 Most Critical Web Application Security Vulnerabilities
Web Application Security
Web Hacking 1. Overview Why web HTTP Protocol HTTP Attacks 2.
Web Security Overview Lohika ASC team 2009
Testing Tools. Categories of testing tools Black box testing, or functional testing Testing performed via GUI. The tool helps in emulating end-user actions.
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Ladd Van Tol Senior Software Engineer Security on the Web Part One - Vulnerabilities.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Web 2.0 Security James Walden Northern Kentucky University.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Security Scanners Mark Shtern. Popular attack targets Web – Web platform – Web application Windows OS Mac OS Linux OS Smartphone.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
OWASP Top Ten #1 Unvalidated Input. Agenda What is the OWASP Top 10? Where can I find it? What is Unvalidated Input? What environments are effected? How.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Input Validation – common associated risks  ______________ user input controls SQL statements ultimately executed by a database server
nd Joint Workshop between Security Research Labs in JAPAN and KOREA Marking Scheme for Semantic- aware Web Application Security HPC.
Web Applications Testing By Jamie Rougvie Supported by.
Finding Security Vulnerabilities in Java Applications with Static Analysis Reviewed by Roy Ford.
CS526Topic 12: Web Security (2)1 Information Security CS 526 Topic 9 Web Security Part 2.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Pointer Analysis – Part II CS Unification vs. Inclusion Earlier scalable pointer analysis was context- insensitive unification-based [Steensgaard.
OWASP Building Secure Web Applications And the OWASP top 10 vulnerabilities.
What Is XSS ? ! Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web applications. XSS enables attackers to.
Databases Kevin Wright Ben Bruckner Group 40. Outline Background Vulnerabilities Log File Cleaning This Lab.
Example – SQL Injection MySQL & PHP code: // The next instruction prompts the user is to supply an ID $personID = getIDstringFromUser(); $sqlQuery = "SELECT.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
Database and Cloud Security
Group 18: Chris Hood Brett Poche
Module: Software Engineering of Web Applications
Web Application Vulnerabilities
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
Security: Exploits & Countermeasures
Web-Technology Exam preparation.
World Wide Web policy.
Cross-Site Scripting Travis Deyarmin.
SQL Injection.
Example – SQL Injection
SQL Injection Attacks Many web servers have backing databases
Marking Scheme for Semantic-aware Web Application Security
Chapter 27 WWW and HTTP.
CSC 495/583 Topics of Software Security Intro to Web Security
Web Security CS 136 Computer Security Peter Reiher March 11, 2010
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
Security: Exploits & Countermeasures
CS5123 Software Validation and Quality Assurance
Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems
PHP-II.
Exploring DOM-Based Cross Site Attacks
Presentation transcript:

Securing Web Applications with Information Flow Tracking Monica Lam Stanford University with Michael Martin, Benjamin Livshits, John Whaley, Michael Carbin, Dzin Avots, Chris Unkel

Web Application Vulnerabilities 50% databases had a security breach [Computer crime & security survey, 2002] 92% Web applications are vulnerable [Application Defense Center, 2004] 48% of all vulnerabilities Q3-Q4, 2004 [Symantec May, 2005]

Top Ten Security Flaws in Web Applications [OWASP] Unvalidated Input Broken Access Control Broken Authentication and Session Management Cross Site Scripting (XSS) Flaws Buffer Overflows Injection Flaws Improper Error Handling Insecure Storage Denial of Service Insecure Configuration Management

Confidential information leak Web Applications Evil Input Confidential information leak Hacker Browser Web App Database

Give me Bob’s credit card # SQL Injection Errors Hacker Browser Web App Database Give me Bob’s credit card # Delete all records

Happy-go-lucky SQL Query User supplies: name, password Java program: String query = “SELECT UserID, Creditcard FROM CCRec WHERE Name = ” + name + “ AND PW = ” + password

Fun with SQL “ — ”: “the rest are comments” in Oracle SQL SELECT UserID, CreditCard FROM CCRec WHERE: Name = bob AND PW = foo Name = bob— AND PW = x Name = bob or 1=1— AND PW = x Name = bob; DROP CCRec— AND PW = x

Vulnerabilities in Web Applications Inject Parameters Hidden fields Headers Cookie poisoning Exploit SQL injection Cross-site scripting HTTP splitting Path traversal X Cross-site scripting is an attack on applications that fail to fil- ter or quote HTML metacharacters in user input used in dynami- cally generated Web pages. HTTP response splitting is an attack on applications that fail to filter or quote newlines in header information. It enables vari- ous other attacks such as Web cache poisoning, cross user deface- ment, hijacking pages with sensitive user information, and cross- site scripting [21]. The crux of the HTTP response splitting technique is that the attacker may cause two HTTP responses to be generated in response to one maliciously constructed request. For HTTP splitting to be possible, the vulnerable application must include unchecked input as part of a response header sent back to the client. Path traversal vulnerabilities allow a hacker to access or con- trol files outside of the intended path [31, 40]. They occur when applications use unchecked user input in a path or file name; in- put normally arrives via URL input parameters, cookies, or HTTP request headers.

Key: Information Flow

A Simple SQL Injection Pattern o = req.getParameter ( ); stmt.executeQuery ( o );

In Practice ParameterParser.java:586 String session.ParameterParser.getRawParameter(String name) public String getRawParameter(String name) throws ParameterNotFoundException { String[] values = request.getParameterValues(name); if (values == null) { throw new ParameterNotFoundException(name + " not found"); } else if (values[0].length() == 0) { throw new ParameterNotFoundException(name + " was empty"); } return (values[0]); ParameterParser.java:570 String session.ParameterParser.getRawParameter(String name, String def) public String getRawParameter(String name, String def) { try { return getRawParameter(name); } catch (Exception e) { return def; }

In Practice (II) ChallengeScreen.java:194 Element lessons.ChallengeScreen.doStage2(WebSession s) String user = s.getParser().getRawParameter( USER, "" ); StringBuffer tmp = new StringBuffer(); tmp.append("SELECT cc_type, cc_number from user_data WHERE userid = '“); tmp.append(user); tmp.append("'“); query = tmp.toString(); Vector v = new Vector(); try { ResultSet results = statement3.executeQuery( query ); ...

PQL: Program Query Language o = req.getParameter ( ); stmt.executeQuery ( o ); Query on the dynamic behavior based on object entities Abstracting away information flow

Dynamic vs. Static Pattern o = req.getParameter ( ); stmt.executeQuery (o); Dynamically: p1 = req.getParameter ( ); stmt.executeQuery (p2); Statically: p1 and p2 point to same object? Pointer alias analysis

Flow-Insensitive Pointer Analysis Objects allocated by same line of code are given the same name. Datalog pts(p,o1) pts(q,o2) hpts(o1,f,o2) pts(r,o2) o1: p = new Object(); o2: q = new Object(); p.f = q; r = p.f; p o1 f q o2 r

Inference Rule in Datalog Assignments: pts (v1, h1) :- “v1 = v2 ” & pts (v2, h1). v1 = v2; v2 h1 Now let me show you how we actually specify the algorithm. Here is the Datalog rule to handle assignment instructions. Datalog looks like Prolog, but operates on a relation at a time. What it says is if everything on the right hand side is true, then the left hand side is also true. What this rule says is this: (Read slowly:) © v1 points to h1 if there is an assignment instruction v1 = v2, and v2 points to h1. That’s it. So this is just transitive closure. Let’s take a look at another rule. v1

Inference Rule in Datalog Stores: hpts(h1, f, h2) :- “v1.f = v2” & pts(v1, h1) & pts(v2, h2). v1.f = v2; v1 h1 Here is the Datalog rule to handle store instructions. What this rule says is: (Read slowly:) © H1.f points to h2 if there is a store instruction v1.f = v2, and v1 points to h1 and v2 points to h2. With me so far? OK f v2 h2

Inference Rule in Datalog Loads: pts(v2, h2) :- “v2 = v1.f ” & pts(v1, h1) & hpts(h1, f, h2). v2 = v1.f; v1 h1 Here is the Datalog rule to handle load instructions. Very similar to the rule for store instructions. What this rule says is this: (Read slowly:) © v2 points to h2 if there is a load instruction v2 = v1.f, and v1 points to h1 and h1.f points to h2. f v2 h2

Pointer Analysis Rules pts(v, h) :- “h: T v = new T()”; pts(v1, h1) :- “v1 = v2” & pts(v2, h1). hpts(h1, f, h2) :- “v1.f = v2” & pts(v1, h1) & pts(v2, h2). pts(v2, h2) :- “v2 = v1.f” & pts(v1, h1) & hpts(h1, f, h2).

Pointer Alias Analysis Specified by a few Datalog rules Creation sites Assignments Stores Loads Apply rules until they converge

Context-Sensitive Pointer Analysis L1: a=malloc(); a=id(a); id(x) id(x) {return x;} L2: b=malloc( ); b=id(b); context-sensitive a L1 x context-insensitive b L2 x

Even without recursion, # of Contexts is exponential!

Top 20 Sourceforge Java Apps 1016 1012 108 104 100

Costs of Context Sensitivity Typical large program has ~1014 paths If you need 1 byte to represent a context: 100 terabytes of storage > 12 times size of Library of Congress Memory: $1.2 million Hard drive: $47,500 Time to read sequentially: 20 days

Cloning-Based Algorithm Whaley&Lam, PLDI 2004 (best paper award) Create a “clone” for every context Apply context-insensitive algorithm to cloned call graph Lots of redundancy in result Exploit redundancy by clever use of BDDs (binary decision diagrams)

Automatic Analysis Generation PQL Ptr analysis in 10 lines Datalog bddbddb (BDD-based deductive database) with Active Machine Learning 1000s of lines 1 year tuning BDD operations BDD: 10,000s-lines library

Benchmarks 9 large, widely used applications Blogging/bulletin board applications Used at a variety of sites Open-source Java J2EE apps Available from SourceForge.net

Vulnerabilities Found SQL injection HTTP splitting Cross-site scripting Path traversal Total Header 6 5 11 Parameter 2 13 Cookie 1 Non-Web 3 9 30