> cat webmin_notes.txt

Webmin 1.920 – Full Walkthrough

HackersDaddy Internship Linux Exploitation Webmin Exploitation CVE-2019-15107 Privilege Escalation Post Exploitation

1. Let's Begin 🎯

Hey everyone πŸ‘‹

This writeup is part of a CTF-based penetration testing task assigned during an internship at HackersDaddy. Let's walk through the entire exploitation process β€” every step, every stumble, every "aha" moment. Buckle up, let's do this together. πŸš€

A virtual machine is handed over, with absolutely nothing known about it. No hints, no credentials, no attack surface β€” just a VM. After setting it up in VMware Workstation Pro, it is time to dig in.

2. Finding the Target πŸ”

Before anything else, let's find the IP address of the target machine. Since both the Kali machine and the target sit on the same virtual network, a clean path is available to discover it.

arp-scan interface selection

Let's fire up arp-scan to find all alive hosts on this network:

arp-scan --interface=vmnet1 --localnet
Identifying target host IP

Only 2 hosts appear in this virtual network β€” one is the Kali machine, and the other one? That's the target. Simple. βœ…

3. Verifying Connectivity πŸ“‘

Now with the IP in hand, let's make sure the target is actually reachable before moving forward. A quick ping will do.

Verifying connectivity via ping

The target is live. Now, since this IP address will be used throughout the entire process, let's make things cleaner by adding it to /etc/hosts to reference it as ctf.

/etc/hosts
Adding hostname entry in hosts file

Let's verify it's working:

Pinging the hostname ctf

Perfect. πŸŽ‰ The hostname resolves and responses are coming in. Ready to go.

4. Initial Nmap Scan πŸ—ΊοΈ

Alright, let's see what's running on this machine. Starting with a basic SYN scan:

nmap -sS ctf
Initial Nmap scan results showing port 22

Hmm. Only SSH shows up. That's... odd. πŸ€” SSH alone can't be the only attack surface in a task like this β€” something else must be running somewhere. The default nmap scan only covers the top 1000 ports. Let's not stop here.

Let's scan all 65535 ports this time:

nmap -sS -p- ctf
Full port Nmap scan showing port 1337

There it is! πŸ‘€ A service named waste is running on port 1337. The default scan completely missed it. This is exactly why relying only on the default nmap scan is never a good idea β€” always go full range.

5. Service Version Detection πŸ”Ž

Now let's dig deeper and find out exactly what is running on that port:

nmap -sC -sV -p- ctf
Nmap service version detection for Webmin

Port 1337 runs MiniServ 1.920 (Webmin) over HTTP. Interesting. πŸ‘οΈ Let's pull it up in the browser:

http://ctf:1337
Accessing the Webmin page on port 1337

A Webmin login page. Alright, let's try the classic move β€” default credentials: admin:admin

Attempting login with default credentials

And...

Webmin login failed message

No luck. ❌ It doesn't work. No surprise there, but always worth a shot.

6. Researching Webmin πŸ“–

Before going any further, let's understand what is actually being dealt with here.

Researching Webmin exploits on Google

Webmin is a free, open-source, web-based control panel used to administer Linux and Unix systems. Think of it as a GUI control panel for the Linux server β€” user management, file system access, service control, all from a browser. It is a high-value target if entry is possible. πŸ’‘

Now, the key factor here is the version β€” MiniServ 1.920. Let's check if this specific version has any known CVEs.

Searching for Webmin 1.920 CVEs

And indeed, there it is. 😈

7. CVE-2019-15107 β€” Unauthenticated RCE πŸ’₯

Analyzing CVE-2019-15107 details

CVE-2019-15107 β€” an Unauthenticated Remote Code Execution vulnerability affecting Webmin versions 1.890, 1.900, and 1.920.

Here is what is happening under the hood: these versions contain a command injection flaw through the old parameter in password_change.cgi. An unauthenticated attacker can inject and execute arbitrary commands on the web server β€” and best of all? It runs as root. πŸ”₯

