Hands-On Ethical
Hacking and
Network Defense

3rd Edition
Chapter 10
Hacking Web Servers
Revised 1-11-17
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
HTTP
HTTPS
Web Servers
• The two main Web servers are Apache
(Open source) and IIS (Microsoft)
■ Link Ch 10c
Understanding Web Applications
• It is nearly impossible to write a program
without bugs
• Some bugs create security vulnerabilities
• Web applications also have bugs
• Web applications have a larger user base than
standalone applications
• Bugs are a bigger problem for Web
applications
Web Application Components
• Static Web pages
• Created using HTML
• Dynamic Web pages
• Need special components
• <form> tags
• Common Gateway Interface (CGI) scripts
• Active Server Pages (ASP)
• PHP
• ColdFusion
• Scripting languages like JavaScript
• ODBC (Open Database connector)
Web Forms
• Use the <form> element or tag in an HTML
document
• 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:
<input type="text" name="username">
<br>
Enter your password:
<input type="text" name="password">
</form></body></html>
Ch 10: Hacking Web Servers
Client’s Browser
HTML Forms
JavaScript
Web Server
CGI Scripts
HTTP
HTTPS
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
CGI Languages
• CGI programs can be written in different
programming and scripting languages
• C or C++
• Perl
• Unix shell scripting
• Visual Basic
• FORTRAN
Common Gateway Interface
(CGI) (continued)
• CGI example
■ Written in Perl
■ Hello.pl
■ Should be placed in the cgi-bin directory on the
Web server
#!/usr/bin/perl
print "Content-type: text/htmlnn";
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
• 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
• 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
• Works on just about any *NIX and Windows
platform
• It is free and open source
• See links Ch 10g, 10h
Using Scripting Languages
• Dynamic Web pages can be developed
using scripting languages
• VBScript
• JavaScript
• PHP
PHP: Hypertext Processor (PHP)
• Enables Web developers to create dynamic Web
pages
• Similar to ASP
• Open-source server-side scripting language
• Can be embedded in an HTML Web page using PHP
tags <?php and ?>
• Users cannot see PHP code in their Web browser
• Used primarily on UNIX systems
• 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
• PHP has known vulnerabilities
• 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
• 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>
<CFLOCATION URL="www.isecom.org/cf/
index.htm" ADDTOKEN="NO">
</body>
</html>
■ 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
• Executed by the client’s browser
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)
VBScript vulnerabilities
■ See links Ch 10t, 10u
JavaScript
• Popular scripting language
• JavaScript also has the power of a
programming language
• Branching
• Looping
• Testing
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>
■ See link Ch 10v – works in IE and Firefox
JavaScript Vulnerabilities
See link Ch 10w
Ch 10: Hacking Web Servers
Client’s Browser
HTTPorHTTPSWeb 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
• ODBC
• OLE DB
• ADO
• 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)
• 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
• A library of ODBC functions
• 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“
• 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
■ Destroy or steal company’s data
■ Gain control of user accounts
■ Perform secondary attacks from the Web site
■ 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
■ 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
• When others user view the page, confidential
information is stolen
• See link Ch 10za
• Command injection flaws
• An attacker can embed malicious code and run a
program on the database server
• Example: SQL Injection
Top-10 Web application vulnerabilities
• Malicious file execution
• 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
• Cross-site Request Forgery (CSRF)
• 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
• Broken Authentication and Session
Management
• 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
• Unsecured Communication
• Using HTTP instead of HTTPS
• Failure to Restrict URL Access
• Security through obscurity
• Hoping users don't find the "secret" URLs
Cross-Site Scripting (XSS)
● One client posts active content, with <script> 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
49
● <script>alert("XSS vulnerability!")</script>
● <script>alert(document.cookie)</script>
● <script>window.location="http://www.ccsf.edu"</script>
50
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…
51
Application Vulnerabilities
Countermeasures (continued)
• WebGoat project
• Helps security testers learn how to perform
vulnerabilities testing on Web applications
• Developed by OWASP
• It’s excellent, and now has video tutorials
Assessing Web Applications
• Issues to consider
• Dynamic Web pages
• Connection to a backend database server
• User authentication
• 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
• Early versions of IIS filtered out , but not
%c1%9c, which is a Unicode version of the
same character
• 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
Link Ch 10zr
Havij & SQLmap
Link Ch 10zq
Connection to a Backend Database
Server
• Basic testing should look for
• Whether you can enter text with punctuation
marks
• 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
User Authentication
• Many Web applications require another
server to authenticate users
• Examine how information is passed
between the two servers
• 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)
• 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
SQLI on Pastebin
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Local File Inclusion
LFI Example
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Ch 10: Hacking Web Servers
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
Web Tools
• Firefox and Chrome Developer Tools
• View parameters and cookies
• Modify and resend requests
• BurpSuite
• Powerful proxy used for Web App
hacking
• Zed Attack Proxy
• Can do simple vulnerability scans
cgiscan and WebGoat
Web Tools (continued)
Web Tools (continued)
• Wfetch: GUI tool from Microsoft
• Displays information that is not normally shown in
a browser, such as HTTP headers
• 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
Ch 10: Hacking Web Servers
W3af (in BackTrack)
Skipfish from Google

