85
All your sites are belong to Burp Tiago Mendo - @tmendo tiagomendo at gmail.com - tiago.mendo at telecom.pt

BSides Lisbon 2013 - All your sites belong to Burp

Embed Size (px)

DESCRIPTION

This talk is going to be all about Burp. I will explain why is such a great tool and how it compares with similar ones. Its going to have a quick walkthrough of its main features, but the juicy part is going to be about how to fully explore its main tools, such as the scanner, intruder and sequencer, to increase the number and type of vulnerabilities found. In addition, I will provide an overview of the Burp Extender Interface and how to easily and quickly take advantage of extensions to increase its awesomeness. I will show how easy is for an pentester to translate an idea to a extension and (I hope) publicly release one plugin to further help pentesters. The talks objective is to increase your efficiency while using Burp, either by taking advantage of its excellent tools or by adding that feature that really need. Presented at BSides Lisbon at 04/10/13 (http://bsideslisbon.org)

Citation preview

Page 1: BSides Lisbon 2013 - All your sites belong to Burp

All your sites are belong to Burp

Tiago Mendo - @tmendotiagomendo at gmail.com - tiago.mendo at telecom.pt

Page 2: BSides Lisbon 2013 - All your sites belong to Burp

this.person

• Pentester at SAPO

• Web division of Portugal Telecom, +100 webapps

• Uses Burp as much as the browser

• Speaker at Codebits

• Likes cars, travelling and burgers

• @tmendo

Page 3: BSides Lisbon 2013 - All your sites belong to Burp

Why this talk?

• Burp Suite

• A reference tool

• Everybody uses it

• Extension capabilities

• Share how I use it

• Share how developers can use it

• Learn how to use it even better

Page 4: BSides Lisbon 2013 - All your sites belong to Burp

Outline

• Burp for developers

• Proxy

• Repeater

• Before starting

• Finding vulnerabilities

• Automation

• Extending Burp

• Tips

Page 5: BSides Lisbon 2013 - All your sites belong to Burp

Disclaimer

• I am not affiliated with PortSwigger.

• The contents of this talk are solely of my responsibility, and not of my employer.

Page 6: BSides Lisbon 2013 - All your sites belong to Burp

Burp?

• That relief noise...

Page 7: BSides Lisbon 2013 - All your sites belong to Burp

Burp?

• “Burp Suite is an integrated platform for performing security testing of web applications.”

Page 8: BSides Lisbon 2013 - All your sites belong to Burp

Burp?

• Actually, the icon is a burping face in profile

Page 9: BSides Lisbon 2013 - All your sites belong to Burp

Burp?

• Actually, the icon is a burping face in profile

mouthnose

Page 10: BSides Lisbon 2013 - All your sites belong to Burp

Burp Suite• Burp is a set of tools, all tightly integrated

• Proxy

• Spider

• Scanner

• Intruder

• Repeater

• Sequencer

• API

• Save, search, compare, decode, filter

Page 11: BSides Lisbon 2013 - All your sites belong to Burp

Burp Suite• Burp is a set of tools, all tightly integrated

• Proxy

• Spider

• Scanner

• Intruder

• Repeater

• Sequencer

• API

• Save, search, compare, decode, filter

Page 12: BSides Lisbon 2013 - All your sites belong to Burp

Burp Suite• Burp is a set of tools, all tightly integrated

• Proxy

• Spider

• Scanner

• Intruder

• Repeater

• Sequencer

• API

• Save, search, compare, decode, filter

Free

Page 13: BSides Lisbon 2013 - All your sites belong to Burp

Burp Suite

Page 14: BSides Lisbon 2013 - All your sites belong to Burp

Burp for developers

• Can developers take advantage of it?

Page 15: BSides Lisbon 2013 - All your sites belong to Burp

Burp for developers

• Can developers take advantage of it?

• Yes

• debug

• functional testing

• security testing

Page 16: BSides Lisbon 2013 - All your sites belong to Burp

Burp for developers

• But, normally, developers don’t have access to:

• a web security team (in-house or outsourced)

• time to test stuff

• money

Page 17: BSides Lisbon 2013 - All your sites belong to Burp

Burp for developers

• Use the free version

• Integrate Burp with your development process

• Do simple tests

Page 18: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• Always use a proxy with your browser

• use a separate browser to hack

• have it sent all traffic trough Burp proxy

• Easily done with Firefox

• multiple profiles

• proxy is not system wide

• lots of plugins

Page 19: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• Send “all” traffic to Burp

Page 20: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• Filtering further

Page 21: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• Auto-scroll

• just sort by # desc

Page 22: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• What to look for when using the proxy?

• failing requests

• error and debug messages

• sensitive information

• missing headers

• If want to get active

• input: URL parameters, postdata, headers, cookies

Page 23: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

• You can do simple, yet powerful, tests in two ways

• intercepting requests

• repeating requests

Page 24: BSides Lisbon 2013 - All your sites belong to Burp

Proxy

Page 25: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• Intercepting requests with the proxy is good for single tests

• or when you have a single shot

• For deeper testing use the repeater

• allows arbitrary replay and modification of requests

Page 26: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• From proxy to repeater

Page 27: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

Page 28: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• With the repeater you can just play with the requests, whatever is your objective

• debug

• functional

• security

• Lets focus on security :)

