Skip to content

Event ID 4625 flood: how do you stop an RDP brute-force attack?

  • Home
  • Blog
  • Event ID 4625 flood: how do you stop an RDP brute-force attack?
Event ID 4625 flood: how do you stop an RDP brute-force attack?
Short answer

If the Security log shows dozens of “An account failed to log on” (Event ID 4625) entries per minute, your internet-facing RDP port (TCP 3389) is being hit by automated password guessing. The lasting fix is not changing the password or the user name; it is removing 3389 from the internet entirely and granting access through a VPN, RD Gateway or the cloud provider’s just-in-time (JIT) access, combined with MFA.

Symptoms: 4625 events, locked accounts, a sluggish server

  • The Security log in Event Viewer fills up quickly with thousands of “4625(F): An account failed to log on.” entries.
  • The entries show Logon Type 10 (RemoteInteractive) or 3 (Network), and the “Source Network Address” field contains unfamiliar, constantly changing external IP addresses.
  • The failed account names are predictable ones such as administrator, admin, user, test or scanner.
  • The Status / Sub Status fields repeat codes such as 0xC000006A (bad password), 0xC0000064 (non-existent user name) or 0xC0000234 (account locked out).
  • Real users find their accounts locked when they try to connect in the morning.
  • With nobody working on the server, lsass.exe and the RDP service consume CPU and the logon screen is slow to appear.

Root cause: 3389 is directly exposed to the internet

When a Windows server is deployed in the cloud or with a VPS provider, the RDP port is often opened to “any” source in the network security rule for management. The internet is scanned continuously; an open port 3389 is found quickly, and automated tools start trying password lists against common user names. Every attempt is an authentication operation in Windows, so the log grows and CPU load rises.

According to Microsoft’s documentation for event 4625, it is logged for every failed logon on the computer where the attempt was made, and the Source Network Address field shows the IP address of the machine the attempt came from. The same page notes that several 0xC0000064 codes in a row can be a sign of a user enumeration attack. In the cloud the picture is even clearer, because the server does not sit behind an office firewall but is directly on the internet with a public IP address, and the only protection in between is the provider’s network rule.

The real risk is not just slowness. In its ransomware guide, CISA writes that threat actors often gain initial access through exposed and poorly secured remote services and recommends not exposing services such as RDP on the web. If a weak password matches once, the attacker has an interactive session on your server.

Step-by-step fix

  1. Measure the attack: count the 4625 events of the last 24 hours and list the IP addresses with the most attempts (first command below).
  2. Check whether any logon succeeded: review 4624 events with Logon Type 10; if there is a successful logon from an unknown IP, treat it as a security incident.
  3. In the cloud network rule (Azure NSG, AWS security group or your VPS provider’s firewall), remove the 3389 rule whose source is “Any / 0.0.0.0/0”; temporarily allow only your office’s static IP address.
  4. Confirm that Network Level Authentication (NLA) is enabled. According to Microsoft, with NLA enabled users must authenticate before a remote session is established.
  5. Check the local password and account lockout policy with net accounts. Microsoft’s documentation lists 0 as the default for Account lockout threshold on all server types, which means accounts are never locked out.
  6. Set up a permanent access method: a site-to-site or client VPN, an RD Gateway protected by MFA, or the cloud provider’s JIT access. Then close 3389 to the internet completely.
# Count failed logons in the last 24 hours by IP
$ev = Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625; StartTime=(Get-Date).AddHours(-24)}
$ev.Count
$ev | ForEach-Object { ([xml]$_.ToXml()).Event.EventData.Data | Where-Object Name -eq 'IpAddress' | Select-Object -ExpandProperty '#text' } | Group-Object | Sort-Object Count -Descending | Select-Object -First 20 Count, Name

# Successful RDP logons (4624, Logon Type 10)
Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4624] and EventData[Data[@Name='LogonType']='10']]" -MaxEvents 50 | Format-List TimeCreated, Message

# Account lockout policy and NLA status
net accounts
(Get-CimInstance -Namespace root\cimv2\terminalservices -ClassName Win32_TSGeneralSetting -Filter "TerminalName='RDP-Tcp'").UserAuthenticationRequired

