Skip to content

Windows RDP Publicly Exposed: How to Properly Secure Access

Christopher Sakel  ·   ·  7 min Reading time

Updates & News · min 7 Reading time · Christopher Sakel

Windows RDP Publicly Exposed: How to Properly Secure Access
In Brief
  • Open RDP on port 3389 gets scanned on every public server within minutes and probed with standard logins.
  • Network Level Authentication, strict account lockout, and restricted access via a firewall rule belong on every Windows server running RDP.
  • The cleanest approach is to never expose RDP openly to the internet in the first place, but to reach it via VPN instead.

A freshly set up Windows server with an open RDP port doesn't get its first login attempt after days – often it takes only a few minutes. Automated bots continuously scan the entire IPv4 address space for port 3389 and then doggedly work through lists of standard usernames like administrator against thousands of passwords. If you leave RDP unprotected at the edge of your server, you're playing a numbers game – except the house always wins in the end.

This post covers how to secure a Windows server running RDP so that it never joins this game in the first place: from the firewall rule through Network Level Authentication to a VPN tunnel as the cleanest solution.

Why Open RDP Is a Preferred Attack Target

RDP is attractive to attackers because a successful login immediately means full control of the server – no detour through a web shell, no privilege escalation needed. That's exactly why compromised RDP credentials regularly turn up on underground forums, often as an entry point for ransomware. The attack patterns are almost always the same:

  • Port scan: Mass scanning for open TCP 3389 across the entire address space.
  • Credential stuffing: Automated testing of leaked username/password combinations from old data breaches.
  • Brute force: Doggedly working through password lists against known or guessed usernames like administrator or admin.

A look at Event Viewer under Windows Logs, Security quickly shows how serious the problem is: on a freshly set up, unprotected server, numerous failed login attempts (event ID 4625) with completely different usernames pile up within a short time – a clear sign of automated scans, not colleagues mistyping their passwords.

The following table shows which safeguard actually helps against which attack pattern:

MeasureEffective AgainstEffort
Firewall rule limited to a fixed IPPort scan, brute forceLow
Network Level AuthenticationAutomated exploits before loginLow
Account lockout after failed attemptsBrute force, credential stuffingLow
VPN instead of an open portPort scan, brute force, credential stuffingMedium
Warning: Simply changing the RDP port from 3389 to another number is not protection, just security through obscurity. Scanners that search the entire port range find the new port just as reliably – only somewhat later. At most, it should be an additional measure, never the only one.

Step by Step: Securing RDP on the Windows Server

The following steps assume a Windows Server such as the one running as a Windows VPS with us. All commands run in an administrative PowerShell.

  1. Restrict access to fixed IP addresses. If you know which IP you connect from (office, fixed home line), allow only that IP through the Windows Firewall on port 3389:
    New-NetFirewallRule -DisplayName "RDP nur von Büro-IP" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress 203.0.113.10 -Action Allow
    Set-NetFirewallRule -DisplayName "Remote Desktop*" -Enabled False
    The second line disables the built-in, open RDP rule so that two conflicting rules don't exist side by side. If you work from changing locations or your connection doesn't have a fixed IP address, this restriction won't work reliably – the rule would need to be adjusted after every IP change, or you'd suddenly lock yourself out. For exactly this case, step 5 is the better solution.
  2. Enforce Network Level Authentication (NLA). NLA requires authentication before a full RDP session is even established, blocking a large share of automated attacks before the actual login screen ever appears:
    Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 1
  3. Enable account lockout after failed attempts. Without a lockout, a bot can keep trying indefinitely. With this setting, an account is locked for 30 minutes after 5 failed attempts:
    net accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30
  4. Rename the Administrator account. The built-in Administrator account is known on every Windows server and is therefore the first target of any dictionary attack:
    Rename-LocalUser -Name "Administrator" -NewName "svc-mgmt-lokal"
  5. Make RDP reachable only via VPN. This removes the open port 3389 entirely – no RDP service is visible from outside at all, only the VPN endpoint. Connections then run through the tunnel before RDP even comes into reach, and they work regardless of whether your own IP address changes. A ready-made solution for this is our VPN Server product, which can be placed directly in front of your existing root server.
  6. Set up monitoring for failed logins. You shouldn't discover repeated login attempts only after the fact in the Event Log – you should be alerted to them. You can find out what this looks like with our monitoring in the post Monitoring at Prepaid-Host.

Changing the Port or Using a VPN – Which Is the Right Approach?

Both approaches show up in forums as "the" solution. In practice, it's worth taking an honest look at their limits:

Changing the RDP Port
  • Done in five minutes, no additional infrastructure required
  • Noticeably reduces the background noise from pure port-3389 scanners
RDP Behind a VPN
  • Somewhat more setup effort, VPN client required on every access device
  • Port 3389 is completely invisible from outside, not just harder to find
  • The extra login step still protects you even if a password is leaked
A port that nobody can reach from outside doesn't need to be secured against brute force either.

For a single server that only you administer, changing the port is an acceptable first step. As soon as multiple people or multiple servers are involved, a VPN server is the far more robust solution – and it can also be used for other services that would otherwise be exposed on the open internet.

Checking Whether the Safeguards Actually Work

After setting this up, you should check three things before relying on the new configuration:

Practical tip: Always test reachability from outside your own network – for example via a second root server or a mobile network. A test from the same network the server is in often masks the fact that the firewall rule isn't actually working.
  1. Check the port from outside. From another server or your own machine, outside the allowed IP:
    Test-NetConnection -ComputerName DEINE-SERVER-IP -Port 3389
    If TcpTestSucceeded : False comes back even though you're testing from your allowed IP, check the firewall rule from step 1 first – the old, supposedly disabled rule is probably still blocking it.
  2. Check the NLA status. If you connect with an RDP client that doesn't support NLA, the connection must be rejected with an error message – if a classic login screen appears instead, NLA is not active.
  3. Test the lockout. Three to four deliberate failed logins with a test account must trigger a lockout; visible in the Security event log under event ID 4740.

If you also run several public services on the same server, it's worth taking a look at DDoS protection anyway – RDP scans aren't a DDoS attack in the classic sense, but the same underlying principle of keeping the attack surface as small and controlled as possible applies to both areas.

In the end, securing RDP isn't a one-time project but a combination of a few consistently applied measures: as little exposed surface as possible, an extra login step, and a lockout that makes brute force run into a dead end. Anyone who implements these three points removes the basis for practically every standard attack on RDP.

Frequently asked questions

Isn't a strong password enough to secure RDP?
No. A strong password only protects against brute force, not against automated exploits that strike before the actual login. Without Network Level Authentication and account lockout, the server remains vulnerable even if the password is long and complex.
Do I need to disable RDP completely if I don't need it?
If you don't need permanent remote access via RDP, disabling the service is the simplest and safest option. For occasional access, it's enough to open RDP through the firewall only when needed, or to reach it permanently via VPN.
Does changing the RDP port even help?
It reduces the background noise from simple scanners that specifically look for port 3389, but it's no protection against scanners that search the entire port range. As the only measure, it's not sufficient.
How do I notice that someone is currently trying to log in via RDP?
Failed login attempts show up in Windows Event Viewer under Security as event ID 4625. So you don't have to check this manually, it's worth setting up monitoring with alerts for an unusually high number of failed attempts.
Isn't a VPN far too much effort for a single server?
The setup is somewhat more involved than a firewall rule, but it only has to be done once. After that, you connect via RDP as usual, just through the VPN tunnel – and you no longer have to worry about your own IP address changing.