Web Application Security Payloads. Andrés Riancho Director of Web Security OWASP AppSec USA 2011 - Minneapolis



Similar documents
ASL IT Security Advanced Web Exploitation Kung Fu V2.0

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

Using Nessus In Web Application Vulnerability Assessments

How to hack a website with Metasploit

HTExploit: Bypassing htaccess Restrictions

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

ABC LTD EXTERNAL WEBSITE AND INFRASTRUCTURE IT HEALTH CHECK (ITHC) / PENETRATION TEST

Penetration Testing with Kali Linux

WHITEPAPER. Nessus Exploit Integration

Hardening Joomla 1. HARDENING PHP. 1.1 Installing Suhosin. 1.2 Disable Remote Includes. 1.3 Disable Unneeded Functions & Classes

Turning your managed Anti-Virus

Secrets of Vulnerability Scanning: Nessus, Nmap and More. Ron Bowes - Researcher, Tenable Network Security

Web application security

Security Products Development. Leon Juranic

Lab 7 - Exploitation 1. NCS 430 Penetration Testing Lab 7 Sunday, March 29, 2015 John Salamy

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

PTSv2 in pills: The Best First for Beginners who want to become Penetration Testers. Self-paced, online, flexible access

Exploiting Fundamental Weaknesses in Command and Control (C&C) Panels

CIT 480: Securing Computer Systems. Vulnerability Scanning and Exploitation Frameworks

SQL Injection 2.0: Bigger, Badder, Faster and More Dangerous Than Ever. Dana Tamir, Product Marketing Manager, Imperva

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

STABLE & SECURE BANK lab writeup. Page 1 of 21

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

Offensive Security. Advanced Web Attacks and Exploitation. Mati Aharoni Devon Kearns. v. 1.0

Client logo placeholder XXX REPORT. Page 1 of 37

Black Box Penetration Testing For GPEN.KM V1.0 Month dd "#$!%&'(#)*)&'+!,!-./0!.-12!1.03!0045!.567!5895!.467!:;83!-/;0!383;!

Penetration Testing Report Client: Business Solutions June 15 th 2015

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

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

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

Virtually Secure. a journey from analysis to remote root 0day on an industry leading SSL-VPN appliance

INDUSTRIAL CONTROL SYSTEMS CYBER SECURITY DEMONSTRATION

Vulnerability Assessment and Penetration Testing

w3af - Web application attack and audit framework Documentation

NETWORK PENETRATION TESTS FOR EHR MANAGEMENT SOLUTIONS PROVIDER

SAST, DAST and Vulnerability Assessments, = 4

Hardened Hosting. Quintin Russ. OWASP New Zealand Chapter th December 2011

HackMiami Web Application Scanner 2013 PwnOff

Exploiting Local File Inclusion in A Co-Hosting Environment

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

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

Automated Penetration Testing with the Metasploit Framework. NEO Information Security Forum March 19, 2008

Aiming at Higher Network Security Levels Through Extensive PENETRATION TESTING. Anestis Bechtsoudis. abechtsoudis (at) ieee.

Hack Your SQL Server Database Before the Hackers Do

Improving Web Vulnerability Scanning. Daniel Zulla

Web Application Security

Metasploit Pro Getting Started Guide

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

SANDCAT THE WEB APPLICATION SECURITY ASSESSMENT SUITE WHAT IS SANDCAT? MAIN COMPONENTS. Web Application Security

Web Intrusion Detection with ModSecurity. Ivan Ristic

Author: Sumedt Jitpukdebodin. Organization: ACIS i-secure. ID: My Blog:

OWASP OWASP. The OWASP Foundation Selected vulnerabilities in web management consoles of network devices

Penetration Testing. Presented by

Passing PCI Compliance How to Address the Application Security Mandates

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

Internal Penetration Test

Source Code Review Using Static Analysis Tools

Architecture of a new DDoS and Web attack Mitigation System for Data Center

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

The Pen Test Perfect Storm: Combining Network, Web App, and Wireless Pen Test Techniques Part 2

The Pen Test Perfect Storm: Combining Network, Web App, and Wireless Pen Test Techniques Part 2

INFORMATION SECURITY TRAINING CATALOG (2015)

Penetration: from Application down to OS

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

Common Security Vulnerabilities in Online Payment Systems

Web Vulnerability Scanner by Using HTTP Method

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

Implementation of Web Application Firewall

Threat Intelligence Pty Ltd Specialist Security Training Catalogue

Penetration Testing Workshop

1. LAB SNIFFING LAB ID: 10

Shellshock. Oz Elisyan & Maxim Zavodchik

From Rivals to BFF: WAF & VA Unite OWASP The OWASP Foundation

The Essentials Series. PCI Compliance. sponsored by. by Rebecca Herold

PuttyRider. With great power comes great responsibility. # Pivoting from Windows to Linux in a penetration test. Adrian Furtunã, PhD adif2k8@gmail.

Hacking the WordpressEcosystem

