---
title: "5800,5801,5900,5901 - Pentesting VNC"
section: "Network Services"
sectionSlug: "network-services-pentesting"
sourcePath: "src/network-services-pentesting/pentesting-vnc.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-vnc.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---
# 5800,5801,5900,5901 - Pentesting VNC
## Basic Information
**Virtual Network Computing (VNC)** uses the Remote Framebuffer (RFB) protocol to display and control a remote graphical interface. The client receives framebuffer updates and sends keyboard and pointer events to the server.<sup>[[1]](#references)</sup>
RFB is registered on TCP port **5900**.<sup>[[1]](#references)</sup> VNC deployments commonly map displays to `5900 + display_number` and optional web viewers to `5800 + display_number`, so ports 5800, 5801, 5900, and 5901 are useful enumeration targets.<sup>[[2]](#references)</sup>
```text
PORT STATE SERVICE
5900/tcp open vnc
```
## Enumeration
Nmap can collect RFB protocol and desktop-title information, and Metasploit can check whether a server accepts the `None` authentication type.<sup>[[4]](#references)[[5]](#references)</sup>
```bash
nmap -sV --script vnc-info,realvnc-auth-bypass,vnc-title -p <PORT> <IP>
msf> use auxiliary/scanner/vnc/vnc_none_auth
```
### [**Brute force**](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/generic-hacking/brute-force.md#vnc)
## Connect with a VNC viewer
```bash
vncviewer [-passwd passwd.txt] <IP>::5901
```
## Recovering stored VNC passwords
Some VNC implementations store a password in `~/.vnc/passwd`.<sup>[[3]](#references)</sup>
The legacy VNC password-file format uses DES with a fixed, publicly known key and truncates passwords to eight characters. The `vncpwd` utility can recover the plaintext from this format.<sup>[[1]](#references)[[3]](#references)</sup>
```bash
make
vncpwd <vnc password file>
```
An archived Windows-compatible copy is attached here for convenience. It includes `vncpwd.exe` and the C source. The program accepts either a `.vnc` file or an encrypted password in raw or hexadecimal form, and the Windows build can also enumerate supported stored passwords from the registry:<sup>[[3]](#references)</sup>
```batch
vncpwd.exe <file.vnc-or-encrypted-password>
```
[Vncpwd.Zip](https://raw.githubusercontent.com/HackTricks-wiki/hacktricks/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/vncpwd.zip)
## Shodan
- `port:5900 RFB`
## References
- [1] [RFC 6143: The Remote Framebuffer Protocol](https://www.rfc-editor.org/rfc/rfc6143)
- [2] [Wireshark Wiki: VNC](https://wiki.wireshark.org/VNC)
- [3] [jeroennijhof/vncpwd: VNC password-file decryption tool](https://github.com/jeroennijhof/vncpwd)
- [4] [Nmap NSE documentation: `vnc-info`](https://nmap.org/nsedoc/scripts/vnc-info.html)
- [5] [Rapid7: VNC authentication-none scanner](https://www.rapid7.com/db/modules/auxiliary/scanner/vnc/vnc_none_auth/)