Windows Remote Desktop (RDP) is one of the main ways ransomware gets into companies. A server with port 3389 open to the internet is hit with dictionary attacks around the clock, and an accountant's weak password or a forgotten "test" account becomes the way into the network. Here is how to tell that you are already under attack and how to lock RDP down without taking remote work away from staff.
Why an open 3389 is dangerous
- Password guessing starts as soon as the port appears on the internet: scanners find it within hours.
- Vulnerabilities in the service itself (BlueKeep in 2019, for example) allowed taking over a server without any password at all.
- Accounts allowed to log in over RDP are often numerous — from administrators to contractors — and not every password is strong.
Moving RDP to a non-standard port reduces log noise but does not protect: scanners check all ports.
Signs of password guessing
Open the Windows Security log and look at event 4625, a failed logon. Hundreds of these per hour from different addresses, with names like administrator, admin, user1, mean brute force. If a successful 4624 with logon type 10 (remote interactive) follows a series of 4625s, the password may have been guessed.
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 50 |
Select-Object TimeCreated, @{n='IP';e={$_.Properties[19].Value}}, @{n='User';e={$_.Properties[5].Value}}
Windows security events decodes events 4625, 4624 and 4740, error codes and the source of lockouts: paste an export from the log there.
How to protect RDP
- Do not expose RDP to the internet directly. The best option is a Remote Desktop Gateway over HTTPS with certificate checks, or access only from inside the office network.
- If the port is open anyway, allow only your addresses. Permit connections in Windows Defender Firewall and in the router's port forward only from known IPs: offices and administrators' home addresses.
- Turn on NLA (Network Level Authentication): without it the server shows a logon screen to anyone and spends resources on every scanner.
- Account lockout policy: for example, a 15-minute lockout after 10 failed attempts. Choose sensible values, or an attacker will lock your staff out on purpose.
- Limit who can log in. The Remote Desktop Users group should contain only those who really need it. Disable unused accounts.
- Long passwords and a second factor for everyone who logs in remotely. The password policy page helps draft a domain policy.
- Updates. Critical RDP vulnerabilities are fixed only by Windows updates.
Forwarding through the router
If RDP is forwarded on the router, limit sources right there — then scanners never even reach the server. On MikroTik, a src-address-list of allowed addresses is added to the dst-nat rule, and staged lists block those who open many connections in a row. These rules are built by MikroTik port forwarding; forwarding in detail is in the article on port forwarding on MikroTik.
A protection script with rollback
All Windows-side settings — access only from your addresses, NLA and TLS, brute-force blocking, session timeouts and logon auditing — are built by a PowerShell script on the RDP hardening page. It rolls the changes back by itself after 10 minutes unless you confirm the connection still works, so you cannot accidentally cut yourself off from a remote server.
It is also worth closing other old Windows Server weaknesses: SMBv1, NTLMv1, LLMNR and NetBIOS. Windows Server hardening does that, also with an audit mode and rollback.