Hands-On Ethical Hacking and Network Defense
Hands-On Ethical Hacking and Network Defense
Objectives
Describe Web applications
Explain Web application vulnerabilities
Describe the tools used to attack Web
servers
Web Server
HTTPS
HTTP
IIS or Apache
Clients
Browser
Internet
Explorer
or Firefox
3
Web Servers
The two main Web servers are Apache
(Open source) and IIS (Microsoft)
Understanding Web
Applications
It is nearly impossible to write a program
without bugs
Web Forms
Use the <form> element or tag in an HTML
document
Web Server
HTTPS
HTTP
CGI Scripts
Clients
Browser
HTML Forms
JavaScript
10
CGI Languages
CGI programs can be written in different
programming and scripting languages
C or C++
Perl
Unix shell scripting
Visual Basic
FORTRAN
12
Written in Perl
Hello.pl
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!";
13
14
16
VBScript
JavaScript
PHP
18
Similar to ASP
19
PHP Example
<html><head><title>Example</title></head>
<body>
<?php
echo 'Hello, World!';
?>
</body></html>
ColdFusion
Server-side scripting language used to
develop dynamic Web pages
Created by the Allaire Corporation
ColdFusion Example
<html><head><title>Ex</title></head>
<body>
<CFLOCATION
URL="www.isecom.org/cf/index.htm"
ADDTOKEN="NO">
</body>
</html>
ColdFusion Vulnerabilities
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
VBScript Example
<html><body>
<script type="text/vbscript">
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)
25
VBScript vulnerabilities
26
JavaScript
Popular scripting language
JavaScript also has the power of a
programming language
Branching
Looping
Testing
27
JavaScript Example
<html><head>
<script type="text/javascript">
function chastise_user(){
alert("So, you like breaking rules?")
document.getElementByld("cmdButton").focus(
)}
</script></head>
<body><h3>Don't click the button!</h3>
<form>
<input type="button" value="Don't Click!"
name="cmdButton"
onClick="chastise_user()" />
</form></body></html>
JavaScript Vulnerabilities
ODBC or
Web Server
Apache or IIS
HTML Forms
CGI Scripts
OLE DB
Or ADO
Database
SQL Server or
Oracle or
MySQL
HTTP or HTTPS
Clients Browser
30
Connecting to Databases
Web pages can display information stored
on databases
There are several technologies used to
connect databases with Web applications
33
34
35
36
37
Buffer overflows
Error-handling problems
Application Vulnerabilities
Countermeasures (continued)
WebGoat project
43
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
45
HackThisSite
47
Connection to a Backend
Database Server
Basic testing should look for
48
User Authentication
Many Web applications require another
server to authenticate users
Examine how information is passed between
the two servers
Encrypted channels
51
Web Tools
Cgiscan.c: CGI scanning tool
52
53
54
55
56