Vulnerability Analysis of Web-Based Applications

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.
Hossain Shahriar Mohammad Zulkernine. One of the worst vulnerabilities in web applications It involves the generation of dynamic HTML contents with invalidated.
Incident Handling & Log Analysis in a Web Driven World Manindra Kishore.
What is code injection? Code injection is the exploitation of a computer bug that is caused by processing invalid data. Code injection can be used by.
Closing the Gap: Analyzing the Limitations of Web Application Vulnerability Scanners David Shelly Randy Marchany Joseph Tront Virginia Polytechnic Institute.
Part 2 Authors: Marco Cova, et al. Presented by Brett Parker.
By Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07)
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
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.
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Leveraging User Interactions for In-Depth Testing of Web Applications Sean McAllister, Engin Kirda, and Christopher Kruegel RAID ’08 1 Seoyeon Kang November.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
D ATABASE S ECURITY Proposed by Abdulrahman Aldekhelallah University of Scranton – CS521 Spring2015.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
+ Websites Vulnerabilities. + Content Expand of The Internet Use of the Internet Examples Importance of the Internet How to find Security Vulnerabilities.
NDSS 2007 Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, Giovanni Vigna.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
Automatically Hardening Web Applications Using Precise Tainting Anh Nguyen-Tuong Salvatore Guarnieri Doug Greene Jeff Shirley David Evans University of.
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
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.
JavaScript, Fourth Edition
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
11/16/2012ISC329 Isabelle Bichindaritz1 Web Database Application Development.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 5 “Database and Cloud Security”.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Preventing Web Application Injections with Complementary Character Coding Raymond Mui Phyllis Frankl Polytechnic Institute of NYU Presented at ESORICS.
Website Design Lecture 1. Outline Introduction to the module Outline of the Assessment Schedule Lecture Static XHTML, client side and server side Why.
Chapter 8 Cookies And Security JavaScript, Third Edition.
CSC-682 Cryptography & Computer Security Sound and Precise Analysis of Web Applications for Injection Vulnerabilities Pompi Rotaru Based on an article.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Chapter 6 Server-side Programming: Java Servlets
SEC835 Runtime authentication Secure session management Secure use of cryptomaterials.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Finding Security Vulnerabilities in Java Applications with Static Analysis Reviewed by Roy Ford.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
PwC New Technologies New Risks. PricewaterhouseCoopers Technology and Security Evolution Mainframe Technology –Single host –Limited Trusted users Security.
By Davide Balzarotti Marco Cova Viktoria V. FelmetsgerGiovanni Vigna Presented by: Mostafa Saad.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Security Issues with PHP  PHP installation  PHP programming Willa Zhu & Eugene Burger.
Michael Dalton, Christos Kozyrakis, and Nickolai Zeldovich MIT, Stanford University USENIX 09’ Nemesis: Preventing Authentication & Access Control Vulnerabilities.
 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.
Introduction and Principles Web Server Scripting.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
Java Server Pages Can web pages be created specially for each user?
Database and Cloud Security
Group 18: Chris Hood Brett Poche
Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
WWW and HTTP King Fahd University of Petroleum & Minerals
World Wide Web policy.
Introduction and Principles
Static Detection of Cross-Site Scripting Vulnerabilities
Security mechanisms and vulnerabilities in .NET
PHP / MySQL Introduction
Web Development Using ASP .NET
Lecture 2 - SQL Injection
Exploring DOM-Based Cross Site Attacks
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

Vulnerability Analysis of Web-Based Applications Part 1 Authors: Marco Cova, et al. Presented by: Brett Parker and Tyler Maclean

Outline Intro, Background, Trends Technologies Attacks Vulnerability Analysis

Why web applications? Growth of web-based applications over the years Businesses rely on web-apps to provide service access Web-apps are used in security-critical environments Medical Financial Military

Why vulnerable? Web apps are composition of various infrastructure components Server-side Client-side Infrastructure developed by experienced programmers with solid security skills Applications developed by inexperienced programmers who have little mind for security Vulnerabilities create entry points for entire networks

Vulnerability analysis web vulnerability analysis – allows one to identify security problems in web-based applications at early stages of development and deployment Methodologies Detection model (positive vs. negative) Analysis technique (static vs. dynamic)

