5 minute read

Ghoul - Methodologies

Information Gathering

Nmap Port Scan

Screenshot

Nmap Script Scan

Screenshot

Nmap Full Port Scan

Screenshot

Nikto Web Scan on Port 80

Screenshot

FuFF Web Enumeration on Port 80

Screenshot

Nikto Port Scan on Port 8080

Screenshot

Service Enumeration

Gobuster Directory Enumeration

Screenshot

HTTP Service Enumeration

Screenshot

The contact form doesn’t work.

Screenshot

/users

Screenshot

/secret.php

Screenshot

User password revealed

Screenshot

ILoveTouka

Tomcat Enumeration on Port 8080

Screenshot

Screenshot

The Tomcat page was accessible with the weak credentials of admin:admin. This appears to be another basic template website with minimal features. The file upload does point to the possible RCE that was mentioned.

Penetration

ZipSlip Exploitation

Screenshot

Screenshot

Screenshot

Screenshot

User Shell As www-data

We are in a docker container, as we can see by the IP address.

Screenshot

Tomcat Credentials

Almost every installation of tomcat has a tomcat-users.xml file that holds credentials.

Screenshot

Screenshot

admin:test@aogiri123

SSH Keys in Backups

In /var/backups/backups/keys many SSH keys can be exfiltrated.

Screenshot

kaneki.backup is password protected, using the ILoveTouka password from earlier we can SSH into the host machine (the target) as the Kaneki user.

Screenshot

Kaneki User Shell

We’re still in a docker container, there are notes on the server that points toward remote management and a vulnerability in Gogs. We also see the reference to the password request earlier on behalf of the Eto individual. Looking in authorized keys we see a user kaneki_pub@kaneki-pc which must be another computer on the docker subnet.

Screenshot

Performing a quick command line ping sweep shows the other computer must 172.20.0.150.

Screenshot

Now that we know the host we can SSH into it without the private key.

Screenshot

Kaneki_pub User Shell

We have yet another docker container on the environment and even one more docker subnet of 172.18.0.0/16 for which we are 172.18.0.200. We can run the same ping sweep to try to identify hosts on this network, possibly the Gogs server.

Screenshot

We see another host of 172.18.0.2, we can assume that this is the Gogs server and begin port forwarding through our SSH shells to be able to access it on our Kali host.

SSH Port Forwarding

Gogs runs on port 3000 by default so we can port forward those through SSH to access it directly on our Kali host.

Screenshot

Screenshot

Gogs Exploitation

The page shows that we are running Go 1.11 and Gogs version 0.11.66.0916.

We already have the username AogiriTest from the previous enumeration, and using that in combination with the tomcat password we found previously allows us to log in to the Gogs page.

AogiriTest:test@aogiri123

Screenshot

We see another user on the page.

Screenshot

CVE-2018-18925

https://nvd.nist.gov/vuln/detail/CVE-2018-18925

https://github.com/RyouYoo/CVE-2018-18925

Screenshot

Screenshot

Screenshot

By hovering over the fork we can see the repo ID

Screenshot

Replace the cookie and reload

Screenshot

Screenshot

We can reset the administrator password and then use a Metasploit module.

Screenshot

Screenshot

Screenshot

SUID Enumeration

Gosu is on the box, Googling it shows that it is a Go implementation of su.

Screenshot

Screenshot

Aogiri-app.7z is the only relevant file on the machine, we can download it for static analysis.

Screenshot

Screenshot

It appears to be a zipped Git repo

Screenshot

git reflog -p

Screenshot

We find a password that we can try.

It only works on a su to root on kaneki-pc

Screenshot

Privilege Escalation

Downloading Pspy to try to figure out wtf is going on

Screenshot

Screenshot