ETHICAL HACKING APPLICATIO WIRELESS110 00NETWORK APPLICATION MOBILE MOBILE0001

Information Security. Training

Basic & Advanced Administration for Citrix NetScaler 9.2

Learn Ethical Hacking, Become a Pentester

Mobile Application Hacking for Android and iphone. 4-Day Hands-On Course. Syllabus

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Cyber Essentials. Test Specification

How to achieve PCI DSS Compliance with Checkmarx Source Code Analysis

RIPS - A static source code analyser for vulnerabilities in PHP scripts

Penetration Testing in Romania

Network Penetration Testing and Ethical Hacking Scanning/Penetration Testing. SANS Security Sans Mentor: Daryl Fallin

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Redhawk Network Security, LLC Layton Ave., Suite One, Bend, OR

Executive Summary On IronWASP

Mingyu Web Application Firewall (DAS- WAF) All transparent deployment for Web application gateway

Integrated Network Vulnerability Scanning & Penetration Testing SAINTcorporation.com

SECURING APACHE : THE BASICS - III

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

IP Application Security Manager and. VMware vcloud Air

SENSITIVE AUSTRALIAN SPORTS COMMISSION ATHLETE MANAGEMENT SYSTEM (AMS) SMARTBASE SECURITY TEST PLAN. Final. Version 1.0

Automation of Post-Exploitation


Vulnerability Scan. January 6, 2015

Cyber Security Challenge Australia 2014

Transcription:

Web Application Security Payloads Andrés Riancho Director of Web Security OWASP AppSec USA 2011 - Minneapolis

Topics Short w3af introduction Automating Web application exploitation The problem and how other tools are not handling it Web Application Payloads, our solution Vulnerabilities have capabilities! Abstracting system calls in payloads Our own SCA Metasploit integration Routing TCP/IP traffic Conclusions 2

andres@rapid7.com$ whoami Director of Web Security @ Rapid7 Founder @ Bonsai Information Security Developer (python!) Open Source Evangelist Deep knowledge in networking, design and IPS evasion. Project leader for w3af 3

Short w3af introduction The features and the behind the scenes story 4

Introduction to w3af w3af is an open source Web Application Attack and Audit Framework First version released in March 2007 Open Source tool (GPLv2.0) to identify and exploit Web vulnerabilities Architecture supports plug-ins (easily extensible) Available for free download @ www.w3af.org w3af project is sponsored by Rapid7 Since July 2010 Full time development resources Roadmap, prioritized backlog & structured development process Quality assurance Back office including marketing and communications 5

What we ve achieved In these four years of life, the w3af project has achieved these goals: Continuous, non-stop improvements in features and software quality Good link and code coverage A low false negative rate Widely known, distributed in most (all?) hacking live-cds Packages for most linux distributions 6

Stable code base and Performance We still have much to acomplish! Achieve a completely stable code base Increase performance for the core framework features (sending of HTTP requests, HTTP cache, analysis of responses, threading, etc.) Based on a recent poll, we re changing our roadmap to quickly achieve what users need: Stability Identify 100% of the vulnerabilities - Scan time doesn t matter Low False positive rate Plugin / Extension system documentation 7

The Web Application Penetration Tester issue And how other tools are not covering it 8

Experience on a recent Web Penetration Test Vuln! Identified arbitrary file read in PHP application +1 hour Read configurations, operating system and source code files Found an unlinked application directory with dead-code +1 hour Identified arbitrary file upload within dead-code Uploaded file to get unprivileged command execution (www-data) +3 hours Accessed all DB data Got root privileges (mysql password == root password) 9

