Date: 21/05/2022

Difficulty: EASY

CTF: https://app.hackthebox.com/machines/Paper


Enumeration

First things first. let’s test the connection with the target machine:

Untitled

The ttl value of 63 may indicate that the target machine is Linux.

Let’s launch a nmap scan in order to discover the open tcp ports:

Untitled

There are 3 ports open: 22 (ssh), 80 (http), 443 (https).

Untitled

Let’s see what is hosted in the http and https ports:

Untitled
Untitled
Untitled
Untitled

Seems to be the same page.

Untitled

Wappalizer confirms the versions of apache and openssl. I’m going to search if any of this services has a vulnerability I can use:

Untitled
Untitled

Not apparently… Let’s enumerate the directories using wfuzz:

wfuzz -c --hc 404,403 -L -t 200 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt http://10.10.11.143/FUZZ

Untitled
Untitled

Looks like a standard page…

Ok, no clues. Let’s go back and see what we found so far…

Taking a look to the whatweb response, there is something that looks like a domain… office.paper let’s add it to the /etc/hosts file and take a look to it in the web browser:

Untitled

Yeah, there is a website here!

Untitled

This site is using WordPress 5.2.3

Let’s take a look to the page content…

Untitled

The post says that the only user in the blog is Prisonmike, but another user (nick) replied telling him that he has secret information in the blog drafts. If we gain access to the administration panel we should take a look to the drafts.

There is nothing interesting in the other 2 post available, but we can find other 2 posts if we click on Search button:

Untitled

A simple test post and another one of Nick reminding him to not write secrets in the drafts.

We didn’t found anything that could be a password for Prisonmike user, so let’s try to login with default credentials:

Untitled

admin is not a valid user, but prisonmike is. But we still don’t know the password.

Untitled
Untitled

Using searchsploit I found a exploit that seems capable of view unauthenticated posts…

Untitled

Let’s try it!

Untitled

So, yeah, we have access to the draft posts contents… There is one with a “secret” url that seems interesting… Let’s add chat.office.paper to /ect/hosts file and visit it with the web-browser

Untitled

It is a register page, let’s register a new user:

Untitled
Untitled

Automatically I get invited to a chat:

Untitled

Let’s take a look to the chat messages:

Untitled
Untitled

So, let’s open a private chat with Recyclops and see if we can enumerate something:

Untitled
Untitled
Untitled

Let’s see if it’s vulnerable to path traversal:

Untitled

Yep, it is… and we should have access to user flag this way:

Untitled

Not that easy… yep, it is only readable by the owner… there will a ssh key?

Untitled

Nope… but the .hubot_history sounds interesting:

Untitled

There is a connect command? I tried to use it, but it doesn’t seems to work.

Untitled
Untitled
Untitled
Untitled
Untitled
Untitled
Untitled

woah, we found credentials: recyclops:Queenofblad3s!23

Let’s see if we can login as recyclops in the chat:

Untitled
Untitled

Nope, we can’t… Recyclops is a bot made by Dwight… Will him be reusing credentials? Let’s check it via ssh:

Untitled

Yeah!

Untitled

Privilege Escalation

If we scan for SUID binaries, we can see that polkit binary is vulnerable to CVE-2021-3560, so let’s exploit it:

Untitled
Untitled
Untitled
Untitled

And we became root!