Secure Remote Access: SSH, RDP, VPN and Zero Trust — The Guide to Amplify Your Security Why leaving port 3389 open on the internet is the digital equivalent of leaving your house key under the doormat — and what to do instead.
Why leaving port 3389 open on the internet is the digital equivalent of leaving your house key under the doormat — and what to do instead.
At some point in the last five years, your company needed someone to access a server, desktop, or internal network from outside the office. The pandemic accelerated all of this brutally: services that used to stay within four walls became exposed to the internet overnight. Often without security review, without MFA, without proper logs.
The result? Remote access is today one of the main vectors for intrusion and ransomware worldwide. Practically every major ransomware incident in recent years started with one of three things: phishing, web vulnerability, or exposed and poorly protected remote access. RDP exposed on port 3389 is so common as an initial vector that several ransomware groups have "RDP scanners" as standard tools.
This guide covers:
RDP is Microsoft's proprietary protocol for graphical access to Windows machines. It's extremely popular because it comes installed by default on all Windows Server and Pro versions, and the experience is almost native.
What happens when you expose port 3389 on the internet:
In the first 24 hours after opening a port 3389 on a public IP, it will receive thousands of connection attempts. There are botnets dedicated exclusively to scanning the internet for exposed RDP.
Attacks against exposed RDP include:
Scary statistic: according to reports from various cyber insurers and DFIR companies, exposed RDP is the initial vector in somewhere between 40% and 60% of investigated ransomware cases.
How to protect if you need RDP:
Rule number one: never, under any circumstances, expose RDP directly to the internet.
If you need RDP, use:
Always with:
SSH is the standard protocol for remote access to Linux/Unix servers. It was created in 1995 to replace Telnet.
What happens when you expose port 22:
Similar to RDP in volume. Bots try credentials — root, admin, ubuntu, pi, oracle, git. The difference is that well-configured SSH is much more resistant than RDP, because it allows authentication via cryptographic key.
How to protect SSH:
# /etc/ssh/sshd_config — minimum recommended configuration
PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
KbdInteractiveAuthentication no
UsePAM yes
PubkeyAuthentication yes
Protocol 2
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com
MaxAuthTries 3
MaxSessions 5
LoginGraceTime 30
AllowUsers seuusuario
X11Forwarding no
AllowAgentForwarding no
AllowTcpForwarding no
PermitTunnel no
LogLevel VERBOSE
SyslogFacility AUTH
And fail2ban:
sudo apt install fail2ban
# /etc/fail2ban/jail.local
[sshd]
enabled = true
port = 22
maxretry = 3
findtime = 600
bantime = 86400
Other tips:
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/id_ed25519ssh-keygen -t ed25519-sk -f ~/.ssh/ided25519skVNC has a catastrophic security history:
Bottom line: don't use VNC exposed on the internet.
Alternatives:
ssh -X)ssh -L 5900:localhost:5900 user@server)Plain text. No encryption. No strong authentication. Everything in the clear.
Botnets like Mirai specialized in finding Telnet exposed on IP cameras, routers, and DVRs with default credentials. Mirai took down Twitter, GitHub, Reddit, and Spotify in 2016 using this botnet.
Disable today:
sudo systemctl status telnet.socket
sudo systemctl disable telnet.socket
sudo systemctl stop telnet.socket
sudo apt remove telnetd
IPsec — veteran, industry standard, complex configuration, NAT issues.
OpenVPN — mature open-source, flexible, limited performance (single-threaded).
WireGuard — new generation, ~4,000 lines of code, fixed modern cryptography, exceptional performance.
PPTP — cryptographically broken since 2012. Never use it.
L2TP/IPsec, SSTP — legacy, very specific cases.
The VPN concentrator is the target. Serious vulnerabilities in recent years:
Access is binary. Connected? Access to the entire network. Lateral movement is easy.
Poor performance at global scale. Backhaul to the concentrator.
MFA often optional or poorly implemented.
Limited visibility into what the user accessed within the network.
The phrase: "never trust, always verify" — never trust, always verify.
The traditional model was "castle": walls, gates, everyone inside is trustworthy. Zero Trust inverts:
While VPN connects you to the entire network, ZTNA connects you to specific applications, after validating who you are, on which device, in which context.
How it works:
The user never has access to the network, only to the application. The application is not exposed to the internet. The ZTNA connector runs within the network and makes an outbound connection to the provider.
Cloudflare One (Cloudflare Access + Tunnel)
Tailscale
Twingate
Zscaler Private Access (ZPA)
Microsoft Entra Private Access
Others: Perimeter 81/Check Point Harmony, NetSkope, Palo Alto Prisma, Cato Networks.
| Aspect | Traditional VPN | Modern ZTNA | |---|---|---| | Access | Entire network | Specific applications | | Internet exposure | Concentrator exposed | No open ports | | Lateral movement | Easy | Drastically difficult | | Granularity | By user/group | By user + device + context + app | | Visibility | VPN connection | Each access to each app | | Global performance | Backhaul | Closest PoP | | Setup | Complex | Usually simple | | Entry cost | Can be zero (self-hosted) | Can start free |
| Service | Port | Risk if exposed | What to do | |---|---|---|---| | RDP | 3389 | Critical. Vector #1 ransomware | Never expose. VPN/RD Gateway/bastion/ZTNA | | SSH with password | 22 | High. Brute force | Disable password. Use ED25519 keys | | SSH with key | 22 | Low if updated | Hardening + fail2ban + monitoring | | VNC | 5900 | Critical. Catastrophic history | Never expose. Use SSH tunnel/ZTNA | | Telnet | 23 | Critical. Plain text | Disable. Use SSH | | FTP | 21 | High. Plain text | SFTP or FTPS | | SMB | 445 | Critical. WannaCry vector | Never expose | | SNMP v1/v2c | 161 | High. Community in plain text | SNMPv3, never expose | | Databases | various | Critical. Extortion and theft | Never expose. Firewall + strong auth | | Admin panels | various | High. CVE RCEs | IP whitelist or ZTNA | | VPN concentrator | varies | High. Priority target | Patches + MFA + monitoring |
1. Make an inventory of what's exposed. You can't protect what you don't know exists.
2. Map what each port should be doing. For each service: does it need to be exposed? Why? Who uses it? When was it last reviewed?
3. Close everything that doesn't need to be open. Immediately.
4. For everything that needs remote access, never expose the service directly. In order:
5. Enable MFA on everything. No exceptions.
6. Keep everything updated. Critical patches within 48 hours.
7. Monitor continuously. Exposures reappear.
8. Centralized logs. Failed attempts, strange IPs, unusual times.
9. Quarterly reviews at minimum.
10. Train your users. Social engineering bypasses MFA.
The difference between a company with adequate remote access hardening and one without is often the difference between being in the news for something good (product launch) or something bad (ransomware attack with a week of downtime).
The good news: modern tools — especially ZTNA — have made doing the right thing easier and cheaper than continuing to do the wrong thing. Cloudflare One, Tailscale, and Twingate have free plans. WireGuard is free. SSH with ED25519 keys is free. Doing nothing costs more.
The worst scenario isn't the sophisticated attack. It's the annoying attack: bot brute-forcing exposed RDP, finding a weak password, installing ransomware, encrypting everything. Not a movie attacker. It's an automated script running for months, waiting for someone to leave the door slightly ajar.
SentinelHub scans exactly this type of exposure: monitors your public IPs, identifies exposed ports and services, alerts when something new appears, crosses with CVE databases to see if the version has known vulnerability, and translates everything to English so you don't have to guess.
Found it useful? Share with your company's IT team. If they still have RDP exposed on the internet, especially share.