Why attack web apps? Widely accessible Interface with backend components Web technology inexpensive Novices develop without security in mind

Model of web vulnerabilities

Trends Symantec catalogued 1,100 new vulnerabilities in web-based applications in 2005 which represented over half the total new vulnerabilities 59% increase from previous semester 109% increase from previous year

Symantec chart

Sources of security problems Architectural choices SQL injection Trust relations Cross site scripting (XSS) Web protocol implementations Response splitting Features provided by languages PHP eval()

How to prevent vulnerabilities? Use a higher-level language Use testing tools Code reviews and audits Web application firewalls

Outline Intro, Background, Trends Technologies Attacks Vulnerability Analysis

CGI Overview “Common Gateway Interface” Mechanism that a server can use to interact with external applications Can be written in almost any language and run on almost any server

CGI Lifecycle Server receives request for CGI program Server creates new process to run specified application Server passes to the application the data from the user’s request Program runs, generates output, and passes output back to server Server passes output back to client CGI process quits

CGI Example in Perl

CGI Advantages/Disadvantages Language-independent Programs can be written in many languages Components can be written in different languages Disadvantages Significant impact on server through creation of new processes

CGI Improvements FastCGI API Extensions Creates pool of processes that can be reused API Extensions ISAPI for Microsoft IIS API for Apache Uses fewer resources

Web application frameworks Web server extended with frameworks used to develop web applications – “plugins” Interpreted or compiled Examples PHP Perl Python J2EE ASP.NET Java Server Pages (JSP)

PHP example

JSP example

Outline Intro, Background, Trends Technologies Attacks Vulnerability Analysis

Behavior of web apps What can be broken? Authentication Authorization Configuration Validation

Interpreter injection Some languages allow dynamic composition and interpretation of code (ex: PHP) eval() preg_replace() system() passthru() backticks() shell_exec() exec() pcntl_exec() popen() proc_open()

PHP eval() example

How to prevent? Sanitization Malicious user input is removed before processing escapeshellarg() espaceshellcmd()

Filename injection Some languages allow dynamic inclusion of files from other locations, used to run other functions or present content to user PHP allows this from remote sites!

PHP example Variable “$skin” having value of “http://[attacker-site]” causes execution of “http://[attacker-site]/header.tpl”

Cross site scripting (XSS) Attacker forces a client (web browser) to run attacker-supplied code (Javascript) in the context of a trusted website TRUST ISSUE FROM BEFORE! Browser violates same origin policy Documents loaded from one site can only get or set the properties of documents from the same site Allows attacker to steal private information Bank account info Cookies Session information

3 Types of XSS Non-persistent (reflected) Persistent (stored) User is tricked into visiting a specially-crafter link with the malicious code embedded When the user visits the page, the code is immediately executed (reflected) at the user Persistent (stored) Malicious code is stored in the vulnerable application Later, the code is presented and executed at the user Blogs, forums, etc. DOM-based Elements of the DOM data structure used maliciously

Another XSS example http://www.webappsec.org/projects/articles/071105.shtml

XSS example

SQL injection When web application uses unsanitized user data to compose queries that are later passed to database for evaluation Attacker can Determine structure of databases/tables Create/delete/change users or permissions use it expose personal information if the result of the query is later rendered in the page

SQL injection example

SQL injection example

Session hijacking Most web apps use HTTP, which is statelss But sometimes, we want to maintain a state Shopping cart How to maintain session state Cookies Server-side session data

Session hijacking If client keeps session state, attacker (dishonest user) can modify state mechanism (ex: cookie, hidden field) Price of an item in shopping cart Prevent by using cryptographic techniques Session fixation Attacker sets up session and obtains session ID Lures the victim into accessing the target application using their fixed session ID Waits for client to perform authentication/authorization Impersonates the session using session ID

Response splitting Attacker injects header termination characters and then his own specially-crafted header When the server generates the response, it will contain multiple copies of certain header lines (the correct one and the attacker-generated one) Intermediate servers on the way back might interpret this response as containing two documents – the original one requested and the one crafted by the attacker Used for web cache poisoning Attacker inserts his own malicious code into the cache using this method