No web post-exploitation :-( During this experience we noticed that: None of the currently available tools, Open Source or Commercial, have any post exploitation techniques we could apply to Web application vulnerabilities in order to escalate privileges. Commercial exploitation platforms provide exploits and payloads to use in best case scenarios, in other words, when there is control on the execution flow ( exploits for buffer overflow ). 10

The reasons Exploitation frameworks are focused on memory corruption exploits because they were the most important vulnerability class. Attention has now shifted to Web applications, which are different because they only allows us, depending on the vulnerability, to interact with the system in a particular way: Read a file Write a file Control a section of a SQL query Execute user controlled source code Execute operating system commands 11

Web Application Security Payloads Helping you get root from low-privileged vulnerabilities 12

A paradigm shift in exploitation Which capabilities does a Web application vulnerability export? Two simple examples: Web application vulnerability Arbitrary File Read File upload Capabilities exported read() write() [often restricted to specific directory] Changing our mindset from buffer overflow exploits to Web exploitation with reduced capabilities, we started to define all the actions that could be done only with read() s: Read Apache config files, Read.htpasswd files, Get the remote process list, Get the list of open TCP and UDP connections, and MANY more. 13

A paradigm shift in exploitation After identifying all actions that could be performed with read(), we moved on to different scenarios where we analyzed: Only write() Only exec() write() and read(), which is usually found when there are two different vulnerabilities present. Where we realized that we could emulate some syscalls using others. 14

Emulating other syscalls Each exploit exports system calls, which are then used by the payloads: Exploit Exported Syscalls Emulated system calls Local file read Local file include read() read() OS Commanding execute() read(), write(), unlink() DAV Shell write() execute(), read(), unlink() File Upload write() execute(), read(), unlink() Each syscall acts as an abstraction layer, allowing the payload to run without knowing/caring which exploit is in use. 15

Emulating syscalls Syscall emulation is easy in some cases, for example read() is emulated via the execution of "cat filename" or "type filename", depending on the OS: And in some other cases it is more difficult, write() to exec() can be challenging due to file system permissions, programming language configuration and the application itself. 16

Simple but powerful pieces of code Payloads are usually short code snippets that use a couple of system calls and have specific knowledge about which files to read and how to extract information from them: Knowledge Parse read() 17

18 Demo users Baby steps

read() users interesting_files Synergy between payloads System call to read files Payload that reads /etc/passwd and identifies home directories This payload uses the home directories and a list of interesting filenames to search for passwords. 19

The "interesting_files" payload interesting_extensions = [] interesting_extensions.append('') # no extension interesting_extensions.append('.txt')... file_list = [] file_list.append('passwords') file_list.append('passwd')... for user in users_result: home = users_result[user]['home'] for interesting_file in file_list: for extension in interesting_extensions: file_fp = home + interesting_file + extension files_to_read.append( file_fp ) 20

Demo interesting_files Treasure hunt 21

Payloads are integrated into the framework Payloads can take decisions based on facts that were saved to the knowledge base during the scan: Identified vulnerabilities Remote Web server type (Apache, IIS, etc.) Remote operating system Found URLs This is one of the biggest advantages of having everything integrated into w3af! 22

The "get_source_code" payload apache_root_directory = self.exec_payload('apache_root_directory') webroot_list = apache_root_directory['apache_root_directory'] url_list = kb.kb.getdata('urls', 'urllist') for webroot in webroot_list: for url in url_list: path_and_file = getpath( url ) relative_path_file = path_and_file[1:] remote_full_path = os.path.join(webroot,relative_path_file) file_content = self.shell.read(remote_full_path) if file_content: self._save_file_locally(remote_full_path, file_content) 23

24 Demo get_source_code w3af integration

w000t! We have the application s source code, what now? 25

Integration with Static Code Analysis tools Web application payloads can easily integrate with other tools. They are developed in Python, so everything is possible :) Our first stab at this problem was to integrate Pixy as a payload. The worse thing was that it did not return the information we needed. 26 Together with Javier Andalia from Rapid7 we ve developed a PHP Static Code Analyzer as a PoC to show that it is possible to combine these two technologies: Black-Box scanning Static Code Analysis

Integration with Static Code Analysis tools This is how we re integrating our SCA tool into w3af: w3af scan Identify local file read Exploit read() SCA Identify SQLi Exploit write() exec() 27

Static Code Analysis characteristics Based on phply, a PHP parser implemented in PLY (Python Lex-Yacc) Identifies the following vulnerabilities: SQL Injection OS Commanding Arbitrary file read Remote file inclusion eval() vulnerabilities Taint analysis 28

29 Demo Static Code Analyzer A step closer to retirement

Static Code Analysis with Taint Analysis This SCA was a PoC developed over two weeks, it lacks many important functions such as: Support for require_once(), require(), include_once(), include() Better support for loops and if statements Classes, methods and attributes Detection for all vulnerabilities Interested in extending this section of w3af? Contact me! 30

Available payloads and their main focus

32 Payloads with exec() That was easy!

And when we can execute OS commands Great! We found a way to execute operating system commands using our web application payloads that run with low privileges, now what? When we re able to execute OS commands everything is simpler. In these cases, w3af provides the following payloads: msf_linux_x86_meterpreter_reverse msf_windows_meterpreter_reverse_tcp msf_windows_vncinject_reverse w3af_agent Allows us to route traffic through the compromised host without any effort 33

Conclusions and pending work Develop more MS Windows payloads Take actions based on payload results: Launch a new scan against a particular resource Exploit vulnerabilities using the increased knowledge obtained by w3af s payloads Our goal is to make this the standard for automatized postexplotation of Web application vulnerabilities. 34

Sharing your ideas and knowledge is easy! Got an idea? Share it in our mailing list! http://www.w3af.org/mailing-list.php Want to read the code? The source code for the web application security payloads, w3af agent and metasploit wrapper can be found in these directories: plugins/attack/payloads/ core/controllers/vdaemon/ core/controllers/w3afagent/ core/controllers/payloadtransfer/ http://w3af.svn.sourceforge.net/viewvc/w3af/trunk/ 35

Time for your questions! Andrés Riancho Director of Web Security General Manager of Rapid7 s Web Application Center of Excellence in Buenos Aires andres_riancho@rapid7.com Follow me on Twitter @w3af 36

Thank you! Web Application Center of Excellence, Buenos Aires, Argentina