56
Into The Worm Hole Metasploit Web Exploitation

DefCamp 2013 - MSF Into The Worm Hole

  • Upload
    defcamp

  • View
    309

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: DefCamp 2013 - MSF Into The Worm Hole

Into The Worm HoleMetasploit Web Exploitation

Page 2: DefCamp 2013 - MSF Into The Worm Hole

Who Is This Ugly Dude In Front of Me?

Kizz MyAnthiaSenior Penetration Tester

HP Fortify – ShadowLabs

@Kizz_My_Anthia www.KizzMyAnthia.com

Page 3: DefCamp 2013 - MSF Into The Worm Hole

Who Is This Ugly Dude In Front of Me?

• Background:• Penetration Tester for 13 years• Network Engineer for 15 years

• In IT for 18 years• Regulatory Technology Tester for 5 years• Specializes in mobile technologies and communications• Social Engineering• Physical Security

Page 4: DefCamp 2013 - MSF Into The Worm Hole

Into The Worm Hole

• Introduction• PWN Bones

• Metasploit Framework Parts

• Metasploit for Web PenTesting• Direct Exploits• Browser Exploits

• HeySexxyLady.pwnme• Client-side Attacks

• Wrap Up

Page 5: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

Page 6: DefCamp 2013 - MSF Into The Worm Hole

The PWN Bone is connected to the ‘sploit bone

• Metasploit is a Framework built like a skeletal structure• Each part builds on the others

• Exploit • Payload • Shellcode • Modules • Listeners • Auxiliary Modules • Plugins• Utilities

Page 7: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Exploit• The means by which an attacker, or pen tester, takes advantage of a flaw

within a system, application, or service.• Common eploits include:

• Buffer Overflows• SQL Injections• Configuration Errors

Page 8: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Payload• Code that is executed within an exploit

• These are selected and delivered by the Metasploit Framework• Reverse Shell

• The payload creates a connection from the target machine back to the attacker• Bind Shell

• “Binds” a command prompt to a listening port on the target machine that the attacker can connect to

Page 9: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Shellcode• A set of instructions used as a payload when exploitation occurs

Page 10: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Modules• Whereas Metasploit is concerned, Modules are the pieces of software used

by the framework to perform a specific task• Exploit Modules• Auxiliary Modules

Page 11: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Listeners• A Metasploit Framework component

• Waits for incoming connections or Reverse Payloads• Handles the remote connection

Page 12: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Auxiliary Modules• Reconnaissance• Brute-force• Fuzzers• Custom

Page 13: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Plugins• Applications that leverage the Metasploit Framework for exploitation

• SET• Social Engineers Toolkit

• WMAP• Web Application Scanner

• Fast-track• Open source Python based tool to help perform advanced penetration testing techniques

Page 14: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones

• Utilities• MSFPayload• MSFEncode• MSFVenom

Page 15: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones – WMAP

• WMAP• Web Application “Scanner”• Focuses on utilizing the MSF Web Scanning & Data Collection Modules• Not a “Real” scanner

Page 16: DefCamp 2013 - MSF Into The Worm Hole

PWN Bones - SET

• SET – Social Engineers Toolkit – Social-Engineer.org• Conceived by Chris Hadnagy (loganWHD)• Written by David Kennedy

• Used to perform attacks against human weaknesses exploiting curiosity, credibility, avarice and human stupidity

Page 17: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 18: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

• Direct Exploits• Host/Server Exploits• Service Exploits• “Feature” Exploits

• Browser Exploits• MS10-002 “Aurora”• Tab Nabbing• Browser AutoPWN

Page 19: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting• Direct Exploits

• will exploit a specific host, run until completion, and then exit

Page 20: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

• Passive exploits wait for incoming hosts and exploit them as they connect. Passive exploits almost always focus on clients such as web browsers, FTP clients, etc.

• They can also be used in conjunction with email exploits, waiting for connections.

• Passive exploits report shells as they happen can be enumerated by passing '-l' to the sessions command. Passing '-i' will interact with a shell.

Page 21: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

• So how does this help me?

• This sounds cool, but your full of shit….. Metasploit only works on NetPen tests

Page 22: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 23: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

• MSFPayload• a command-line instance of Metasploit that is used to generate and output all

of the various types of shellcode that are available in Metasploit.

Page 24: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 25: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 26: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

• Start the Metasploit Listener• Use exploit/multi/handler

Page 27: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 28: DefCamp 2013 - MSF Into The Worm Hole

Metasploit For Web PenTesting

Page 29: DefCamp 2013 - MSF Into The Worm Hole

