OpenKeyS

Completed on September 13, 2020

Overview

OpenKeyS was, at the time, one of the few boxes I had done where it revolved around exploiting published vulnerabilities. It was very fun and interesting to say the least. Even though it was rated as Medium, it was fairly easy to tackle if your enumeration was done right.

References

Enumeration

Masscan: Finding Open Ports

Here, we will be looking for any open ports, both TCP and UDP to then find our attack path once further port scanning as been completed.

Nmap: Port Scanning

Using the log file created from the masscan execution, we will filter the port numbers to simplify our lives. In this case as we only have to ports to enumerate, we could've saved that step.

At this point in my process, I was relying on aggressive scanning, which is technically not necessary and should not be done if we do not want to be detected.

Gobuster: Directory Enumeration

Given the web service exposed, it is the next step into our enumeration. At the same time, we must note that everything goes and the OpenBSD SSH service must also be researched.

Exploitation and Gaining Access

Inspecting /includes gave us access to a swap file. We need to retrieve it in order to inspect it offline.

As you can see on line 15, we found jennifer as the potential user.

After researching the SSH banner information, it seems there are some vulnerabilities that we can attempt.

The OpenBSD Authentication Bypass Vulnerability CVE-2019-19521 is one that can be used against multiple service hosted on OpenBSD.

In this case, we can try -schallenge as user in the http request, but we need to specify the potential user jennifer in the request header, which we will provide along with the session cookie.

BINGO!! What we just retrieved is the SSH private key from 'jennifer'. Let's use it to access the system as this user.

And we have found the user flag! Let follow on and attempt to escalate privileges by using a related vulnerability as the one we used against httpd.

Privilege Escalation

The vulnerability used to bypass authentication against httpd is associated as well with CVE-2019-19522, in which local privilege escalation can be achieved via S/Key and YubiKey. In this case, we will leverage S/Key.

As shown above, by following the associated vulnerability specifications, we were able to escalate privileges. Now, let's grab the root flag:

Last updated

Was this helpful?