Spectator: Detection and Containment of JavaScript Worms By Livshits & Cui Presented by Colin.

Slides:



Advertisements
Similar presentations
Nick Feamster CS 6262 Spring 2009
Advertisements

Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Java Script Session1 INTRODUCTION.
By Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07)
Ben Livshits and Weidong Cui Microsoft Research Redmond, WA.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
ReferencesReferences DiscussionDiscussion Vulnerability Example: SQL injection Auditing Tool for Eclipse LAPSE: a Security Auditing Tool for Eclipse IntroductionIntroductionResultsResults.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
1 RAKSHA: A FLEXIBLE ARCHITECTURE FOR SOFTWARE SECURITY Computer Systems Laboratory Stanford University Hari Kannan, Michael Dalton, Christos Kozyrakis.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Javascript and the Web Whys and Hows of Javascript.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Prevent Cross-Site Scripting (XSS) attack
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
VEX: VETTING BROWSER EXTENSIONS FOR SECURITY VULNERABILITIES XIANG PAN.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
1 All Your iFRAMEs Point to Us Mike Burry. 2 Drive-by downloads Malicious code (typically Javascript) Downloaded without user interaction (automatic),
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
Computer Security and Penetration Testing
 Two types of malware propagating through social networks, Cross Site Scripting (XSS) and Koobface worm.  How these two types of malware are propagated.