OSINT – Information Gathering

Page 30: DefCamp 2013 - MSF Into The Worm Hole

• Information Gathering or Intelligence Gathering • Create a plan of attack• Gain an in-depth knowledge of the target• Record information for later use

OSINT – Information Gathering

Page 31: DefCamp 2013 - MSF Into The Worm Hole

• Metasploit & Nmap• Uses Metasploit DB Connection• Stores Target information

• Ports• Version• Banners• Scan Details

OSINT – Information Gathering

Page 32: DefCamp 2013 - MSF Into The Worm Hole

• We need to create a Metasploit Framework DB and DB Connection

• First we need to start the DB• service postgressql start

OSINT – Information Gathering

Page 33: DefCamp 2013 - MSF Into The Worm Hole

• Launch MSFConsole and Connect to the DB• msfconsole

OSINT – Information Gathering

Page 34: DefCamp 2013 - MSF Into The Worm Hole

• Connect to newly created DB• db_connect msfdev1:Password1@localhost:5432/msfdev2

OSINT – Information Gathering

Page 35: DefCamp 2013 - MSF Into The Worm Hole

• Closer than Bert and Ernie• Metasploit Framework and Nmap

OSINT – Information Gathering

Microsoft account
Add MSF NMAP section
Page 36: DefCamp 2013 - MSF Into The Worm Hole

• Calling Nmap from Metasploit Framework• nmap –PN –vvv …..

• Nmap can be called from within MSF and run natively

• db_nmap –PN –vvv …..• db_nmap will store the returned Nmap data to the MSF DB for

use later

OSINT – Information Gathering

Page 37: DefCamp 2013 - MSF Into The Worm Hole

• Metasploit Framework has many other Information Gathering Auxiliary Modules available

• SMB scanning • SQL scanning • SSH scanning • FTP scanning • SNMP scanning

OSINT – Information Gathering

Page 38: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

Page 39: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

• Metasploit Client-side Attacks• Browser Attacks

• Buffer Overflow• Code Injection• Heap Spraying

Page 40: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

• Browser Based Exploits• Heap Spraying

• “Heap”• Memory that is unallocated and used by the application as needed for the duration of the

program’s runtime• NOP

• No-Operation Instructions• Assembly Instruction to do Nothing until the next instruction

• NOP Slide• Multiple NOP instructions in succession

Page 41: DefCamp 2013 - MSF Into The Worm Hole

• NOP Slide

HeySexxyLady.pwnme

Page 42: DefCamp 2013 - MSF Into The Worm Hole

• Create Payload• msfpayload windows/shell/bind_tcp LPORT=443 C

HeySexxyLady.pwnme

Page 43: DefCamp 2013 - MSF Into The Worm Hole

• Copy the “Stage 1” Binary code

HeySexxyLady.pwnme

Page 44: DefCamp 2013 - MSF Into The Worm Hole

• Copy & Edit the Binary Payload• Remove all un-needed characters

• “• \x

• Add “90”s to create NOP Slide

HeySexxyLady.pwnme

Page 45: DefCamp 2013 - MSF Into The Worm Hole

• Load IE In Immunity Debugger

HeySexxyLady.pwnme

Page 46: DefCamp 2013 - MSF Into The Worm Hole

• Paste the Binary Payload Into the Debugger

HeySexxyLady.pwnme

Page 47: DefCamp 2013 - MSF Into The Worm Hole

• When Internet Explorer is run within Immunity Debugger the code will be executed

HeySexxyLady.pwnme

Page 48: DefCamp 2013 - MSF Into The Worm Hole

• Does this work in the real world?

HeySexxyLady.pwnme

Page 49: DefCamp 2013 - MSF Into The Worm Hole

• MS10-002 “Aurora”

HeySexxyLady.pwnme

Page 50: DefCamp 2013 - MSF Into The Worm Hole

• Aurora In The Browser

HeySexxyLady.pwnme

Page 51: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

Page 52: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

Page 53: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

Page 54: DefCamp 2013 - MSF Into The Worm Hole

HeySexxyLady.pwnme

Page 55: DefCamp 2013 - MSF Into The Worm Hole

Wrap Up

Metasploit = Power

Page 56: DefCamp 2013 - MSF Into The Worm Hole

Wrap Up

• Where can I get more information?• http://www.offensive-security.com/metasploit-unleashed/Introduction

• Metasploit: The Penetration Tester's Guide• http://www.amazon.com/Metasploit-The-Penetration-Testers-Guide/dp/159327288X

• www.KizzMyAnthia.com