Page 29: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• XSS - a simple payload to get 80/20

• "><img src=a onerror=alert(1)>

• Using the repeater avoids browser defensive measures

• auto URL encoding

• XSS filters

Page 30: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

Page 31: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• SQLi - you don’t have to test for it because you use prepared statements

Page 32: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• SQLi - you don’t have to test for it because you use prepared statements

• Just in case

• ‘

• and benchmark(10000000, md5(md5(1))) --%20

Page 33: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

Page 34: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• OWASP Top 10 - A4 Insecure Direct Object References

• “Attacker, who is an authorized system user, simply changes a parameter value that directly refers to a system object to another object the user isn’t authorized for.”

Page 35: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

• Very easy and fast to test

• repeat the request with a different object id from other user

• photo_id, id, userid, etc.

• Automated tools dont find A4, you need to do it manually!

Page 36: BSides Lisbon 2013 - All your sites belong to Burp

Repeater

Page 37: BSides Lisbon 2013 - All your sites belong to Burp

Going pro

• The free version is enough for developers and simple tests

• A security professional will need the professional version

• automation

• speed

• coverage

• save

• search

Page 38: BSides Lisbon 2013 - All your sites belong to Burp

Before starting

• Ensure you always load a clean Burp with a prepared configuration

• tools clean of requests

• auto backup

• proxy setup

• plugins

• keyboard shortcuts

Page 39: BSides Lisbon 2013 - All your sites belong to Burp

Before starting

• URL blacklist

• avoid session termination

Page 40: BSides Lisbon 2013 - All your sites belong to Burp

Before starting

• URL blacklist

• avoid destruction

Page 41: BSides Lisbon 2013 - All your sites belong to Burp

Before starting

• parameter blacklist

• also block CSRF tokens and test them manually

Page 42: BSides Lisbon 2013 - All your sites belong to Burp

Before starting

• boolean based SQLi

• avoid destroying the DB if testing something that uses UPDATE

• UPDATE users SET email=X WHERE email=Y OR 1=1

Page 43: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• So...what is the most effective way to find vulnerabilities with Burp?

• The scanner?

Page 44: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

Page 46: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• There are multiple approaches to find vulnerabilities with Burp

• proxy, spider and then scan blindly

• proxy, spider, intruder and then scan targeted

• <your own combination of tools>

Page 47: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

1. Hit every functionality manually

• gets recorded in the proxy

• you get to know the target

2. If possible, maximize the coverage

• spider the target

• actively scan the target

Page 48: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Spidering and scanning blindly might destroy the target (and your job)

• boolean-based SQLi

• deletion of content

Page 49: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Spidering and scanning blindly can take time

Page 50: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

3. Manual investigation

• where all the fun begins

• where you justify your income

• test for the vulns Burp won’t test

• confirm Burp guesses

Page 51: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Find a juicy request and sent it to the repeater

Page 52: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Modify if and send it!

Page 53: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Find a juicy request and sent it to the intruder

Page 54: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• The intruder can be used to do precision scanning

• you can select any part of the request

• similar to the * marker in sqlmap

• useful for custom protocols

Page 55: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

Page 56: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

Page 57: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• The intruder can automatize what you do in the repeater

• brute-force

• defeat CSRF tokens

• ECB block shuffling

• fuzzing