Before changing the network rule, make sure the cloud provider’s serial console or browser-based console access works. A wrong rule can lock you out of the server as well.

Account lockout threshold: why is it not enough on its own?

Microsoft says the Windows security baselines treat 10 invalid attempts as a reasonable starting threshold. The same page also states plainly that once a threshold is set, an attacker can deliberately lock out every known account, which is a denial of service. On older Windows versions the built-in Administrator account was excluded from this policy, which is one reason attacks target that name. Since the October 2022 updates (KB5020282), the “Allow Administrator account lockout” policy lets this account be locked out for network logons such as RDP as well; it is enabled by default on new Windows 11 22H2 installations, but on older servers it has to be enabled explicitly. A lockout policy is a mitigation; it does not close the door.

Why renaming the account or changing the port is not a fix

Renaming the Administrator account or moving RDP to another port may reduce the noise in the log for a while, but the service is still exposed to the internet. Port scans recognise RDP on other ports too, and user names can be learned in other ways. These steps can only be extras alongside real access control.

Permanent prevention

  • Never expose RDP to the internet. CISA’s advice is clear: do not expose services such as RDP on the web, and close unused ports.
  • Provide remote access through a VPN with MFA. CISA recommends MFA on all VPN connections.
  • If several users need access, use RD Gateway. RD Gateway concentrates encrypted connections from the internet in one place, and the Microsoft Entra multifactor authentication NPS extension can add a second factor.
  • On Azure, consider just-in-time access in Defender for Cloud. JIT keeps 3389 closed by default and opens it only for an approved request, only for the specified source IP and only for a limited time. It requires Defender for Servers Plan 2.
  • Set the account lockout threshold deliberately and define a process for unlocking locked accounts.
  • Log RDP logon attempts and alert on 4625 and 4624 (Logon Type 10) events; CISA also recommends logging these attempts.
  • Confirm that backups are kept separate from the server and immutable; in a ransomware scenario this is the last line of defence.

When should you call an expert?

If you see a successful 4624 logon from an unknown IP, if new local accounts, unknown scheduled tasks or encrypted files appear on the server, or if you need to change the access architecture of a production server without downtime, do not handle it alone. In situations like these, which we encounter in the field at businesses in Denizli, Workas carries out log analysis, moves RDP behind a VPN or RD Gateway and sets up MFA in a planned way as part of its cloud and server hosting service; we work Monday to Saturday, 08:00–18:00, and respond to emergencies with priority.

Frequently Asked Questions

Does Event ID 4625 always mean an attack?

No. A mistyped password also produces a 4625. What matters is a large number of events in a short time, many different external IP addresses and predictable user names.

Is moving RDP from 3389 to another port enough?

No. It may reduce noise, but the service stays exposed and is found by scans. The lasting fix is a VPN, RD Gateway or JIT access.

What should the account lockout threshold be?

Microsoft gives 10 invalid attempts as a reasonable starting point for the security baselines. However, a threshold also lets an attacker lock accounts deliberately, so it is not a fix on its own.

How can I tell whether the attacker got in?

Review 4624 events with Logon Type 10 in the Security log and successful RDP connections in the TerminalServices-RemoteConnectionManager log for unfamiliar IP addresses.

Sources

  1. KB5020282: Account lockout available for built-in local administrators
  2. Microsoft Learn: 4625(F) An account failed to log on
  3. Microsoft Learn: Account lockout threshold
  4. Microsoft Learn: Integrate RD Gateway with Microsoft Entra MFA NPS extension
  5. Microsoft Learn: Enable just-in-time access (Defender for Cloud)
  6. CISA: #StopRansomware Guide

Let's Get Started

Let's Work Together!

Let's plan your company's IT needs together — we'll quickly find the right solution for you.

x

Since 2002, Workas Software Technology has provided businesses in Denizli with ERP, cybersecurity, network, server and backup, custom software and AI solutions.

Address
Kınıklı, Hüseyin Yılmaz Cd. No:67,
B Blok Z06, 20160 Pamukkale/Denizli, Türkiye
Get in Touch
0549 669 99 06
0535 089 29 29
Working Hours
Mon - Sat: 8:00 - 18:00