No credentials needed. Nothing else required. Let's find an exploit.

8. Checking ExploitDB πŸ—ƒοΈ

Checking ExploitDB for Webmin exploits

A Metasploit module exists for this exact CVE. No need to write a single line of exploit code. 😎 Let's spin up msfconsole.

9. Exploitation with Metasploit βš”οΈ

msfconsole
Starting Metasploit Framework

Now let's search for the exploit module:

search webmin 1.920
Searching for Webmin 1.920 Metasploit module

Found. Let's use that module and check the requirements:

show options
Checking Metasploit exploit options

Here is what needs to be set:

  • RHOSTS β€” The target IP address.
  • RPORT β€” The port where Webmin runs. It defaults to 10000, but this target uses 1337, so this must be updated.
  • LHOST β€” The attacker IP. This is critical ⚠️ β€” it must be the IP on the same network as the target, which in this case is 192.168.135.1 (vmnet1 interface). Accidentally setting it to wlan0 or any other interface causes the exploit to fail silently β€” no errors, just nothing. πŸ˜…

Let's set everything up:

Configuring exploit parameters in Metasploit

Now for one final check before pulling the trigger:

show options
Double-checking Metasploit options before launch

Everything looks perfect. βœ… Let's run it.

run
Successful exploitation and spawning root shell

Access granted. Root shell. πŸŽ‰πŸ”“

CVE-2019-15107 has been successfully exploited on the Webmin service. No credentials, no brute force β€” just a clean unauthenticated RCE straight to root.

10. Stabilizing the Shell πŸ› οΈ

The initial shell is a bit raw and unstable. The natural first instinct is to upgrade it using Python with /bin/bash:

python3 -c 'import pty; pty.spawn("/bin/bash")'

But wait β€” it fails. ❌ The reason? This target doesn't have /bin/bash at all. The shell available here is /bin/sh. So the python pty approach hits a dead end.

No worries though β€” let's just spawn /bin/sh directly in interactive mode: πŸ’‘

/bin/sh -i
Python pty spawn failing due to missing bash

And that does it. 😌 A proper interactive shell is now available. Always check what shells are actually present on the target before assuming /bin/bash exists β€” not every system has it.

11. Finding the Flags 🚩

Let's head over to the root directory:

cd /root

Listing the contents reveals two directories: invin and test. The invin folder looks suspicious. Let's check it out:

ls

Nothing shows up. Hmm. 🀨 Let's look for hidden files:

ls -la
Finding first flag in secret file

A hidden file is found β€” .secret.txt. Reading it reveals the first flag. πŸš©βœ…

Now let's check what is inside the test directory:

Checking test directory contents

This one holds the web content for the Webmin service β€” nothing useful here. Let's keep enumerating.

Checking the home directory for user accounts:

Checking home directory contents

Empty. No users here. Let's cast a wider net and search the entire filesystem for .txt files:

find / -type f -iname "*.txt" 2>/dev/null
Searching the entire filesystem for flag text files

A file named proof.txt sits inside /opt. Let's read it:

Finding second flag in opt directory

Second flag obtained. 🚩🎯

12. Key Takeaways πŸ“

  • πŸ—ΊοΈ Never trust the default nmap scan. It only covers the top 1000 ports. Always run -p- to scan the full range β€” you never know what is hiding on an unusual port like 1337.
  • πŸ” Version numbers matter. Once a service is identified, always check if the specific version has known CVEs. That is often the fastest path in.
  • βš”οΈ Metasploit is highly effective. For well-documented CVEs with existing modules, Metasploit gives reliable exploit delivery and clean session handling.

That's a wrap on this one. πŸ™Œ Hopefully this walkthrough helped clarify the core process rather than just providing steps to follow. See you in the next one. πŸ‘‹

← Back to Writeups