Penetration Testing Your Homelab
Your homelab is a perfect environment to learn offensive security techniques — you own the infrastructure, you control the scope, and breaking something doesn’t cost you a production outage. Pentesting your own homelab is one of the fastest ways to build a genuine understanding of attack surfaces, and it turns vague security advice (“patch your systems”) into concrete findings (“your Grafana instance is running 9.0.1 with CVE-2021-43798 exposed”).
This guide covers a structured approach to homelab pentesting: setting up Kali Linux safely, reconnaissance with nmap, vulnerability scanning, web application testing, and using Metasploit responsibly — all against infrastructure you own.
The Golden Rule: Scope and Isolation
Before running a single scan, establish your scope and make sure you won’t accidentally hit anything you don’t own.
Define your target network. Write down the CIDR ranges you’re authorized to test:
In scope:
192.168.10.0/24 — homelab VLAN
192.168.20.0/24 — IoT VLAN
10.10.0.0/24 — VPN subnet
Out of scope:
192.168.1.0/24 — primary home network (production)
Any cloud provider IP
Any IP not in the list above
Never test what you don’t own. Aggressive scanning against cloud providers, your ISP, or neighboring networks is illegal regardless of intent. Accidentally scanning AWS because your VPN was misconfigured is still a problem.
Use a dedicated Kali instance. Don’t run attack tools from your daily driver. Keep your testing environment isolated so tool output, wordlists, and exploit artifacts stay contained.
Setting Up Kali Linux
Kali is the standard pentesting distribution — it ships with hundreds of pre-installed security tools.
Option 1: Kali as a VM
|
|
Option 2: Kali as a Docker Container
For reconnaissance and scanning only (no GUI tools):
|
|
Option 3: Kali on a Dedicated Pi or Mini PC
A dedicated physical device on your homelab VLAN gives you persistent access and avoids VM networking complexity:
|
|
Regardless of method, immediately change the default credentials:
|
|
Phase 1: Reconnaissance
Reconnaissance maps what’s running on your network before you attempt anything offensive.
Network Discovery with nmap
|
|
Understanding nmap output:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu
80/tcp open http nginx 1.18.0
443/tcp open ssl/http nginx 1.18.0
3000/tcp open http Grafana http
8086/tcp open http InfluxDB httpd
9090/tcp open http Prometheus
Each open port is an attack surface. Note every service and version — you’ll look these up for CVEs.
Faster Scanning with masscan
masscan is orders of magnitude faster than nmap for finding open ports across large ranges:
|
|
Then hand off masscan’s open ports to nmap for detailed fingerprinting:
|
|
Service Enumeration
Once you know what’s running, dig deeper into each service:
|
|
Phase 2: Vulnerability Scanning
Reconnaissance tells you what’s running. Vulnerability scanning tells you what’s exploitable.
OpenVAS / Greenbone Community Edition
OpenVAS is the most comprehensive open-source vulnerability scanner. Run it as a Docker stack:
|
|
Create a scan task:
- Configuration → Scan Configs → select “Full and fast”
- Targets → New Target → enter your homelab CIDR
- Scans → New Task → select target and config
- Run the scan — expect 30-60 minutes for a /24
OpenVAS reports vulnerabilities with CVSS scores and remediation advice. A typical homelab finding might be:
HIGH (CVSS 7.5) — Grafana Path Traversal (CVE-2021-43798)
Host: 192.168.10.30:3000
Affected: Grafana 8.x < 8.3.1
Description: Unauthenticated directory traversal allows reading
arbitrary files on the server filesystem.
Solution: Upgrade to Grafana 8.3.1 or later.
Nessus Essentials
Nessus Essentials is free for up to 16 IPs and produces excellent reports:
|
|
Nuclei: Fast Template-Based Scanning
Nuclei uses community-maintained YAML templates to check for specific CVEs and misconfigurations — much faster than OpenVAS for targeted checks:
|
|
Phase 3: Web Application Testing
Most homelab services expose a web UI. These are often the most vulnerable — misconfigured, running old versions, or using default credentials.
Directory and File Discovery
|
|
Nikto: Web Server Scanner
|
|
Intercepting Traffic with Burp Suite Community
Burp Suite is the standard tool for manual web application testing. The free Community edition covers the basics:
- Launch Burp → Proxy → Intercept
- Configure your browser to use
127.0.0.1:8080as HTTP proxy - Browse your homelab web UIs — Burp captures every request
- Use Repeater to manually modify and replay requests
- Use Intruder (rate-limited in Community) for basic fuzzing
Useful things to test manually:
- Try default credentials:
admin/admin,admin/password,root/root - Check for exposed API endpoints that skip authentication
- Modify request parameters — change
user_id=1touser_id=2 - Look for JWT tokens in cookies/headers, decode them at jwt.io
Testing for Common Web Vulnerabilities
|
|
Phase 4: Exploitation with Metasploit
Metasploit Framework is the standard exploitation platform. For homelabbing, the goal is to verify whether a vulnerability is actually exploitable — not just theoretically present.
|
|
A practical Metasploit workflow for a homelab:
|
|
Important: Metasploit exploits can crash services. Before running an exploit module against a target, check its check command:
|
|
Use check before run when you want proof-of-vulnerability without the risk of crashing the service.
Phase 5: Post-Exploitation and Lateral Movement
If you successfully compromise a service, the next question is: how far can an attacker go from there?
|
|
This lateral movement test answers a critical homelab question: if your Grafana instance is compromised, can the attacker reach your NAS, Proxmox, or other VLANs? If yes, your network segmentation needs work.
Building a Vulnerable Practice Target
Testing against your production homelab carries risk. A better approach is to add intentionally vulnerable targets:
DVWA (Damn Vulnerable Web Application)
|
|
Metasploitable3
Metasploitable3 is a deliberately vulnerable Linux/Windows VM:
|
|
VulnHub Machines
Download pre-built vulnerable VMs from vulnhub.com and import into Proxmox or VirtualBox. These are CTF-style machines with specific exploit paths — great for learning a full attack chain.
Your Own “Vulnerable” Infrastructure
Deliberately misconfigure a test VM to practice finding specific issues:
- Run an outdated Grafana or Jenkins version
- Set up a web app with SQL injection (DVWA’s login page)
- Configure SSH with password auth and weak credentials
- Deploy an nginx server with directory listing enabled
- Run a service without authentication on an internal port
Documenting Findings
A pentest is only useful if you document what you found and fix it. Keep a simple findings log:
|
|
After documenting, fix each finding and re-scan to verify remediation. The re-scan is important — it builds the habit of validation rather than just patching and hoping.
Common Homelab Findings (and How to Fix Them)
These show up in almost every homelab pentest:
Default credentials on services. Grafana ships with admin/admin. Portainer with admin/. Check every web UI on first deployment.
Services bound to 0.0.0.0 unnecessarily. Prometheus, InfluxDB, and similar services often listen on all interfaces by default. Bind internal-only services to 127.0.0.1 or a specific internal IP.
No authentication on internal APIs. Prometheus /metrics and /api endpoints, InfluxDB without auth, Home Assistant without a password. Add authentication even for internal services — it stops lateral movement.
Outdated software versions. Run trivy image your-container:latest and nuclei -tags cve regularly. Subscribe to CVE notifications for the software you run.
No network segmentation. IoT devices and servers on the same VLAN means a compromised smart bulb can reach your NAS. Use VLANs to segment trust zones.
Weak SSH configuration. Password auth enabled, root login permitted, outdated algorithms. See the SSH Hardening guide for a complete sshd_config.
Cleartext services inside the LAN. HTTP-only web UIs, unencrypted MQTT, Telnet. Attackers who gain LAN access can sniff credentials. Use TLS everywhere, even internally.
Tooling Cheat Sheet
| Tool | Purpose | Command |
|---|---|---|
| nmap | Port scanning, service detection | nmap -sV -sC -p- target |
| masscan | Fast port discovery | masscan -p0-65535 --rate=1000 subnet |
| nuclei | CVE and misconfiguration scanning | nuclei -l targets.txt -severity high,critical |
| nikto | Web server misconfiguration | nikto -h http://target |
| gobuster | Directory brute-force | gobuster dir -u http://target -w wordlist.txt |
| ffuf | Web fuzzing | ffuf -u http://target/FUZZ -w wordlist.txt |
| sqlmap | SQL injection testing | sqlmap -u "http://target?id=1" --dbs |
| Metasploit | Exploitation framework | msfconsole |
| Burp Suite | Web app proxy and testing | GUI — proxy browser through 127.0.0.1:8080 |
| OpenVAS | Full vulnerability scanning | Docker stack, web UI |
| Hydra | Credential brute-force | hydra -l admin -P wordlist.txt ssh://target |
| enum4linux | SMB/Samba enumeration | enum4linux -a target |
Pentesting your homelab transforms it from a collection of services into a security proving ground. The vulnerabilities you find and fix make your infrastructure genuinely more resilient — and the techniques you learn transfer directly to understanding real-world attack patterns. Start with reconnaissance, layer in vulnerability scanning, and gradually work up to exploitation. Each finding is a lesson, and each fix makes the next round of testing that much less eventful.
Comments