Hands-On Ethical Hacking and Network Defense 2 nd Edition Chapter 10 Hacking Web Servers Revised 10-19-10.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

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.
Hacking Web Servers April 15, 2010 MIS 4600 – MBA © Abdou Illia.
Web Application Architecture Bird Book pp Client Server Model.
Server-Side vs. Client-Side Scripting Languages
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
INTERNET DATABASE Chapter 9. u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Introduction to Web Interface Technology (CSE2030)
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
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.
How Clients and Servers Work Together. Objectives Learn about the interaction of clients and servers Explore the features and functions of Web servers.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Chapter 6: Hostile Code Guide to Computer Network Security.
Hands-On Ethical Hacking and Network Defense
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Linux Operations and Administration
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Workshop 3 Web Application Security Li Weichao March
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
Hands-On Ethical Hacking and Network Defense Second Edition Chapter 10 Hacking Web Servers.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Cross-Site Scripting Vulnerabilities Adam Doupé 11/24/2014.
Principles of Computer Security: CompTIA Security + ® and Beyond, Third Edition © 2012 Principles of Computer Security: CompTIA Security+ ® and Beyond,
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
Ladd Van Tol Senior Software Engineer Security on the Web Part One - Vulnerabilities.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
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.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Web Applications Testing By Jamie Rougvie Supported by.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Introduction and Principles Web Server Scripting.
WEB SERVER SOFTWARE FEATURE SETS
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Database Connectivity and Server-Side Scripting Chapter 12.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
ISA 330 Introduction to Proactive System Security Philip Robbins – November 9, 2013 Hacking Web Servers and Applications Information Security & Assurance.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
CITA 352 Chapter 10 Hacking Web Servers. Understanding Web Applications Writing a program without bugs –Nearly impossible –Some bugs create security vulnerabilities.
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
Hands-On Ethical Hacking and Network Defense 2nd Edition
Tonga Institute of Higher Education IT 141: Information Systems
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
PHP / MySQL Introduction
Tonga Institute of Higher Education IT 141: Information Systems
Lecture 2 - SQL Injection
Tonga Institute of Higher Education IT 141: Information Systems
Hands-On Ethical Hacking and Network Defense
Presentation transcript:

Hands-On Ethical Hacking and Network Defense 2 nd Edition Chapter 10 Hacking Web Servers Revised

Objectives Describe Web applications Explain Web application vulnerabilities Describe the tools used to attack Web servers

Client’s Browser Internet Explorer or Firefox Web Server IIS or Apache HTTPHTTPS

Web Servers The two main Web servers are Apache (Open source) and IIS (Microsoft) Image from netcraft.com (link Ch 10c)

Understanding Web Applications It is nearly impossible to write a program without bugs Some bugs create security vulnerabilities Some bugs create security vulnerabilities Web applications also have bugs Web applications have a larger user base than standalone applications Web applications have a larger user base than standalone applications Bugs are a bigger problem for Web applications Bugs are a bigger problem for Web applications

Web Application Components Static Web pages Created using HTML Created using HTML Dynamic Web pages Need special components Need special components tags tags Common Gateway Interface (CGI) scripts Active Server Pages (ASP) PHPColdFusion Scripting languages like JavaScript ODBC (Open Database connector)

Web Forms Use the element or tag in an HTML document Allows customer to submit information to the Web server Allows customer to submit information to the Web server Web servers process information from a Web form by using a Web application Easy way for attackers to intercept data that users submit to a Web server

Web Forms (continued) Web form example <html><body><form> Enter your username: <br> Enter your password: </form></body></html>

Client’s Browser HTML Forms JavaScript Web Server CGI Scripts HTTPHTTPS

Common Gateway Interface (CGI) Handles moving data from a Web server to a Web browser The majority of dynamic Web pages are created with CGI and scripting languages Describes how a Web server passes data to a Web browser Relies on Perl or another scripting language to create dynamic Web pages Relies on Perl or another scripting language to create dynamic Web pages

CGI Languages CGI programs can be written in different programming and scripting languages C or C++ C or C++ Perl Perl Unix shell scripting Unix shell scripting Visual Basic Visual Basic FORTRAN FORTRAN