Chapter 8 Cookies And Security JavaScript, Third Edition.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
CSC-682 Cryptography & Computer Security Sound and Precise Analysis of Web Applications for Injection Vulnerabilities Pompi Rotaru Based on an article.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
PHP1-1 PHP Lecture 2 Xingquan (Hill) Zhu
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
AjaxScope & Doloto: Towards Optimizing Client-side Web 2.0 App Performance Ben Livshits Microsoft Research (joint work with Emre.
Chapter 6 Server-side Programming: Java Servlets
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Highly Scalable Distributed Dataflow Analysis Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan Chelsea LeBlancTodd.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Spectator: Detection and Containment of JavaScriptWorms
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Bloom Cookies: Web Search Personalization without User Tracking Authors: Nitesh Mor, Oriana Riva, Suman Nath, and John Kubiatowicz Presented by Ben Summers.
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
© 2011 IBM Corporation Hybrid Analysis for JavaScript Security Assessment Omer Tripp Omri Weisman Salvatore Guarnieri IBM Software Group Sep 2011.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Saner: Composing Static and Dynamic Analysis to Validate Sanitization in Web Applications Davide Balzarotti, Marco Cova, Vika Felmetsger, Nenad Jovanovic,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
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.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Web Database Programming Using PHP
Javascript worms By Benjamin Mossé SecPro
Web Database Programming Using PHP
PHP: Security issues FdSc Module 109 Server side scripting and
Riding Someone Else’s Wave with CSRF
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
Foundations of Network and Computer Security
PHP.
Web DB Programming: PHP
JavaScript CS 4640 Programming Languages for Web Applications
CS5123 Software Validation and Quality Assurance
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Spectator: Detection and Containment of JavaScript Worms By Livshits & Cui Presented by Colin

The Problem AJAX gives JS an environment nearly as flexible as a C/asm on a desktop OS – Buffer overruns allow asm code injection – Tainted string propagation allows JS code injection Now worms can propagate through JS as well

Example: Samy One guy figures out how to embed Javascript in CSS, which MySpace doesn’t filter

Samy (cont.) Visitors to his profile run the JS on page load The script “friends” the author, then adds the same source to their profile. Now anyone who visits that profile would also get infected, and so on…

It Gets Worse… This could potentially work on a site like GMail... Windows Scripting Engine understands JS… Sophos lists over 380 JS worms All known static analyses for finding these bugs are either unsound, or sound for a narrow class of bugs, so we really can’t just find them all statically

Idea for a Solution Monitor the interactions of many users, and watch the propagation of information – If the same information propagates across, say 100 users, this is probably a worm.

Overall Design Server Application Spectator Proxy Site Domain (e.g. myspace.com) Client request tag page tag page id request id

Server-Side Tag Flow Server Interactions – Proxy tags requests containing HTML/JS – Proxy checks for tags in pages pulled from the server …

Client-Side Tag Flow Client Interactions – Proxy issues HTTP-only cookie w/ ID for the set of tags in the current page – Browser sends ID back to proxy w/ each request

Tracking Causality A tag present on a page is assumed to cause the subsequent request Consider a propagation graph:

Propagation Graphs Record propagation of tags on upload Track IPs along with tags Heuristic: If the # of unique IPs along a path exceeds a threshold d, flag a worm Accurately modeling the graph is exponential Accurate GraphApproximate Graph Time to insertO(2 n )O(1) on average Space to track path lengthO(n) Blocking futher propagationO(n)

Simulations Used a MySpace clone to test scaling Three propagation models – Random – Linear – Biased Tested scalability of graph tracking

Graph Insertion Time

Graph Diameter

Proof-of-Concept Exploit Used AJAX blog Implemented a manual-propagation worm Spectator detected and stopped the worm

Discussion Where do false negatives come from? Can a worm trick Spectator by hiding propagation behind legitimate user activity? What assumptions does Spectator make about interactions of individual users (think about multiple windows, tabs…) Is this a good match for Gmail’s HTTPS-only connections?

Static Detection of Security Vulnerabilities in Scripting Languages By Xie & Aiken Presented by Colin

The Problem SQL Injection PHP makes it difficult to do a traditional static analysis – include – extract – dynamic typing – implicit casts everywhere – scoping & uninitialized variables

A Solution A 3-tier static analysis – Symbolic execution to summarize basic blocks Well-chosen symbolic domain – Block summaries make function summaries – Function summaries build a program summary

Symbolic Execution for Basic Blocks Novel choice of symbolic values – Strings modeled as concatenations of literals and non-deterministic containment where β=…|contains(σ)|… – Booleans include an ultra-lightweight use of dependent types: untaint(σ 0,σ 1 )

Block Summaries E: must be sanitized on entry D: locations defined by the block F: value flow T: true if the block exits the program R: return value if not a termination block U: locations untainted by this block

Example Block & Summary validate($q); $r = db_query($q.$a); return $r; E: {$a} D: {$r} F: {} T: false R: { _|_ } U: {$q}

Using Block Summaries Paper hand-waves with “well-known techniques” – Backward propagation of sanitization req.s – Forward propagation of sanitized values, returns, with intersection or union at join points Dealing with untaint: if ( ) { } else { }

Function Summaries E: must be sanitized on entry R: values that may propagate to the return val S: values always sanitized by the function X: whether the function always exits the program

Example Function & Summary function runq($q, $a) { validate($q); $r = db_query($q.$a); return $r; } E: {$a} R: contains($q, $a) S: {$q} X: false

Using Function Summaries Replace formal arguments with actual arguments in the summary Cut successors if the function always exits

Checking Main function runq($q, $a) { validate($q); $r = db_query($q.$a); return $r; } runq($q,$a); E: {$a} R: contains($q, $a) S: {$q} X: false E is the set of unsanitized program inputs!

Evaluation App (KLOC)ErrorsBugs (FP)Warnings News Pro (6.5)88 (0)8 myBloggie (9.2)1616 (0)23 PHP Webthings (38.3)2020 (0)6 DCP Portal (121)3939 (0)55 e107 (126)1616 (0)23 Total9999 (0)115 Only errors were investigated, warnings may contain more bugs. Hand-waving on the vulnerability and bug verification details.

PHP Fusion Uses extract($_POST, EXTR_OVERWRITE) Allows exploits by adding extra POST parameters for variables uninitialized in the source Example: $new_pass is uninitialized for ($i=0;$i<7;$i++) $new_pass.= chr(rand(97,122)); … $result = dbquery(“UPDATE ”.$db_prefix.“users SET user_password=md5(‘$new_pass’) WHERE user_id=‘ ”.$data[‘user_id’].” ‘ “);

PHP Fusion Uses extract($_POST, EXTR_OVERWRITE) Allows exploits by adding extra POST parameters for variables uninitialized in the source Example: $new_pass is uninitialized for ($i=0;$i<7;$i++) $new_pass.= chr(rand(97,122)); … $result = dbquery(“UPDATE ”.$db_prefix.“users SET user_password=md5(‘$new_pass’) WHERE user_id=‘ ”.$data[‘user_id’].” ‘ “); Exploit parameter: &new_pass=abc%27%29%2cuser_level=%27103%27%2cuser_aim=%28%27 Produces $result: UPDATE users SET user_password=md5(‘abc’), user_level=‘103’, user_aim=‘?????’) WHERE user_id=‘userid’

Comparing to PQL Xie & Aiken (PHP) Tailored to PHP’s built-in string concatenation Infers sanitization functions from a base set Handles relation between return values and sanitized values Unsound (specialized to strings and booleans) Effective, few FP Roughly, taint inference Livshits & Lam (Java) Requires specifying the propagation relation Sanitizers must be omitted from derivation function Cannot handle sanitization checkers, only producers of new sanitized values Sound Effective, few FP Roughly, taint flow analysis

Discussion How much would need to change to track other sorts of properties? What makes this system unsound? Where exactly does this system lose precision?