More Related Content

PPTX
Malware ppt
PDF
Web Application Security and Awareness
PPT
Web Application Security
PPTX
Network security (vulnerabilities, threats, and attacks)
PPT
Network Security
PPT
Sql injection
PPTX
Vulnerabilities in modern web applications
DOCX
The CIA Triad - Assurance on Information Security
Malware ppt
Web Application Security and Awareness
Web Application Security
Network security (vulnerabilities, threats, and attacks)
Network Security
Sql injection
Vulnerabilities in modern web applications
The CIA Triad - Assurance on Information Security

What's hot (20)

PPTX
Web security
PPT
IT Security management and risk assessment
 
PPTX
Penetration Testing
PPTX
Cia security model
PPTX
SQL injection
PPT
Sql injection
PPTX
Web application security
PPT
Computer Worms
PDF
Chapter 11 laws and ethic information security
PPSX
Web application security
PDF
Ch 11: Hacking Wireless Networks
PDF
Application Security | Application Security Tutorial | Cyber Security Certifi...
PPTX
Phishing Presentation
PPTX
Cyber Security Awareness Program.pptx
PPTX
INFORMATION SECURITY
PPTX
Information Security- Threats and Attacks presentation by DHEERAJ KATARIA
PPTX
Database security
PPT
Malware
PPT
PDF
Secure Coding and Threat Modeling
Web security
IT Security management and risk assessment
 
Penetration Testing
Cia security model
SQL injection
Sql injection
Web application security
Computer Worms
Chapter 11 laws and ethic information security
Web application security
Ch 11: Hacking Wireless Networks
Application Security | Application Security Tutorial | Cyber Security Certifi...
Phishing Presentation
Cyber Security Awareness Program.pptx
INFORMATION SECURITY
Information Security- Threats and Attacks presentation by DHEERAJ KATARIA
Database security
Malware
Secure Coding and Threat Modeling

Similar to Ch 10: Hacking Web Servers (20)

PDF
CNIT 123 Ch 10: Hacking Web Servers
PPTX
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
PPT
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
PPT
gofortution
PDF
Attques web
PDF
CNIT 129S: 10: Attacking Back-End Components
PPTX
Web application vulnerability assessment
PPT
Intro to Web Application Security
PDF
Web hackingtools cf-summit2014
PPTX
Application and Website Security -- Fundamental Edition
PDF
Web vulnerabilities
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
PDF
Ch 10: Attacking Back-End Components
PPTX
Burp Suite is a powerful and widely-used tool
KEY
DVWA BruCON Workshop
PPTX
nCircle Webinar: Get your Black Belt
PDF
Site Security Policy - Yahoo! Security Week
PDF
Common Web Application Attacks
PPT
Web Application Security
PPTX
Fundamental of Webserver Hacking, Web Applications and Database Attacks
CNIT 123 Ch 10: Hacking Web Servers
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
gofortution
Attques web
CNIT 129S: 10: Attacking Back-End Components
Web application vulnerability assessment
Intro to Web Application Security
Web hackingtools cf-summit2014
Application and Website Security -- Fundamental Edition
Web vulnerabilities
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Ch 10: Attacking Back-End Components
Burp Suite is a powerful and widely-used tool
DVWA BruCON Workshop
nCircle Webinar: Get your Black Belt
Site Security Policy - Yahoo! Security Week
Common Web Application Attacks
Web Application Security
Fundamental of Webserver Hacking, Web Applications and Database Attacks

More from Sam Bowne (20)

