Lecture 6 Webapps
Lecture 6 Webapps
vulnerabilities
and penetration
testing
Dr Phillip James
Recap and Last week we explored the very popular buffer
today overflow vulnerability.
Various
“services”
Many popular products (which are targeted):
Products and • IIS
• Apache
results • Nginx
• …
Like this bitcoin forum:
Impacts:
• Web defacement
• Data tampering (can be hard to spot)
• Theft (Email addresses/passwords/credit card)
• Pivot point (use it as a way into the
backend/network)
But why so Web servers and their setup is done by humans…
many attacks
• Unnecessary files
• Security v Functionality
• Default Settings
• Permissions on files
• Misconfiguration
• Default accounts (01 = Admin…)
• Security flaws in the system itself
• Improper Authentication
Measure these • Patches.
counters • Alt sites/servers.
• Hire me :)
• Don’t change live system. Ever. And re-run tests.
• Vulnerability scan yourself.
• Actually monitor things regularly.
• Encryption. Always. (SSL).
• Good architecture/Network protection.
Presentation/application/data.
Example: patch AWS patch management workflow:
management
Web applications
What is a web Manages data manipulation and access.
app Web
Server
Client Side
Browser
Web
Applications
Database
Techniques for • Directory traversal (navigate web server
structure)
pen testing • HTTP Response splitting
• Web cache poisoning
• MiTM
• Cookie tampering
• DDoS
• CSRF
• SQL Injections
• Session hijacking
• …
Web spiders
Mapping the Tools that work by requesting a web page, parsing it for links
app to other content, requesting these links, and continuing
recursively until no new content is discovered.
The first step, enumerate content.
(Advanced tools Can also parse JavaScript for URLs…)
generally
bad…
-r -- recursive (so “follow the links” and look for more than
one page)
-l -- indicates the number of levels we want to recurse.
--spider -- indicates not to download anything (we just want
to go through the pages, that’s all)
-D -- indicates the list (separated by commas) of domains
where we think it’s acceptable to “spider”
Bit less basic:
Burp Suite
(Demo)
Many types of web app authentication, many attacks!
session
hijacking
Victim Session id = 1234 Web Server
user=daf;app=admin;date=10/09/11
$m = new Mongo();
$db = $m->cmsdb;
$collection = $db->user;
$js = “function() {
return this.username == ‘$username’ & this.password == ‘$password’;
}”;
The attacker
1. Eve inputs a search term. If no results are found, a page
will display the term followed by the words “not found,”.
The url:
http://bobssite.org?q=search term.
which is perfectly normal behavior.
Alice gets the e-mail and clicks on the link. It displays "puppies
not found" but right in the middle, the script tag runs (it is
invisible on the screen) and loads and runs authstealer.js
(triggering the XSS attack).
• Use a library J
• Many exist, for example:
https://code.google.com/archive/p/xssprotect/
• XSS Tokens (extra reading)
Cross site
request Cross-Site Request Forgery (CSRF)
forgery An attack that forces an end user to execute
unwanted actions on a web application in which
they're currently authenticated.
http://bank.com/transfer.do?acct=BOB&amount=100
http://bank.com/transfer.do?acct=EVE&amount=100000
[1] http://seclists.org/fulldisclosure/2015/Feb/0
[2] http://techcrunch.com/2014/06/11/tweetdeck-fixes-xss-vulnerability/
[3] http://threatpost.com/paypal-site-vulnerable-to-xss-attack
[4] http://miki.it/blog/2013/7/30/xss-in-google-finance/
[5] http://nakedsecurity.sophos.com/2012/02/28/verisign-xss-holes/
[6] http://www.scmagazine.com/mcafee-working-to-fix-xss-information-
disclosure-flaws/article/199505/
[7] http://news.softpedia.com/news/XSS-Weakness-Found-on-Visa-USA-
Website-157115.shtml
Vulnerability
Scanners
‘good tools are good tools’
Burp Suite:
Nessus:
• Automated continual scanning.
• Less “interaction” with website
than e.g. Burp Suite.
Literally a full course of information with good
Further demos and a website illustrating attacks.
reading
We have explored a number of vulnerabilities:
Summary • Web server configurations
• Web applications, including:
• Spidering
• Weak authentication
Noun: a brief statement or account
of the main points of something. • Session hijacking
• Injection attacks
• XSS
• Methods of defence.