Metasploit
Port Scan
DNS Enumeration
Host FTP Server
Proxy Server
Any proxied traffic that matches the subnet of a route will be routed through the session specified by route.
Use proxychains configured for socks4 to route any application's traffic through a Meterpreter session.
msfvenom
The msfvenom tool can be used to generate Metasploit payloads (such as Meterpreter) as standalone files and optionally encode them.
List Payloads
Basic Examples
Format Options
Encoders
See all encoders
Basic Example:
Meterpreter
Core commands will be helpful to navigate and interact with the target system. Below are some of the most commonly used.
Remember to check all available commands running the help command once a Meterpreter session has started.
Post Exploitation Modules Reference
https://www.offensive-security.com/metasploit-unleashed/post-module-reference/
Core commands
background
: Backgrounds the current sessionexit
: Terminate the Meterpreter sessionguid
: Get the session GUID (Globally Unique Identifier)help
: Displays the help menuinfo
: Displays information about a Post moduleirb
: Opens an interactive Ruby shell on the current sessionload
: Loads one or more Meterpreter extensionsmigrate
: Allows you to migrate Meterpreter to another processrun
: Executes a Meterpreter script or Post modulesessions
: Quickly switch to another session
File system commands
cd
: Will change directoryls
: Will list files in the current directory (dir will also work)pwd
: Prints the current working directoryedit
: will allow you to edit a filecat
: Will show the contents of a file to the screenrm
: Will delete the specified filesearch
: Will search for filesupload
: Will upload a file or directorydownload
: Will download a file or directory
Networking commands
arp
: Displays the host ARP (Address Resolution Protocol) cacheifconfig
: Displays network interfaces available on the target systemnetstat
: Displays the network connectionsportfwd
: Forwards a local port to a remote serviceroute
: Allows you to view and modify the routing table
System commands
clearev
: Clears the event logsexecute
: Executes a commandgetpid
: Shows the current process identifiergetuid
: Shows the user that Meterpreter is running askill
: Terminates a processpkill
: Terminates processes by nameps
: Lists running processesreboot
: Reboots the remote computershell
: Drops into a system command shellshutdown
: Shuts down the remote computersysinfo
: Gets information about the remote system, such as OS
Others Commands (these will be listed under different menu categories in the help menu)
idletime
: Returns the number of seconds the remote user has been idlekeyscan_dump
: Dumps the keystroke bufferkeyscan_start
: Starts capturing keystrokeskeyscan_stop
: Stops capturing keystrokesscreenshare
: Allows you to watch the remote user's desktop in real timescreenshot
: Grabs a screenshot of the interactive desktoprecord_mic
: Records audio from the default microphone for X secondswebcam_chat
: Starts a video chatwebcam_list
: Lists webcamswebcam_snap
: Takes a snapshot from the specified webcamwebcam_stream
: Plays a video stream from the specified webcamgetsystem
: Attempts to elevate your privilege to that of local systemhashdump
: Dumps the contents of the SAM database
Modules
Kiwi Commands
Although all these commands may seem available under the help menu, they may not all work. For example, the target system might not have a webcam, or it can be running on a virtual machine without a proper desktop environment.
New Meterpreter Session Steps
Assuming you gained access, inserted AV Path Exception, wrote implant to disk and executed to catch you callback
Now you are set up and running as a thread in the address space of the
svchost.exe
process
Accessing the Filesystem
Common commands include
cd - change directory on the target
cat - read and output to stdout the contents of a file
del - delete a file on the target
edit - edit a file with vim
ls - list files in current directory
mkdir - make a directory on the target system
rmdir - remove directory on the target system
File collect with meterpreter
download
andupload
commandsEnsure you are escaping the windows ""
Example:
Harvest Credentials
One way to try and harvest come credentials is with the hashdump module
The output of each line is in the following format:
Username:SID:LM hash:NTLM hash:::
another method that can yeild more credentials (especially on the domain controller) is:
Execute a program
The
execute
command allows us to start remote processesexecute
flags-H Create the process hidden from view
-a Arguments to pass to the command
-i Interact with the process after creating it
-m Execute from memory
-t Execute process with currently impersonated thread token
-s Execute process in a given session as the session user
Regarding the last option
-s
, we can find out the available sessions by using theenumdesktops
-command. The following example does that and then executes calc.exe on session 1:
Post Modules for Windows Survey
Winenum Windows Built In enumeration Script
from your meterpreter prompt:
This will use net, netsh, and wmic commands to enumerate the target machine.
Note: Each individual command in this script will have its output stored in the path output in the line starting with 'Output of each individual command is saved to '.
Clearing the Event Log
from a meterpreter prompt
Meterpreter Extensions
kiwi module
Powershell Extension
Powershell Commands from Meterpreter
run a powershell command as a "oneshot" from a meterpreter shell
Metasploit imperssonate
Upgrade shell to meterpreter
Firefox Post Exploitation
can be run as non Administrator or as Admin, registry information gets pulled as Admin
Routing
Set route
Autoroute module
Run autoroute
Create port forward
UAC Escalation
Change UAC to not Notify
Need to be admin
Disable LUA
EnableLUA specifies whether Windows User Account Controls (UAC) notifies the user when programs try to make changes to the computer. UAC was formerly known as Limited User Account (LUA).
Persistance Modules
Registry Run Key
Ensure to set the
RUN_NAME
at a minimumWMI Event Subscription Persistance
Ensure failed login auditing is enabled on target
To enable:
Event ID for a failed logon is
4625
Ensure to set the
USERNAME_TRIGGER
andSESSION
at a minimumCannot be run as SYSTEM or USER needs to be run with ADMINISTRATOR
Last updated