How to Remotely Control Computers Over VNC Securely with SSH « Null Byte :: WonderHowTo

VNCis a great protocol that you can use on Windows and Linux machines to remotely control computers. This is useful if you need to control your computer when away from home, help your grandma check her email, or help a client with a disk cleanup. VNC is secure in the sense that it requires authentication in order to make the connection, but after that, the data is sent over the internetunencrypted. This means that an attacker could sniff your traffic and snoop everything that's going on. They could even code a client to get a front row seat toexactlywhat goes on!SSH is a favorite at Null Byte for its multitude of uses, whichwe have previously covered. Today  we're adding one more use to the list. We are going to tunnel our VNC traffic over SSH so that our traffic is safe and secure when making the dangerous journey across the internet.RequirementsLinux box with VNC installedAn SSH tunnel up and runningVNC Over SSHAll traffic is encrypted between these two machines using public key encryption techniques, making it difficult for attackers to sniff it. You can request that SSH listens on a particular port on your local machine, and forwards that down the secure connection to a port on a machine at the other end. We could use something similar to the following:ssh -L<local port>:localhost:<remote port> <machine IP>Roughly translated:Start an SSH connection to the remote computer and listen on portxon my machine, and forward any connections there to portyon the remote machine.The VNC protocol uses port 59xx, where xx is equal to the display number of the server. So, a VNC server on a Windows machine which normally uses display number0, will listen on port5900. Most Unix VNC servers will use display numbers 0, 1, 2 and so on by listening on ports 5901, 5902, etc. If you forward these ports to a remote machine, you can make the remote VNC server appear to be a server running on your local machine.So, imagine you had a VNC server running as$DISPLAY=1on a remote machine and you wanted a secure connection from your local machine. You could start the SSH session using this command:ssh -L 5902:localhost:5901<remote host>Any maps to$DISPLAY=2on your localhost would actually connect to display :1 on the remote host. Note that the above SSH command line is deliberately meant to accept incoming connections only from the local machine. This means that to use the SSH connection that we have just set up, we must connect to it from the same machine, using the special namelocalhost, rather than using the machine's own unique name. Instead of running vncviewer:vncviewer <remote host>:1You could run:vncviewer localhost:2The difference? The second example is over thesecureconnection.You could speed up the connection by compressing the data over the network, as well by appending the-Coption. No more sketchy VNC access. Don't do remote support with someone unless they have a method of securing your data over the network.Be a Part of Null Byte!Post to theforumsChat onIRCFollow onTwitterCircle onGoogle+Want to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseImage viawiredRelatedHow To:Run Your Favorite Graphical X Applications Over SSHHow To:Create an SSH tunnel for your Mac Mini serverHow To:Use VNC to Remotely Access Your Raspberry Pi from Other DevicesHow To:Run Windows 7 on a Nokia n900 SmartphoneHow To:Remotely control an Apple Mac OS X computer over the Internet with VNCHow To:Bypass RealVNC authenticationHow To:Spy on SSH Sessions with SSHPry2.0How To:Browse securely with SSH and a SOCKS proxyHow To:Haunt a Computer with SSHHacking Windows 10:How to Use SSH Tunnels to Forward Requests & Hack Remote RoutersHow To:Install VNC remotely on a Windows XP PCRasberry Pi:Connecting on ComputerHow To:SSH into your iPhone with USBHow To:Secure VNC and Apple Remote Desktop on your computerHack Like a Pro:How to Save the World from Nuclear AnnihilationHow To:SSH into your iPhone or iPod Touch using MacHow To:Discover & Attack Raspberry Pis Using Default Credentials with Rpi-hunterHow To:Set Up a Headless Raspberry Pi Hacking Platform Running Kali LinuxRaspberry Pi:Physical Backdoor Part 1How To:SSH into a serverHow To:Set up SSH tunneling to securely transmit HTTP trafficHow To:Control iPhone/iPod Touch from a computerHow To:Build a Beginner Hacking Kit with the Raspberry Pi 3 Model B+How To:Setup VNC on your computer for your Mac Mini serverHow To:Locate & Exploit Devices Vulnerable to the Libssh Security FlawHow To:Access & Control Your Computer Remotely Using Your iPhoneHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 15 (Creating a Secure Tunnel to MySQL)How To:Monitor another computer screen with Real VNCHow To:Control an iPhone from a computerHow To:Create a Native SSH Server on Your Windows 10 SystemHow To:Access & Control Your Computer Remotely with Your Nexus 5How To:Set Up an SSH Server with Tor to Hide It from Shodan & HackersHow To:Safely Log In to Your SSH Account Without a PasswordHow To:Create an SSH Tunnel Server and Client in LinuxHow To:Create a Free SSH Account on Shellmix to Use as a Webhost & MoreHow To:Push and Pull Remote Files Securely Over SSH with PipesHow To:Create a Reverse Shell to Remotely Execute Root Commands Over Any Open Port Using NetCat or BASH