Page cover

Gaming Server

Date: 11 November, 2021

Author: Dhaval Kotak

Room: Gaming Server

Port Scanning

nanomite @ zeus in ~/thm/gaming_server
⚡️ nmap 10.10.19.112 | tee nmap.log
Starting Nmap 7.91 ( https://nmap.org ) at 2021-11-11 22:21 IST
Nmap scan report for 10.10.19.112
Host is up (0.21s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 9.16 seconds

Gobuster Scanning

nanomite @ zeus in ~/thm/gaming_server
⚡️ gobuster dir -u http://10.10.19.112 -w /usr/share/wordlists/dirb/common.txt
===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://10.10.19.112
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirb/common.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.1.0
[+] Timeout:                 10s
===============================================================
2021/11/11 22:22:38 Starting gobuster in directory enumeration mode
===============================================================
/.hta                 (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/.htaccess            (Status: 403) [Size: 277]
/index.html           (Status: 200) [Size: 2762]
/robots.txt           (Status: 200) [Size: 33]  
/secret               (Status: 301) [Size: 313] [--> http://10.10.19.112/secret/]
/server-status        (Status: 403) [Size: 277]                                  
/uploads              (Status: 301) [Size: 314] [--> http://10.10.19.112/uploads/]
           
===============================================================
2021/11/11 22:24:36 Finished
===============================================================

Getting SSH Credentials

Username

  • We find the username john in the page source

RSA Key

  • There is a RSA key in the secret directory we discovered by gobuster.

  • We can use ssh2John and then JohnTheRipper itself to get the passphrase for getting the ssh login.

SSH Login

  • Now we can log in as john using ssh credentials we found.

  • And we get the user.txt right away

  • What is the user flag?

    a5c2ff8b9c(REDACTED)ff2f1a5a6e7e

Privilege Escalation

Our uid is a member of lxd group which is a linux container.

We can download alphine builder on our local machine, which provides a way to create Alpine Linux images, so we can mount it using LXD.

  • First clone the repository in your machine and then run the alpine builder script as root in order to build the image as a tar file

Now start a server to transfer the files from your attacker machine to the target machine

Now import the image

Then spawn the root shell by running the following commands:

After that we can find the root flag and read it.

  • What is the root flag?

    2e337b8c9f(REDACTED)8d4e6a7c88fc

Last updated