VNC - Port 5800/5801/5900/5901
Become VeryLazyTech member! π
Follow us on:
β Twitter @VeryLazyTech.
πΎ Github @VeryLazyTech.
π Medium @VeryLazyTech.
πΊ YouTube @VeryLazyTech.
π© Telegram @VeryLazyTech.
π΅οΈββοΈ My Site @VeryLazyTech.
Visit our shop for e-books and courses. π
Basic info
VNC (Virtual Network Computing) uses the RFB protocol to share desktops remotely. It transmits framebuffer updates and input events. Many implementations (TightVNC, RealVNC, TigerVNC) differ in auth and cipher support; older implementations still rely on an outdated VNC password format (DES/3DES) that can be trivially recovered.
Default ports:
5900/5901(RFB/VNC) and5800/5801(HTTP gateway to VNC).Common issues: default/weak passwords, unauthenticated or misconfigured viewers, legacy 3DES-encrypted
.vncpasswords, and open management interfaces.Defender quick wins: block VNC ports at the perimeter, force modern authentication (VPN/SSH tunnel + ACLs), rotate creds and disable empty passwords.
Weak or Default Passwords
Test common default VNC passwords for unauthorized access.
Quick Fingerprinting & Discovery
Shodan search: port:5900 product:VNC or RFB.
Enumeration (manual & automated)
Nmap scripts (vnc-info, vnc-title, realvnc-auth-bypass) reveal server banners, version, supported auth mechanisms and sometimes negotiation failures.
Metasploit auxiliary scanner:
Python example (basic handshake):
This shows the RFB protocol version string (e.g., RFB 003.003).
Authentication & Brute Force
Many boxes still use weak passwords or
guestaccounts. Test with a targeted credential list rather than noisy wordlists. Tools:hydra,ncrack,vncclientscripts.VNC password storage: local VNC server password files (e.g.,
~/.vnc/passwd) use an old 8βbyte password format encrypted with a fixed DES key; tools like vncpwd (https://github.com/jeroennijhof/vncpwd) can recover plaintext easily.
Using Hydra
Using Metasploit
Using Nmap
Using Medusa
Password Decryption
Exploit VNC's weak password encryption for credential recovery.
Brute-force:
Extracting VNC password from files (staging/forensics only):
Man-in-the-Middle Attack
Intercept VNC traffic for credential theft and session hijacking.
PostβExploitation
After successful VNC access you can collect intelligence, maintain access, and move laterally. Only perform these actions in environments you own or have explicit permission to test.
Screen Capture
Capture screenshots of the remote desktop for reconnaissance and data collection.
Keylogging and Input Injection
Inject keyboard and mouse inputs to execute commands or access sensitive information. Use vncdo for scripted interactions.
Notes: avoid long-running keyloggers on production; prefer snapshot-and-review techniques and show captured evidence to stakeholders.
Persistence
Create persistent backdoor access to compromised VNC systems (testing only). On Windows you can create auto-start registry entries or scheduled tasks via the GUI or command shell.
Data Exfiltration
Extract sensitive data from compromised VNC sessions.
If clipboard and file sharing are disabled, use screenshots and manual copy/paste via the VNC channel.
Lateral Movement
Use credentials or discovery performed in the VNC session to move to other systems.
Use discovered credentials to attempt logins to other VNC servers or services. Abuse saved credentials in browsers or config files when found.
Credential Harvesting
Look for browser password managers, config files, and application logs containing secrets.
Reminder: harvesting credentials must be authorized and documented; never exfiltrate PII unless part of agreed scope.
Hardening & Defender Playbook
Network controls
Do not expose VNC ports to the internet. Require SSH tunnels or corporate VPN for remote access. Block
5900-5901,5800-5801on perimeter firewalls.
Authentication
Disable empty passwords and legacy auth. Use viewers that support strong authentication (SASL/GSSAPI) or leverage OS-level auth (e.g., Windows RDP instead with NLA). Use per-user credentials and rotate.
Encryption & tunnels
VNCβs native encryption is weak in many implementations. Require SSH or stunnel to protect RFB traffic, or use VPN. If management UI (5800) is enabled, place it behind auth and TLS.
File hygiene
Protect
~/.vnc/passwdand do not store clear-text credentials in scripts. Use OS keyrings or secrets managers instead.
Monitoring & Detection
Alert on inbound connections to VNC ports from unusual IPs. Log new viewer sessions and their durations. Watch for multiple failed auth attempts.
Quick firewall commands:
Common Pitfalls & Remediation
Mistake: Relying on built-in VNC encryption β it may be disabled or weak. Fix: Enforce SSH/VPN tunnels.
Mistake: Using default or shared passwords for support accounts. Fix: Enforce per-user credentials and periodic rotation.
Mistake: Leaving web gateway (5800) publicly accessible. Fix: Require web auth, TLS, and restrict by IP.
Learn & practice For the Bug Bounty
Support VeryLazyTech π
Become VeryLazyTech member! π
Follow us on:
β Twitter @VeryLazyTech.
πΎ Github @VeryLazyTech.
π Medium @VeryLazyTech.
πΊ YouTube @VeryLazyTech.
π© Telegram @VeryLazyTech.
π΅οΈββοΈ My Site @VeryLazyTech.
Visit our shop for e-books and courses. π
Last updated