• scan with your own payloads

Page 58: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Multiple types of attacks

• Sniper

• Battering ram

• Pitchfork

• Cluster bomb

Page 59: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

Page 60: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• grep content, look at HTTP codes or lengths

Page 61: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• grep content, look at HTTP codes or lengths

Page 62: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• grep content, look at HTTP codes or lengths

Page 63: BSides Lisbon 2013 - All your sites belong to Burp

Finding vulnerabilities

• Proxy + spider + scanner

• ensures coverage in breadth

• Proxy + repeater + intruder/scanner

• ensures coverage in depth

Page 64: BSides Lisbon 2013 - All your sites belong to Burp

Automation

• One way to automatize your life is through Macros

• “A macro is a sequence of one or more requests.”

Page 65: BSides Lisbon 2013 - All your sites belong to Burp

Automation

• Consider a site with authentication

• eventually, your session will die

• enqueued requests will fail

• you will notice that a few minutes/hours later

• you will repeat login and repeat the requests

• you will be annoyed

Page 66: BSides Lisbon 2013 - All your sites belong to Burp

Automation

• Consider a site with authentication

• eventually, your session will die

• enqueued requests will fail

• you will notice that a few minutes/hours later

• you will repeat login and repeat the requests

• you will be annoyed

• add constantly changing CSRF tokens for extra annoyance

Page 67: BSides Lisbon 2013 - All your sites belong to Burp

Automation

• On each request, I want Burp to

• check if session is still valid

• if not valid

• get current CSRF token

• login

• re-issue the request

Page 68: BSides Lisbon 2013 - All your sites belong to Burp

Automation

Page 69: BSides Lisbon 2013 - All your sites belong to Burp

Automation

Page 70: BSides Lisbon 2013 - All your sites belong to Burp

Automation

Page 71: BSides Lisbon 2013 - All your sites belong to Burp

Automation

Page 72: BSides Lisbon 2013 - All your sites belong to Burp

Automation

Page 73: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

• Burp has an API called Burp Extender

• loads arbitrary code

• hooks into most functionalities

• UI customization

• supports Java, Python and Ruby

Page 74: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

• Creating an extension is easy

• download empty extension with Netbeans project

• or download one of the example extensions

Page 75: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

• addScanIssue

• doActiveScan

• excludeFromScope

• processHttpMessage

• newScanIssue

• and getters/setters for almost anything

Page 76: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

• OwnDB - our ownage DB

Page 77: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

Page 78: BSides Lisbon 2013 - All your sites belong to Burp

Extending Burp

Page 79: BSides Lisbon 2013 - All your sites belong to Burp

Tips

• Copy as curl command

Page 80: BSides Lisbon 2013 - All your sites belong to Burp

Tips

• Copy as curl command• curl -i -s -k -X 'GET' \

-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0' -H 'Referer: https://accounts.google.com/ServiceLoginAuth' \ -b 'GoogleAccountsLocale_session=pt_PT; CheckConnectionTempCookie279=549576; VISITOR_INFO1_LIVE=7bdUV8vsAGg; PREF=f1=50000000&fv=11.8.800; YSC=OH5XpXtqdf0' \ 'https://accounts.youtube.com/accounts/CheckConnection?pmpo=https%3A%2F%2Faccounts.google.com&v=254239808&timestamp=1380796357054'

Page 81: BSides Lisbon 2013 - All your sites belong to Burp

Tips

• Burp to sqlmap

• Burp is good at finding SQLi

• sqlmap is better exploiting them

• There is a plugin for that

• Gason

Page 82: BSides Lisbon 2013 - All your sites belong to Burp

Tips

Page 83: BSides Lisbon 2013 - All your sites belong to Burp

Tips

• Alternative

• right-click request -> Copy to file

• sqlmap -r <savedfile>

Page 84: BSides Lisbon 2013 - All your sites belong to Burp

Tips

• More at www.burpextensions.com

• Proxy Color - colorize requests based on regexp

• JSBeautifier - beautifies JS

Page 85: BSides Lisbon 2013 - All your sites belong to Burp

End

• @tmendo

• tiagomendo at gmail.com - tiago.mendo at telecom.pt

• https://www.facebook.com/ap2si

• Confraria de Segurança da Informação

• informal security presentations

• last Wednesday of each month

• free