Top Banner
Andrés Riancho ariancho <at> cybsec.com w3af – A framework to own the Web
57

w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

Aug 31, 2019

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

Andrés Rianchoariancho <at> cybsec.com

w3af – A framework to own the Web

Page 2: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   2

Talk objectives

Let the security community know about w3af

Introduce new and interesting ways of exploiting web application vulnerabilities

Share ideas!

Page 3: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   3

Agenda

Who am I ?

Current state of WebAppSec scanners

What w3af is

What w3af is not

Main features

Architecture

Plugins

Tactical exploitation

Discovery demos

Interesting features

Virtual daemon

Web 2.0

Web Services

Known bugs

Future

Main contributors

Conclusions

Page 4: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   4

who am i ?

Security Consultant Programmer Open source evangelist Web Application security enthusiast Background in networking, IPS design and

evasion

Page 5: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   5

Current state of Web App Security scanners

Commercial High price If available, poor extensibility ( bad API's, bad

programming languages to extend functionality )

No user community No exploitation phase Good reporting ( cute PDF to send to

management ) Many paid programmers, throughly tested

products

Page 6: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   6

Current state of Web App Security scanners

Open source Small independent tools/scripts that can't

communicate with each other Each tool re implements the wheel

( authentication, thread management, proxy support, etc )

Some tools do audit + exploitation Small or non user community No reporting, they generate large text files Mostly programmed without thinking about

extensibility

Page 7: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   7

Current state of Web App Security scanners

Open source (contd.) Some really cool tools exist and should not

be left out of this summary: sqlmap sqlninja wapiti absinthe

Page 8: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   8

Current state of Web App Security scanners

The solution is to implement a web application security framework, where

everyone can contribute with his knowledge.

A project where adding a feature is easy and can be done in minutes instead of

days!

Page 9: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   9

What w3af is

● w3af stands for Web Application Attack and Audit Framework● An Open Source project (GPLv2)● A script that evolved into a serious project● A vulnerability scanner● An exploitation tool

Page 10: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   10

What w3af is not

● Stable software● The solution to all your web application security problems● A replacement for manual pen-testing● A point&click hack tool● A hack tool

Page 11: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   11

Main features

● Finds common and uncommon web application vulnerabilities.● Cross platform ( written in python).● Uses Tactical exploitation techniques to discover new URLs and vulnerabilities● Web and console user interface

Page 12: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   12

Main features

● Web Service support● Exploits [blind] SQL injections, OS commanding, remote file inclusions, local file inclusions, XSS, unsafe file uploads and more!● WML Support (WAP)● Really easy to extend● Synergy among plugins

Page 13: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   13

Main features

