Wonderland
Started with running a TCP scan on the target via NMAP
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-30 17:11 IST
Nmap scan report for 10.201.119.38
Host is up (0.22s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 8e:ee:fb:96:ce:ad:70:dd:05:a9:3b:0d:b0:71:b8:63 (RSA)
| 256 7a:92:79:44:16:4f:20:43:50:a9:a8:47:e2:c2:be:84 (ECDSA)
|_ 256 00:0b:80:44:e6:3d:4b:69:47:92:2c:55:14:7e:2a:c9 (ED25519)
80/tcp open http Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
|_http-title: Follow the white rabbit.
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: 1 IP address (1 host up) scanned in 18.39 seconds
Visiting the address showed the following webpage

Next, I ran a directory scan via Gobuster on the target and found the following subdirectories.
/img
/r/imghad the following three image files

I visited the
/rsubdirectory and got the following.

Next, I again ran a directory scan inside the
/rsubdirectory and found a/asubdirectory.

I repeated the same step and found a
/bsubdirectory inside/a. This seemed like a pattern to me which spelledrabbit.

As I was checking the subdirectories, I made sure to look at the page source simultaneously. In the
/r/a/b/b/i/tsubdirectory I found what seemed like a password.

I loggged into the target via SSH using the credentials given and successfully got initial foothold as the user
alice

I checked the user directory and found two files as follows
root.txt
walrus_and_the_carpenter.pyI checked the
root.txtfile but reading it required root permissions.Next I ran the Python script and got the following output.

My next obvious step was to view it's source code.

Here the script was using the
randommodule in Python to output random lines. This gave me an idea. I could create a separate script namedrandom.pyin the same directory as this script and add custom code to it to get an elevated shell.Hence, I created a
random.pyfile in the same directory aswalrus_and_the_carpenter.pyand added the following code into it.
import os
os.system("/bin/bash")I had to give executable permissions to the file using
chmod +x random.py.Next, I had to look for user permissions to escalate my privileges. There were three other users on the device named
hatterandrabbit.I ran
sudo -land used the same password as I had obtained for the useraliceand viewed the sudo permissions I had.
I could run the Python script as
rabbituser. Hence I ran the following command and elevated torabbituser.
sudo -u rabbit /usr/bin/python3.6 /home/alice/walrus_and_the_carpenter.pyI viewed the user directory and found the following binary

I ran it and obtained the following output

To understand the file better, I used
stringsto read the contents. I had to move the file onto the attacker machine first to do so.

Here in the line that begins with
/bin/echo,dateis being executed without it's full root path being mentioned, hence I thought of using the same approach as before to execute custom code to elevate privileges.I created a file named
dateand entered the following code inside.
#!/bin/bash
/bin/bashNext, I had to add the working directory to the PATH.

Next, I ran the binary as follows.

As it can be seen, I successfully elevated to the
hatteruser by overriding the system PATH.I checked the
/home/hatterdirectory and found apassword.txtfile with the following contents
WhyIsARavenLikeAWritingDesk?To get a proper interactive shell I logged in to the target as
hattervia SSH using the given password.Next, I tried to manually enumerate to get root access but found nothing. The last option was to use LinEnum to automatically enumerate for vulnerabilities.
After the scan I found a capabilities attack vector as follows.

The
perlbinary seemed interesting hence I went to GTFObins like always to look for possible methods to abuseperland get a root shell.
perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "/bin/sh";'I used the above command on the target.

As you can see, I successfully elevated my privileges to the root user. Now obtaining the flags was the only thing that remained.
I obtained the
root.txtflag from/home/alicedirectory and theuser.txtflag from the/rootdirectory.
That was it for this room. See you in the next one.
Last updated