Common Gateway Interface (CGI) (continued) CGI example Written in Perl Written in Perl Hello.pl Hello.pl Should be placed in the cgi-bin directory on the Web server Should be placed in the cgi-bin directory on the Web server#!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello Security Testers!";

Another CGI Example Link Ch 10a: Sam’s Feedback Form Link Ch 10b alternate (at bottom of page): CGI Script in Perl that processes the data from the form

Active Server Pages (ASP) Microsoft’s server-side script engine HTML pages are static—always the same HTML pages are static—always the same ASP creates HTML pages as needed. They are not static ASP creates HTML pages as needed. They are not static ASP uses scripting languages such as JScript or VBScript Not all Web servers support ASP IIS supports ASP IIS supports ASP Apache doesn’t support ASP as well Apache doesn’t support ASP as well

Active Server Pages (ASP) You can’t see the source of an ASP page from a browser This makes it harder to hack into, although not impossible ASP examples at links Ch 10d, e, f

Apache Web Server Apache is the most popular Web Server program Advantages Stable and reliable Stable and reliable Works on just about any *NIX and Windows platform Works on just about any *NIX and Windows platform It is free and open source It is free and open source See links Ch 10g, 10h

Using Scripting Languages Dynamic Web pages can be developed using scripting languages VBScript VBScript JavaScript JavaScript PHP PHP

PHP: Hypertext Processor (PHP) Enables Web developers to create dynamic Web pages Similar to ASP Similar to ASP Open-source server-side scripting language Can be embedded in an HTML Web page using PHP tags Can be embedded in an HTML Web page using PHP tags Users cannot see PHP code in their Web browser Used primarily on UNIX systems Also supported on Macintosh and Microsoft platforms Also supported on Macintosh and Microsoft platforms

PHP Example <html><head><title>Example</title></head><body><?php echo 'Hello, World!'; ?></body></html> See links Ch 10k, 10l See links Ch 10k, 10l PHP has known vulnerabilities See links Ch 10m, 10n See links Ch 10m, 10n PHP is often used with MySQL Databases

ColdFusion Server-side scripting language used to develop dynamic Web pages Created by the Allaire Corporation Purchased by Macromedia, now owned by Adobe -- Expensive Purchased by Macromedia, now owned by Adobe -- Expensive Uses its own proprietary tags written in ColdFusion Markup Language (CFML) CFML Web applications can contain other technologies, such as HTML or JavaScript

ColdFusion Example <html><head><title>Ex</title></head><body> </body></html> See links Ch 10o See links Ch 10o

ColdFusion Vulnerabilities See links Ch 10p, 10q

VBScript Visual Basic Script is a scripting language developed by Microsoft You can insert VBScript commands into a static HTML page to make it dynamic Provides the power of a full programming language Provides the power of a full programming language Executed by the client’s browser Executed by the client’s browser

VBScript Example <html><body> document.write("<h1>Hello!</h1>") document.write("Date Activated: " & date()) </script></body></html> See link Ch 10r – works in IE, but not in Firefox Firefox does not support VBScript (link Ch 10s)

VBScript vulnerabilities See links Ch 10t, 10u See links Ch 10t, 10u

JavaScript Popular scripting language JavaScript also has the power of a programming language Branching Branching Looping Looping Testing Testing

JavaScript Example <html><head> function chastise_user(){ alert("So, you like breaking rules?") document.getElementByld("cmdButton").focus( )} </script></head> Don't click the button! Don't click the button! <form> </form></body></html> See link Ch 10v – works in IE and Firefox See link Ch 10v – works in IE and Firefox

JavaScript Vulnerabilities See link Ch 10w

iClicker Questions

What is the most popular Web server? A.Apache B.Internet Explorer C.Firefox D.IIS E.None of the above 1 of 4

What language uses tags like the example shown below? A.HTML B.ColdFusion C.JavaScript D.PHP E.ASP 2 of 4

Which language is a proprietary server-side scripting language developed by Microsoft? A.HTML B.ColdFusion C.JavaScript D.PHP E.ASP 3 of 4

What language is typically used to make a login form like this? A.PHP B.Perl C.VBScript D.ASP E.HTML 4 of 4

