Post

HackTheBox_Nineveh w/o Metasploit

HTB - Nineveh

Enumeration

Nmap Scan Results

Untitled

Supported HTTP Methods

Untitled

Dirbusting Results for HTTP

Untitled

Dirbusting Results for HTTPS

We have to specify -k flag

Untitled

Visiting the Page

Untitled

Vulnerabilities

phpLiteAdmin v1.9 Vulnerability

Untitled

Exploitation

Brute-Forcing phpLiteAdmin Login Page

Untitled

We obtained password 123. Now let’s try accessing and see what’s up.

Untitled

We are greeted with a page where we can infer that there is a database named test with no tables.

PHP Injection Exploit

Untitled Untitled Untitled

Accessing the Page from Earlier

Untitled Untitled

Using Burp Suite, it shows the POST form as this. We assume the password check is hardcoded to be just a simple strcmp between two fields. If strcmp between two equal strings returns 0, which means it’s equal. If we give an invalid type as one of the fields, it will return null, which is comparable to 0. Let’s try this approach by modifying the POST data.

Untitled

And boom, we’re in:

Untitled Untitled

Local File Inclusion (LFI) Check

On visiting the notes page, we see the file is mentioned in the URL. Let’s check for LFI.

notes parameterError Message
ninevehNotes.txtNo error, displays note
/etc/passwdNo Note is selected.
../../../../../../../../../../etc/passwdNo Note is selected.
ninevehNotesWarning: include(files/ninevehNotes): failed to open stream: No such file or directory in /var/www/html/department/manage.php on line 31
ninevehNoteNo Note is selected.
files/ninevehNotes/../../../../../../../../../etc/passwdFile name too long.
files/ninevehNotes/../../../../../../../etc/passwdThe contents of /etc/passwd
/ninevehNotes/../etc/passwdThe contents of /etc/passwd

As long as ninevehNotes is in the parameter, we can access anything. Let’s try to access the shell we created earlier.

Untitled

Command Execution Check

Let’s check for command execution with ls.

Untitled

We can execute commands. Let’s try getting a reverse shell with Burp Suite now.

URL Encoded Reverse Shell Code

Untitled Untitled

Nice, we have access as www-data. Now let’s escalate our privileges.

Privilege Escalation

Upgrading the Shell

Untitled Untitled Untitled

Uploading and Running LinEnum

Let’s get linenum.sh on an HTTP server and make it available for this machine.

Untitled Untitled Untitled

Exploring the amrois Folder

We can access the amrois folder but can’t view the flag. Let’s look around more.

Untitled

amrois has access to only this folder.

Untitled

Checking for Cron Jobs

Reports are made every minute. There may be a cron job behind this.

Let’s try creating our own script.

Untitled

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
#loop by line
IFS=$'\n'
old_process=$(ps -eo command)
while true; do
new_process=$(ps -eo command)
diff <(echo "$old_process") <(echo "$new_process") |grep [\<\>]
sleep 1
old_process=$new_process
done

Now we do chmod +x /procmon.sh followed by ./procmon.sh to run the script.

Untitled

Identifying Vulnerabilities in Chkrootkit

We see that the cron jobs are executing /usr/bin/chkrootkit.

Chkrootkit vulnerabilities:

Untitled Untitled

Using the identified vulnerability:

Untitled

We have obtained root privilege. Let’s grab our flags.

Root Flag

Untitled

User Flag

Untitled

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.