PDF
Introduction to the Class & CISSP Certification
PDF
Cyberwar
PDF
3: DNS vulnerabilities
PDF
8. Software Development Security
PDF
4 Mapping the Application
PDF
3. Attacking iOS Applications (Part 2)
PDF
12 Elliptic Curves
PDF
11. Diffie-Hellman
PDF
2a Analyzing iOS Apps Part 1
PDF
9 Writing Secure Android Applications
PDF
12 Investigating Windows Systems (Part 2 of 3)
PDF
10 RSA
PDF
12 Investigating Windows Systems (Part 1 of 3
PDF
9. Hard Problems
PDF
8 Android Implementation Issues (Part 1)
PDF
11 Analysis Methodology
PDF
8. Authenticated Encryption
PDF
7. Attacking Android Applications (Part 2)
PDF
7. Attacking Android Applications (Part 1)
PDF
5. Stream Ciphers
Introduction to the Class & CISSP Certification
Cyberwar
3: DNS vulnerabilities
8. Software Development Security
4 Mapping the Application
3. Attacking iOS Applications (Part 2)
12 Elliptic Curves
11. Diffie-Hellman
2a Analyzing iOS Apps Part 1
9 Writing Secure Android Applications
12 Investigating Windows Systems (Part 2 of 3)
10 RSA
12 Investigating Windows Systems (Part 1 of 3
9. Hard Problems
8 Android Implementation Issues (Part 1)
11 Analysis Methodology
8. Authenticated Encryption
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 1)
5. Stream Ciphers

Recently uploaded (20)

PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PPTX
Power Point PR B.Inggris 12 Ed. 2019.pptx
PDF
FYJC - Chemistry textbook - standard 11.
PDF
The TKT Course. Modules 1, 2, 3.for self study
PDF
Laparoscopic Imaging Systems at World Laparoscopy Hospital
PPTX
pharmaceutics-1unit-1-221214121936-550b56aa.pptx
PDF
African Communication Research: A review
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PPTX
Unit 1 aayurveda and nutrition presentation
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PDF
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
PPT
Acidosis in Dairy Herds: Causes, Signs, Management, Prevention and Treatment
PPTX
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
PDF
anganwadi services for the b.sc nursing and GNM
PPTX
ACFE CERTIFICATION TRAINING ON LAW.pptx
PPTX
Designing Adaptive Learning Paths in Virtual Learning Environments
PDF
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
faiz-khans about Radiotherapy Physics-02.pdf
Power Point PR B.Inggris 12 Ed. 2019.pptx
FYJC - Chemistry textbook - standard 11.
The TKT Course. Modules 1, 2, 3.for self study
Laparoscopic Imaging Systems at World Laparoscopy Hospital
pharmaceutics-1unit-1-221214121936-550b56aa.pptx
African Communication Research: A review
Thinking Routines and Learning Engagements.pptx
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Unit 1 aayurveda and nutrition presentation
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
Acidosis in Dairy Herds: Causes, Signs, Management, Prevention and Treatment
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
anganwadi services for the b.sc nursing and GNM
ACFE CERTIFICATION TRAINING ON LAW.pptx
Designing Adaptive Learning Paths in Virtual Learning Environments
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf

Ch 10: Hacking Web Servers

  • 1. Hands-On Ethical Hacking and Network Defense
 3rd Edition Chapter 10 Hacking Web Servers Revised 1-11-17
  • 2. Objectives • Describe Web applications • Explain Web application vulnerabilities • Describe the tools used to attack Web servers
  • 3. Client’s Browser Internet Explorer or Firefox Web Server IIS or Apache HTTP HTTPS
  • 4. Web Servers • The two main Web servers are Apache (Open source) and IIS (Microsoft) ■ Link Ch 10c
  • 5. Understanding Web Applications • It is nearly impossible to write a program without bugs • Some bugs create security vulnerabilities • Web applications also have bugs • Web applications have a larger user base than standalone applications • Bugs are a bigger problem for Web applications
  • 6. Web Application Components • Static Web pages • Created using HTML • Dynamic Web pages • Need special components • <form> tags • Common Gateway Interface (CGI) scripts • Active Server Pages (ASP) • PHP • ColdFusion • Scripting languages like JavaScript • ODBC (Open Database connector)
  • 7. Web Forms • Use the <form> element or tag in an HTML document • 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
  • 8. Web Forms (continued) • Web form example <html><body> <form> Enter your username: <input type="text" name="username"> <br> Enter your password: <input type="text" name="password"> </form></body></html>
  • 10. Client’s Browser HTML Forms JavaScript Web Server CGI Scripts HTTP HTTPS
  • 11. 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
  • 12. CGI Languages • CGI programs can be written in different programming and scripting languages • C or C++ • Perl • Unix shell scripting • Visual Basic • FORTRAN
  • 13. Common Gateway Interface (CGI) (continued) • CGI example ■ Written in Perl ■ Hello.pl ■ Should be placed in the cgi-bin directory on the Web server #!/usr/bin/perl print "Content-type: text/htmlnn"; print "Hello Security Testers!";
  • 14. 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
  • 15. Active Server Pages (ASP) • Microsoft’s server-side script engine • HTML pages are static—always the same • 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 • Apache doesn’t support ASP as well
  • 16. 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
  • 17. Apache Web Server • Apache is the most popular Web Server program • Advantages • Stable and reliable • Works on just about any *NIX and Windows platform • It is free and open source • See links Ch 10g, 10h
  • 18. Using Scripting Languages • Dynamic Web pages can be developed using scripting languages • VBScript • JavaScript • PHP
  • 19. PHP: Hypertext Processor (PHP) • Enables Web developers to create dynamic Web pages • Similar to ASP • Open-source server-side scripting language • Can be embedded in an HTML Web page using PHP tags <?php and ?> • Users cannot see PHP code in their Web browser • Used primarily on UNIX systems • Also supported on Macintosh and Microsoft platforms
  • 20. PHP Example <html><head><title>Example</title></head> <body> <?php echo 'Hello, World!'; ?> </body></html> ■ See links Ch 10k, 10l • PHP has known vulnerabilities • See links Ch 10m, 10n • PHP is often used with MySQL Databases
  • 21. ColdFusion • Server-side scripting language used to develop dynamic Web pages • Created by the Allaire Corporation • 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
  • 24. 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 • Executed by the client’s browser
  • 25. 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)
  • 26. VBScript vulnerabilities ■ See links Ch 10t, 10u
  • 27. JavaScript • Popular scripting language • JavaScript also has the power of a programming language • Branching • Looping • Testing
  • 28. 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> ■ See link Ch 10v – works in IE and Firefox
  • 31. Client’s Browser HTTPorHTTPSWeb Server Apache or IIS HTML Forms CGI Scripts Database SQL Server or Oracle or MySQL ODBC or OLE DB Or ADO
  • 32. 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 • ODBC • OLE DB • ADO • Theory is the same
  • 33. 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) • 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
  • 34. Open Database Connectivity (ODBC) (continued) • ODBC defines • Standardized representation of data types • A library of ODBC functions • Standard methods of connecting to and logging on to a DBMS
  • 35. 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“ • See link Ch 10x
  • 36. 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
  • 37. Attackers controlling a Web server can ■ Deface the Web site ■ Destroy or steal company’s data ■ Gain control of user accounts ■ Perform secondary attacks from the Web site ■ Gain root access to other applications or servers
  • 38. Open Web Application Security Project (OWASP) ■ Open, not-for-profit organization dedicated to finding and fighting vulnerabilities in Web applications ■ Publishes the Ten Most Critical Web Application Security Vulnerabilities
  • 39. Top-10 Web application vulnerabilities • Cross-site scripting (XSS) flaws • Attackers inject code into a web page, such as a forum or guestbook • When others user view the page, confidential information is stolen • See link Ch 10za • Command injection flaws • An attacker can embed malicious code and run a program on the database server • Example: SQL Injection
  • 40. Top-10 Web application vulnerabilities • Malicious file execution • 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 • Cross-site Request Forgery (CSRF) • Stealing an authenticated session, by replaying a cookie or other token
  • 41. Top-10 Web application vulnerabilities • Information Leakage and Incorrect Error Handling • Error messages that give away too much information • Broken Authentication and Session Management • Allow attackers to steal cookies or passwords
  • 42. Top-10 Web application vulnerabilities • Unsecured cryptographic Storage • Storing keys, certificates, and passwords on a Web server can be dangerous • Unsecured Communication • Using HTTP instead of HTTPS • Failure to Restrict URL Access • Security through obscurity • Hoping users don't find the "secret" URLs
  • 43. Cross-Site Scripting (XSS) ● One client posts active content, with <script> 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 49
  • 44. ● <script>alert("XSS vulnerability!")</script> ● <script>alert(document.cookie)</script> ● <script>window.location="http://www.ccsf.edu"</script> 50
  • 45. 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… 51
  • 46. Application Vulnerabilities Countermeasures (continued) • WebGoat project • Helps security testers learn how to perform vulnerabilities testing on Web applications • Developed by OWASP • It’s excellent, and now has video tutorials
  • 47. Assessing Web Applications • Issues to consider • Dynamic Web pages • Connection to a backend database server • User authentication • What platform was used?
  • 48. 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 • Early versions of IIS filtered out , but not %c1%9c, which is a Unicode version of the same character • See link Ch 10 zh
  • 49. 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
  • 50. 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
  • 54. Connection to a Backend Database Server • Basic testing should look for • Whether you can enter text with punctuation marks • 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
  • 55. User Authentication • Many Web applications require another server to authenticate users • Examine how information is passed between the two servers • Encrypted channels • Verify that logon and password information is stored on secure places • Authentication servers introduce a second target
  • 56. What Platform Was Used? • Popular platforms include: • IIS with ASP and SQL Server (Microsoft) • 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
  • 69. 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
  • 70. Web Tools • Firefox and Chrome Developer Tools • View parameters and cookies • Modify and resend requests • BurpSuite • Powerful proxy used for Web App hacking • Zed Attack Proxy • Can do simple vulnerability scans
  • 73. Web Tools (continued) • Wfetch: GUI tool from Microsoft • Displays information that is not normally shown in a browser, such as HTTP headers • 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