● Ability to find vulnerabilities in query string, post data, URL filename ( http://a/f00_injectHere_b4r.do ), headers, file content (when uploading files with forms) and web services.● Number of plugins: 110 and growing● w3af is smart, more on this later ;)

Page 14: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   14

Architecture

● w3af is divided in two main parts, the core and the plugins.● The core coordinates the process and provides features that plugins consume.● Plugins share information with each other using a knowledge base.● Design patterns and objects everywhere !

Page 15: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   15

Architecture

● 8 different types of plugins exist:– discovery– audit– grep– attack– output– mangle– evasion– bruteforce

Page 16: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   16

Architecture

● Information flow between plugins:

Page 17: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   17

Plugins | Discovery

They find new URLs and create the corresponding fuzzable requests; examples of discovery plugins are:

– webSpider– urlFuzzer– googleSpider– pykto

Page 18: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   18

Plugins | Discovery

They are run in a loop, the output of one discovery plugin is sent as input to the next plugin. This process continues until all plugins fail to find a new fuzzable request.

Other discovery plugins try to fingerprint remote httpd, allowed HTTP methods, verify if the remote site has an HTTP load balancer installed, etc.

Page 19: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   19

Plugins | Audit

They take the output of discovery plugins and find vulnerabilities like:

– [blind] SQL injection– XSS– Buffer overflows – Response splitting.

As vulnerabilities are found, they are saved as vuln objects in the knowledge base.

Page 20: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   20

Plugins | Grep

These plugins grep every HTTP request and response to try to find information. Examples of grep plugins are:

– findComments– passwordProfiling– privateIP– directoryIndexing– getMails– lang

Page 21: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   21

Plugins | Attack

These plugins read the vuln objects from the KB and try to exploit them. Examples of attack plugins are:

– mySqlWebShell– davShell– sqlmap– xssBeef– remote file include shell

Page 22: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   22

Plugins | Others

● Output: They write messages to the console, html or text file.● Mangle: They modify requests and responses based on regexs.● Evasion: They modify the requests to try evade IDS detection.● Bruteforce: They bruteforce logins.

Page 23: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   23

Mini demo

Let's see what this is all about...

Page 24: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   24

Tactical Exploitation

● A different way to do pen-test● Analyze all the available information related to the target and apply it to the pen-test process● Focus on the applications

Page 25: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   25

Tactical Exploitation

What w3af does about tactical exploitation:

– vhost search in MSN– mail address searches in Google, MSN,

PKS.– password profiling– halberd– archive.org search– search Google, MSN, Yahoo

Page 26: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   26

Tactical Exploitation

Password profiling plugin:

– Reads every HTTP response and count the word repetitions

– Support for HTML, Text, and PDF (using pyPDF).

– PPP supported file types are extended using plugins (plugins for plugins!)

– Smart HTML counting of word repetitions, knows about <h[1-3]> and text size.

Page 27: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   27

Discovery demo

This demo will show:

– fingerPKS, fingerMSN, fingerGoogle– bruteforce using collected usernames,

and dynamically generated passwords:● username● target site ( www.domain.com ; domain.com ; domain )

● passwords generated by the password profiling plugin

Page 28: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   28

Discovery demo (contd.)

Let's rock...

Page 29: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   29

Interesting features

● Google Sets

– input:● http://f00/bar?a=football● http://f00/bar?a=tennis

– URLs to be tested:● http://f00/bar?a=golf ● http://f00/bar?a=rugby

Page 30: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   30

Interesting features

● wordnet

– input:● http://f00/bar?a=dog

– URLs to be tested:● http://f00/bar?a=cat ● http://f00/bar?a=bird ● http://f00/bar?a=animal

Page 31: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   31

Interesting features

● digitSum

– input:● http://f00/bar?a=5

– URLs to be tested:● http://f00/bar?a=4 ● http://f00/bar?a=6

Page 32: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   32

Interesting features

● digitSum

– input:● http://f00/bar5-9.htm

– URLs to be tested:● http://f00/bar6-9.htm● http://f00/bar7-9.htm ● http://f00/bar5-8.htm● http://f00/bar5-10.htm

Page 33: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   33

Interesting features

● archiveDotOrg plugin

– Searches archive.org for older versions of the site, links that were linked somewhere in the past and now are kept in the dark

– Old and unmaintained sections are prone to vulnerabilities

– This plugin is a time machine!

Page 34: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   34

Interesting features

● Remote file inclusion proxy

– Using a remote file inclusion vulnerability, w3af implements an attack plugin that will run a local proxy that uses the remote server as exit point for HTTP requests.

– Ideal for pivoting into the LAN / DMZ.

Page 35: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   35

Interesting features

w3af rfiProxy

HTTP request Web application

exploited by rfiproxy

marshaled request

HTTP browser

DMZ - Web Application

HTTP request

Page 36: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   36

Interesting features

● Use of PHP easter eggs to fingerprint the remote PHP version.

– Old and almost forgotten technique– Accurate fingerprinting– Almost nobody disables the eggs

(expose_php = off; )

Page 37: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   37

Interesting features

● w3af verifies if your server was pwned in the past:

– phishtank– googleSafeBrowsing– detectPhishing

Page 38: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   38

Interesting features

● Good Samaritan module

– A faster way to exploit blind SQL injections!

– A funny way to exploit blind SQL injections!

● A demo will show what I'm talking about...

Page 39: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   39

Good Samaritan Demo

Guiding the blind man

Page 40: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   40

Virtual daemon

● Ever dreamed about using metasploit payloads to exploit web applications ? NOW you can do it !● How it works:

– I coded a metasploit plugin, that connects to a virtual daemon and sends the payload.

– The virtual daemon is runned by a w3af attack plugin, it receives the payload and creates a tiny ELF / PE executable

Page 41: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   41

Virtual daemon

● How this works (contd.):

– The attack plugin knows how to exec remote commands, and the virtual daemon knows how to upload the ELF/PE using “echo” or some other inband method.

– A new scheduled task is created to run the payload, and the metasploit plugin is ordered to wait

– The payload is run on the remote server.

Page 42: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   42

Virtual daemon

● How this works (contd.):

– Normal communication between metasploit and the exploited service follows.

Page 43: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   43

Virtual daemon

w3af - Virtual daemon

payload w3af – Attack plugin

exec()

ELF / PEReverse Shell

Metasploit Framework

Web Application

Page 44: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   44

Virtual daemon

demo!

Page 45: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   45

Virtual daemon

● Things that won't work:

– Use of existing connection to transverse NAT / restrictive firewalls

Page 46: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   46

Web 2.0 Support

w3af can analyze pages that make heavy use of JavaScript. The manual solution available to achieve this task is the spiderMan plugin.

– Local proxy daemon– Analyzes requests and creates fuzzable

requests– The user needs to navigate the

JavaScript sections of the site

Page 47: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   47

Web Services

w3af can find WSDLs using several methods:

– discovery.wsdlFinder– grep.wsdlGreper

With the WSDL identified, w3af parses the definition file and creates the corresponding fuzzable requests. This requests are then used by audit and attack plugins.

Page 48: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   48

Web Services

● ALL audit plugins work with web services!● Exploit plugins should work with web services ;)● w3af uses SOAPpy to parse the WSDL files, this introduces a limitation, because complex WSDL files (mainly doc-style) are not fully supported.