Client’s Browser HTTP or HTTPS Web Server Apache or IIS HTML Forms CGI Scripts Database SQL Server or Oracle or MySQL ODBC or OLE DB Or ADO

Connecting to Databases Web pages can display information stored on databases There are several technologies used to connect databases with Web applications Technology depends on the OS used Technology depends on the OS usedODBC OLE DB ADO Theory is the same Theory is the same

Open Database Connectivity (ODBC) Standard database access method developed by the SQL Access Group ODBC interface allows an application to access Data stored in a database management system (DBMS) Data stored in a database management system (DBMS) Can use Oracle, SQL, or any DBMS that understands and can issue ODBC commands Can use Oracle, SQL, or any DBMS that understands and can issue ODBC commands Interoperability among back-end DBMS is a key feature of the ODBC interface

Open Database Connectivity (ODBC) (continued) ODBC defines Standardized representation of data types Standardized representation of data types A library of ODBC functions A library of ODBC functions Standard methods of connecting to and logging on to a DBMS Standard methods of connecting to and logging on to a DBMS

OLE DB and ADO Object Linking and Embedding Database (OLE DB) and ActiveX Data Objects (ADO) These two more modern, complex technologies replace ODBC and make up"Microsoft’s Universal Data Access“ These two more modern, complex technologies replace ODBC and make up"Microsoft’s Universal Data Access“ See link Ch 10x See link Ch 10x

Understanding Web Application Vulnerabilities Many platforms and programming languages can be used to design a Web site Application security is as important as network security

Attackers controlling a Web server can Deface the Web site Deface the Web site Destroy or steal company’s data Destroy or steal company’s data Gain control of user accounts Gain control of user accounts Perform secondary attacks from the Web site Perform secondary attacks from the Web site Gain root access to other applications or servers Gain root access to other applications or servers

Open Web Application Security Project (OWASP) Open, not-for-profit organization dedicated to finding and fighting vulnerabilities in Web applications Open, not-for-profit organization dedicated to finding and fighting vulnerabilities in Web applications Publishes the Ten Most Critical Web Application Security Vulnerabilities Publishes the Ten Most Critical Web Application Security Vulnerabilities

Top-10 Web application vulnerabilities Cross-site scripting (XSS) flaws Attackers inject code into a web page, such as a forum or guestbook Attackers inject code into a web page, such as a forum or guestbook When others user view the page, confidential information is stolen When others user view the page, confidential information is stolen See link Ch 10za See link Ch 10za Command injection flaws An attacker can embed malicious code and run a program on the database server An attacker can embed malicious code and run a program on the database server Example: SQL Injection Example: SQL Injection

Top-10 Web application vulnerabilities Malicious file execution Users allowed to upload or run malicious files Users allowed to upload or run malicious files Unsecured Direct Object Reference Information in the URL allows a user to reference files, directories, or records Information in the URL allows a user to reference files, directories, or records Cross-site Request Forgery (CSRF) Stealing an authenticated session, by replaying a cookie or other token Stealing an authenticated session, by replaying a cookie or other token

Top-10 Web application vulnerabilities Information Leakage and Incorrect Error Handling Error messages that give away too much information Error messages that give away too much information Broken Authentication and Session Management Allow attackers to steal cookies or passwords Allow attackers to steal cookies or passwords

Top-10 Web application vulnerabilities Unsecured cryptographic Storage Storing keys, certificates, and passwords on a Web server can be dangerous Storing keys, certificates, and passwords on a Web server can be dangerous Unsecured Communication Using HTTP instead of HTTPS Using HTTP instead of HTTPS Failure to Restrict URL Access Security through obscurity Security through obscurity Hoping users don't find the "secret" URLs Hoping users don't find the "secret" URLs

Cross-Site Scripting (XSS) One client posts active content, with tags or other programming content When another client reads the messages, the scripts are executed in his or her browser One user attacks another user, using the vulnerable Web application as a weapon 47

alert("XSS vulnerability!") alert(document.cookie) window.location=" 48

XSS Scripting Effects Steal another user's authentication cookie Hijack session Harvest stored passwords from the target's browser Take over machine through browser vulnerability Redirect Webpage Many, many other evil things… 49

