Skip to main content

Metasploitable 2 — My First Root Shell

Updated 6 min readMarkdown
Part of seriesWrite-Ups

Metasploitable 2 — My First Root Shell

In post 2, I built an isolated home lab with Kali Linux and Metasploitable 2. This week I put it to use: going from a network scan to full administrator access on the target.

Lab note: Everything here was done inside my own isolated VirtualBox lab. Metasploitable 2 is a deliberately vulnerable machine published by Rapid7 for training. Never test systems you don't own or have written permission to test — unauthorised access is illegal under the UK Computer Misuse Act 1990.

Target Metasploitable 2 (Rapid7)
Difficulty Beginner
Attacker Kali Linux — 192.168.225.3
Target 192.168.225.4
Skills used Host discovery, service enumeration with nmap, reading scan output, netcat
Time taken ~15 minutes
Date 29 October 2026

Summary

A single service scan showed the target exposing a large number of network services, many of them long out of date. One of them was a listening shell left wide open on an unusual port — no login required. Connecting to it gave me full root (administrator) access to the machine straight away. The real lesson isn't the "hack" — it's how much a single scan reveals, and how one careless service undoes everything else.


1. Getting started

I started a session log so every command and its output was recorded, then checked the target was reachable.

script ~/metasploitable-notes.txt
ping -c 3 192.168.225.4

All three packets returned with 0% loss, confirming the two machines could see each other on the isolated lab network.

Session log started and target reachable

2. Enumeration

Enumeration — finding out what a target is running — is where most of the real work in a pentest happens. I ran an nmap service scan:

nmap -sV 192.168.225.4
nmap service scan results

The scan came back with 23 open ports. On a real business network, that alone would be a serious finding: every open service is something that has to be patched, monitored and justified. Most of the versions here were many years old and no longer supported.

What caught my eye straight away was port 1524, which nmap labelled as a "Metasploitable root shell" — a shell service listening directly on the network. A service like that, reachable without any authentication, is about the most serious thing you can find on a host.

3. Gaining access

I connected to that open shell service using netcat, the basic tool for talking to a network port:

nc 192.168.225.4 1524

I was dropped straight into a shell. A quick check confirmed who I was:

whoami

The answer came back: root — the Linux administrator account, with complete control of the machine. No password, no exploit, just an open door.

Connecting with netcat and confirming root access

4. Detours (keeping it honest)

It wasn't quite as smooth as the commands above make it look, and that's worth sharing because it's how learning actually goes:

  • I first tried to connect over SSH (port 22) and hit Unable to negotiate... no matching host key type. That's modern Kali refusing the target's ancient, insecure SSH settings — a good reminder that old crypto gets dropped for a reason.
  • I fumbled netcat's syntax a few times (no port[s] to connect to) by mixing up where the port goes. Reading the error and the nc -h help got me there.
An example of the SSH negotiation error

Showing the dead ends matters. In a real assessment, knowing why something didn't work is as valuable as the thing that did.


5. Findings & Remediation

This is the part that turns "I got in" into something a business could actually use. If this were a client system, here's what I'd report and how I'd fix it.

# Finding Severity Impact Recommended fix
1 Unauthenticated shell service listening on the network (port 1524) Critical Instant full administrator access to the host Remove the service entirely; it should never exist on a production system
2 Large number of unnecessary services exposed (23 open ports) High Expands the attack surface; more to exploit and to patch Close unused ports; run only the services the host actually needs
3 Outdated, unsupported software versions throughout High Known weaknesses with no vendor fixes available Establish a patching process; replace end-of-life software
4 Legacy, insecure remote-access protocols enabled Medium Weak or no encryption of credentials and traffic Disable legacy protocols; use current, hardened SSH only

Severity guide: Critical · High · Medium · Low · Informational

Overall recommendation: The root cause across every finding is the same — the system runs far more than it needs to, none of it is maintained, and nothing enforces the basics of authentication or patching. A business fixes this not by chasing individual bugs but with three habits: minimise what's exposed, keep everything patched, and require authentication on every service. Those three alone would have closed off everything above.

6. Lessons learned

  • New to me: how much a single nmap -sV reveals, and how to read it — ports, services, versions, and which ones matter.
  • Faster next time: I'll get netcat's syntax right first time (nc <ip> <port>), rather than through trial and error.
  • Real-world connection: the "hack" here needed no skill — the damage was done by leaving an unnecessary service exposed. In the real world, most breaches start exactly like this: something that should never have been reachable, left on and forgotten.

Tools Used

script · ping · nmap · netcat (nc)

References

What's Next

Next I'll go back to Metasploitable and practise proper enumeration of a single service from scan to access, rather than walking through an open door — that's where the real learning is.


Thanks for reading. I'm documenting my journey from hotel management into penetration testing — connect with me on LinkedIn.

— Joe

No comments yet. Be the first to comment.