metasploit for beginners

18
Metasploit for Beginners Ramnath

Upload: ramnath-shenoy-oscp

Post on 12-Apr-2017

180 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Metasploit For Beginners

Metasploit for Beginners

Ramnath

Page 2: Metasploit For Beginners

Whoami

Ramnath Shenoy

• Engineering @ FireEye

• https://www.linkedin.com/in/ramnathshenoyk

• @Ramnathsk

Page 3: Metasploit For Beginners

Metasploit for Beginners

●Why Metasploit?●Demo Setup ●Auxiliary Module●Exploit Module●Payloads●Demo 1 - Elastic Search exploit●Demo 2 - Jenkins exploit

Page 4: Metasploit For Beginners

Why Metasploit?

● Published independently● Different programming languages● Targeted limited to a specific platform● No evasion techniques● No clear documentation ● No coding style and difficult to embed /modify

Page 5: Metasploit For Beginners

Metasploit FrameworkCurrent stable version is v4.13.X

• Written in ruby, https://github.com/rapid7/metasploit-framework.git,

• [ 1610 exploits, 914 auxiliary, 279 post ,471 payloads , 39 encoders , 9 nops ]

Ready in kali - used in this demo.

Available as windows installer. (Never really tried!..)

Page 6: Metasploit For Beginners

Metasploit Architecture

Libraries

Interfaces

Modulesnops payloads exploits Auxiliary Encoder Post

msfconsole

Rex

MSF::Core

MSF::Base

Tools

Plugins

Page 7: Metasploit For Beginners

Visualising an attack

Target Vulnerable software

PayloadExploitAuxiliary

Windows/ShellWindows/add user

Remote exploitLocal exploit

Scan and enumerateRogue Servers

Post

Enum credentialsExploit suggest

Exploit Payload Post

msfconsole

Page 8: Metasploit For Beginners

Demo Setup!Target Windows 2008 R2 – Metasploitable3

Designed vulnerable to test payload

Setup instructions https://github.com/rapid7/metasploitable3

172.28.128.4Metasploit/kali

Attacker

172.28.128.3

VictimWindows 2k8

Virtual Box

Page 9: Metasploit For Beginners

Msfconsole Navigation cheat sheet!Msfupdate - update

Msfconsole – initialize metasploit

>help - example: help search

>search – example: search name:pcman type:exploit

>show - example show info, show options and show advanced

>use - example use exploit/.., use aux/.., use payload/..

>set, unset, setg & unsetg - set payload/.. set exitfunc

>back,previous

Exploit ,POST and Payload specifics

>set RHOST : Victim IP

>set RPORT: Victim port

>set LHOST: Attacker IP

>set LPORT: Attacker Port on Reverse Connect or Victim Port on Bind

>set SESSION: The Session id of an earlier attack to attempt Local priv esc

Page 10: Metasploit For Beginners

Commands Prior Demo!• Start the PostgreSQL, initialize database for metasploit and then proceed with starting

msfconsole

• Setup a workspace within metasploit to store enumeration result

• Initialise a scan with nmap to store its results. Results in db will be accessible via “services”

Page 11: Metasploit For Beginners

Auxiliary Module - Demo

• Brute Force access tests on different protocols.• Enumerate and gather more information with limited access.• Check for misconfigured or default Web Portals.• Set up a rogue- ftp,http,smb,imap servers

Page 12: Metasploit For Beginners

Auxiliary Module - “use auxiliary/scanner/snmp/snmp_enum”

Page 13: Metasploit For Beginners

Exploit Module Searching remote exploits are typically -> exploit/Platform/protocol/Application_or_service

Searching local exploits are typically -> exploit/Platform/local/Application_or_service

Page 14: Metasploit For Beginners

Payload ModuleBind Shell TCP

• Successful exploitation leads to a new port on Victim with shell access.

Reverse Shell TCP

• Successful exploitation makes to client connect to Attack and provide its shell.

BindShell-Listener

Reverse Shell-Listener

Exploit

Exploit

Page 15: Metasploit For Beginners

Exploit Module -Demoexploit/multi/elasticsearch/script_mvel_rce

ElasticSearch ->1.1.1

Payload -> java/shell/reverse_tcp

Page 16: Metasploit For Beginners

Exploit Module 2In these cases we will need to use the attacker machine as a server, servicing

the delivery of the exploit. We will need 2 more options,

SRVHOST and SRVPORT

Meterpreter Payload ,provides an interactive environment with functionalities likes

• Getsystem, clearnenv, migrate, hashdump, post, up/download,edit

• Run portrecorder , load mimikatz..

Page 17: Metasploit For Beginners

Exploit Module -Demo 2• exploit/multi/http/jenkins_script_console

• windows/meterpreter/reverse_tcp

Page 18: Metasploit For Beginners

Thanks.