Application Vulnerabilities Countermeasures (continued) WebGoat project Helps security testers learn how to perform vulnerabilities testing on Web applications Helps security testers learn how to perform vulnerabilities testing on Web applications Developed by OWASP Developed by OWASP It’s excellent, and now has video tutorials

Assessing Web Applications Issues to consider Dynamic Web pages Dynamic Web pages Connection to a backend database server Connection to a backend database server User authentication User authentication What platform was used? What platform was used?

Does the Web Application Use Dynamic Web Pages? Static Web pages do not create a secure environment IIS attack example: Directory Traversal Adding..\ to a URL refers to a directory above the Web page directory Adding..\ to a URL refers to a directory above the Web page directory Early versions of IIS filtered out \, but not %c1%9c, which is a Unicode version of the same character Early versions of IIS filtered out \, but not %c1%9c, which is a Unicode version of the same character See link Ch 10 zh See link Ch 10 zh

Connection to a Backend Database Server Security testers should check for the possibility of SQL injection being used to attack the system SQL injection involves the attacker supplying SQL commands on a Web application field

SQL Injection Example HTML form collects name and pw SQL then uses those fields: SELECT * FROM customer WHERE username = ‘name' AND password = ‘pw' If a hacker enters a name of ’ OR 1=1 -- The SQL becomes: SELECT * FROM customer WHERE username = ‘’ OR 1=1 --' AND password = ‘pw‘ Which is always true, and returns all the records

HackThisSite

Connection to a Backend Database Server Basic testing should look for Whether you can enter text with punctuation marks Whether you can enter text with punctuation marks Whether you can enter a single quotation mark followed by any SQL keywords Whether you can enter a single quotation mark followed by any SQL keywords Whether you can get any sort of database error when attempting to inject SQL Whether you can get any sort of database error when attempting to inject SQL

User Authentication Many Web applications require another server to authenticate users Examine how information is passed between the two servers Encrypted channels Encrypted channels Verify that logon and password information is stored on secure places Authentication servers introduce a second target

What Platform Was Used? Popular platforms include: IIS with ASP and SQL Server (Microsoft) IIS with ASP and SQL Server (Microsoft) Linux, Apache, MySQL, and PHP (LAMP) Linux, Apache, MySQL, and PHP (LAMP) Footprinting is used to find out the platform The more you know about a system the easier it is to gather information about its vulnerabilities The more you know about a system the easier it is to gather information about its vulnerabilities

Tools of Web Attackers and Security Testers Choose the right tools for the job Attackers look for tools that enable them to attack the system They choose their tools based on the vulnerabilities found on a target system or application They choose their tools based on the vulnerabilities found on a target system or application

Web Tools Cgiscan.c: CGI scanning tool Written in C in 1999 by Bronc Buster Written in C in 1999 by Bronc Buster Tool for searching Web sites for CGI scripts that can be exploited Tool for searching Web sites for CGI scripts that can be exploited One of the best tools for scanning the Web for systems with CGI vulnerabilities One of the best tools for scanning the Web for systems with CGI vulnerabilities See link Ch 10zi

cgiscan and WebGoat

Web Tools (continued)

Wfetch: GUI tool from Microsoft Displays information that is not normally shown in a browser, such as HTTP headers Displays information that is not normally shown in a browser, such as HTTP headers It also attempts authentication using It also attempts authentication using Multiple HTTP methods Configuration of host name and TCP port HTTP 1.0 and HTTP 1.1 support Anonymous, Basic, NTLM, Kerberos, Digest, and Negotiation authentication types Multiple connection types Proxy support Client-certificate support See link Ch 10zl See link Ch 10zl

iClicker Questions

What attack is this person attempting? A.Directory Traversal B.SQL Injection C.XSS D.Man-in-the-Middle E.Sniffing 1 of 4

What attack is this person attempting? A.Directory Traversal B.SQL Injection C.XSS D.Man-in-the-Middle E.Sniffing 2 of 4

Which language contains statements like the example below? SELECT * FROM customers WHERE username='name' AND password='pw‘ A.HTML B.JavaScript C.ODBC D.SQL E.PHP 3 of 4

What attack is being performed below? A.Directory Traversal B.SQL Injection C.XSS D.Man-in-the-Middle E.Sniffing 4 of 4