Page 49: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   49

Known bugs

w3af is a work in progress, here is a short bug list:

– Random timeouts in HTTP requests– Memory consumption, 100% CPU– Threads “work”– Fuzzable requests need refactoring– Attack plugins need refactoring– and much, much more..

Page 50: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   50

import __future__

● Some level of Javascript support● More stable core● More attack plugins, refactoring of attacks.● Better webUI● Better management report generation● Replace utidy with beautiful soup● Long descriptions for vulnerabilities

Page 51: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   51

import __future__

● Replace SOAPpy with ZSI● And maybe...

– Static code analysis of scripting languages

– Apache / IIS log analysis● Another project by itself, but could be integrated into w3af: “IPS evasion using a userland TCP/IP stack like muXTCP”

Page 52: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   52

import __future__

Read logsexploit

generate new fuzzable requests

local file include/readvulnerability

newdiscovery

phase

Read scriptsource

exploitgenerate new fuzzable

requestslocal file

include/readvulnerability

newdiscovery

phase

Generate vuln objects using Static Analysis

Toolsnew

exploit phase

Page 53: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   53

Main contributors

● Mariano Nuñez Di Croce ( webUI and lot's of ideas )

● Juan Pablo Perez Etchegoyen ( html output plugin )

● Mike Harbisson ( documentation review and testing )

● Bernardo Damele ( testing and sqlmap )

● Victor Montero ( ideas, moral and political support )

Page 54: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   54

Project information

● Site

– http://w3af.sf.net/● Mailing list and sourceforge home

– http://sourceforge.net/projects/w3af/ ● Project leader contact

– andres.riancho <at> gmail.com– ariancho <at> cybsec.com

Page 55: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   55

Project sponsor

11 years experience Clients in LATAM,

USA and Europe Based in Argentina Professional

Objectivity

www.cybsec.com

Page 56: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   56

Conclusions

● Frameworks are the future● Tactical exploitation is going to get more and more important● w3af has a huge potential● It is open source, you should contribute!

Page 57: w3af – A framework to own the Webcybsec.com/upload/presentation_w3af.pdf · 2 Talk objectives Let the security community know about w3af Introduce new and interesting ways of exploiting

   57

Questions?

Feature requests ? ideas?Bug reports? contributionsRants about web2.0?i want flash support! Web Services hacking.