Response splitting example

Another response splitting example http://projects.webappsec.org/HTTP-Response-Splitting

Outline Intro, Background, Trends Technologies Attacks Vulnerability Analysis

Vulnerability analysis The process of assessing the security of an application through auditing of either the application’s code or the application’s behavior for possible security problems Detection models Negative Positive Analysis techniques Static Dynamic

Detection models Negative Positive Model known vulnerabilities using expert knowledge Match the models against application Identify instances of vulnerabilities Positive Model “normal” or “expected” behavior using machine learning techniques Identify abnormailities

Analysis techniques Static Pre-execution techniques for predicting runtime properties of the analyzed program Does not require application to be deployed or executed Account for all possible inputs to the application Have no performance impact on running application Does not require modification of dev environment In theory, no false negatives

Analysis techniques Dynamic Hybrid Series of checks to detect vulnerabilities at runtime Analysis done on a “live” application Less prone to false positives More prone to false negatives, since not all inputs are tested, and not all execution paths are exercised Hybrid Combination of both! Used in practice

Negative detection model Known vulnerabilities modeled, then application is checked for instances of the model Assumption that web-specific vulnerabilities are the result of insecure data flow in application Models attempt to identify instances where untrusted user input propagates the security-critical areas of the application without being checked/sanitized This is called taint propagation

Taint propagation User input or data is marked as “tainted” and its propagation through application is traced (statically or dynamically) to check if it reaches any security-critical areas Models data flow as source and sink Language extended with tained untainted untaint()

PHP popularity Grown tremendously over the last five years On of the most commonly used languages on the web 1,500,000 sites using PHP in March 2000 21,000,000 sites using PHP in March 2006 Most popular Apache module

Static analysis Run analysis on source code of application in attempt to determine where tainted data can reach

WebSSARI One of the first works to do taint propagation analysis for finding vulnerabilities in PHP Targets XSS, SQL injection, script injection PHP is extended with tainted and untainted 3 user-provided files Preconditions to sensitive function Postconditions for sanitization functions All possible sources of user input If tainted data reaches security-critical area, program inserts runtime guards or sanitization routines

WebSSARI

WebSSARI weaknesses Only intra-procedural analysis Dynamic variables, arrays, data structures are considered tainted; reduced precision Limited support for sanitization routines

Xie and Aiken Uses symbolic execution to model the effect of statements inside flow of program using Control Flow Graphs (CFGs) Supports inter-procedural analysis Supports PHP arrays, common data structures, but only a limited set of them No support for object-oriented features of PHP Requires manual sanitization

Livshits and Lam Work on Java language Pointer analysis techniques used on bytecode-level image of the program Uses program query language (PQL) to describe vulnerabilities to be identified But, this requires each vulnerability to be tested by manually describing it in PQL, so unknown vulnerabilities cannot be detected

Livshits and Lam

Weaknesses of static analysis Difficult to parse and understand flow of dynamic scripting languages (PHP) Weakly-typed Dynamic code inclusion Arbitrary code evaluation Susceptible to false positives due to over-analysis

Dynamic analysis Extend interpreter or program itself to collect information as the program runs Track and analyze tainted data as application executes

Perl Taint mode Interpreter executed with –T command-line switch ensures that no data from outside environment (user input, environment variables) can be used in security-critical functions (shell, file modification)

Nguyen-Tuong, et al. Modify PHP interpreter to identify data originated from untrusted sources Strings are tainted at granularity of single character Tainting is propagated across function calls

Nguyen-Tuong, et al.

Haldar, et al. Java JVM extended to support propagation of taintedness for system classes java.lang.String java.lang.StringBuffer

Dynamic anlysis adv/disavd Advantages Modified interpreter is transparent to application No complex analysis framework needed because all information collected comes from program execution Disadvantages Analysis only performed on executed paths; nothing discovered about paths not taken Possible impact on application functionality Can suffer from false positives and false negatives

Static vs. dynamic summary Precision depends highly on complexities of dynamic features in language Dynamic Issues of completeness of analysis Application stability/performance overhead

Thanks! Positive approaches on Wednesday! Questions?