Port 3389 is the RDP (Remote Desktop Protocol) port for Windows remote desktop access. RDP on port 3389 is the second most attacked port on the internet after SSH. Exposing RDP directly enables brute-force attacks, BlueKeep (CVE-2019-0708) exploitation, and ransomware deployment. Always use VPN or RD Gateway – never expose port 3389 directly.
Port Number
3389
Protocol
TCP
Service
Remote Desktop Protocol
Range
IANA Registered (1024–49151)
Extract Windows version, domain name, and hostname from RDP service
nmap -p 3389 --script rdp-ntlm-info targetCheck for BlueKeep-era RDP vulnerabilities
nmap -p 3389 --script rdp-vuln-ms12-020 targetPowerShell: check if RDP is enabled (0=enabled, 1=disabled)
Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnectionsList active RDP sessions on a Windows server
qwinsta /server:targetmstsc /v:server:3389
xfreerdp /u:user /p:pass /v:server:3389
nmap --script rdp-enum-encryption -p 3389 targetRDP (Remote Desktop Protocol) was created by Microsoft in 1996, based on ITU T.128. Port 3389 was assigned for Terminal Services (now Remote Desktop Services). RDP became ubiquitous for Windows server administration. The 2020 pandemic massively increased RDP exposure as organizations enabled remote work hastily. BlueKeep (2019) and the constant ransomware campaigns via RDP made port 3389 the most dangerous port to expose after 445 (SMB).
How do I secure RDP access?
Layered approach: (1) Never expose 3389 to internet (use VPN or RD Gateway). (2) Enable NLA (Network Level Authentication) – authenticates before session. (3) Enforce MFA (Duo, Azure AD Conditional Access). (4) Account lockout after 5 failures (secpol.msc → Account Lockout Policy). (5) Restrict via GPO: Computer Config → Admin Templates → Windows Components → Remote Desktop Services → allow only specific groups. (6) Enable Windows Defender Credential Guard (prevents credential theft from memory).
What is RD Gateway and how does it replace direct RDP?
RD Gateway (Remote Desktop Gateway) sits on port 443 (HTTPS) and authenticates users via TLS before establishing the RDP tunnel. Benefits: (1) Only port 443 exposed (not 3389), (2) supports Azure AD MFA / Conditional Access, (3) provides audit logging of all connections, (4) can enforce resource authorization (which servers a user can reach). Setup: install RD Gateway role, configure RAP/CAP policies, issue SSL certificate, point clients to gateway hostname.