Investigation

Enumeration

Rustscan

mkdir rust; sudo rustscan -t 1500 -b 1500 --ulimit 65000 -a 10.129.87.222 -- -sV -sC -oA ./rust/{{ip}}
Open 10.129.11.68:22
Open 10.129.11.68:80

PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 63 OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    syn-ack ttl 63 Apache httpd 2.4.41
|_http-title: Did not follow redirect to http://eforenzics.htb/
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.41 (Ubuntu)
Service Info: Host: eforenzics.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel

Dirsearch

dirsearch -u http://eforenzics.htb/
[20:42:57] Starting:                                         
[20:43:24] 301 -  317B  - /assets  ->  http://eforenzics.htb/assets/        
[20:43:24] 403 -  279B  - /assets/                                          
[20:43:41] 200 -   11KB - /index.html                                                                        
[20:44:08] 200 -    4KB - /upload.php  

Website

Checking the Website we notice that there's a service that they offer located at http://eforenzics.htb/service.html. The service is described as Image Forensics. You are able to upload an image file and they will provide a detailed forensic analysis.

Uploading an image will result in a report that you can view.

Example

The first line shows us the used ExifTool Version which is 12.37. If you look this up you'll come across Command Injection: Exiftool before 12.38

Exploitation

Using the discovered vulnerability we will try to gain a shell on our target.

Exiftool 12.37

Enumeration

After we received our shell it's time to enumerate the systmen as we are just the www-data user without any further permissions.

Linpeas

Linpeas will show us a cronjob that runs regularly at a specific time and uses a script located at /usr/local/investigation. Inside that folder we will find an E-Mail that contains a Windows Security Log.

Cronjob

Password Discovery

By searching the security.evtx file we come across something that looks like a password which is stored under TargetUserName.

Privilege Escalation: smorton

Using the password we are able to switch from www-data to smorton.

Privilege Escalation

Enumeration

Checking the permissiosn of smorton reveals that we are able to run /usr/bin/binary as root.

Analyzing /usr/bin/binary

Executing the binary does result in receiving the text Exiting...

We pull that binary to our machine and use Cutter to take a look at the decompiled code.

Snippet of decompiled function: main

I'm not a pro at asm or c but looking at the code it's clear to me that we have to:

  1. Provide 2 additional arguments

  2. argv[1] should be a perl script hosted on a web resource

  3. argv[2] has to be the string lDnxUysaQn

Become Root

root.pl

Let's prepare a simple perl script to get a root shell

Python Webserver

Host a webserver to serve that file

Privilege Escalation

The fun part, let's become root

Last updated