RDP
The Remote Desktop Protocol gives a full graphical session on a remote Windows machine. Admins use it every day, and so do attackers: exposed RDP is one of the most common ways into a network.
- OSI layer
- 7 Application
- Carried in
- TCP (UDP for the graphics transport)
- Ports
- 3389/tcp, 3389/udp
- Specs
- MS-RDPBCGR, MS-CSSP
- Wireshark filter
rdp || tpkt- Encrypted
- yes
Packet structure
After the first two packets everything is inside TLS, so the connection request is the one packet you can always read:
Select a field to see what it does.
The server answers with an X.224 Connection Confirm that carries the selected protocol (or a failure code, e.g. “HYBRID required” when the client cannot do NLA).
How it works
sequenceDiagram
participant C as Client
participant S as Server :3389
C->>S: X.224 Connection Request (mstshash cookie, requested protocols)
S->>C: X.224 Connection Confirm (selected: HYBRID)
C->>S: TLS handshake
S->>C: TLS handshake (server certificate, often self-signed)
Note over C,S: Encrypted from here
C->>S: CredSSP: NTLM or Kerberos login (NLA)
C->>S: MCS Connect, capabilities, licensing
S->>C: Desktop graphics (TCP and UDP 3389)
C->>S: Keyboard and mouse input, clipboard, drive and printer redirection
- Negotiation in clear text: the client names itself (cookie with the user name) and lists the security protocols it supports.
- TLS with the server’s certificate. On domain machines it can come from AD CS; most servers use a self-signed certificate named after the host, which leaks the computer name.
- Network Level Authentication (NLA): with HYBRID the user logs in through CredSSP (NTLM or Kerberos) before the server builds a session or shows a login screen. Without NLA, anyone who connects gets a Windows login screen.
- Session: MCS channels carry graphics, input and virtual channels (clipboard, drives, printers, audio, smart cards). A UDP transport on 3389 speeds up graphics.
In Wireshark
| Filter | Shows |
|---|---|
tcp.port == 3389 | All RDP over TCP |
rdp.rt_cookie | Connection requests with the user name in clear text |
rdp.negReq.requestedProtocols == 0 | Clients asking for Standard RDP Security only (old tools) |
rdp.negReq.selectedProtocol | Protocol the server chose |
rdp.negFailure.failureCode | Refused negotiations |
tls.handshake.type == 11 && tcp.port == 3389 | Server certificates (host names) |
ntlmssp && tcp.port == 3389 | NTLM inside CredSSP (only if not encrypted further) |
udp.port == 3389 | RDP UDP transport |
tcp.port == 3389 && tcp.flags.syn == 1 && tcp.flags.ack == 0 | Connection attempts (brute force when many) |
What normal looks like: admins connect from jump hosts or admin workstations to servers, with NLA, inside the network or through an RD Gateway (HTTPS 443). RDP from the internet straight to 3389, RDP from ordinary workstations to each other, or long sessions at odd hours are suspicious. Many short connections with different or empty mstshash names are scanning or brute force.
Security notes
- Exposed RDP: a top ransomware entry point (brute force, password spraying, bought credentials). Put it behind a VPN or an RD Gateway with MFA, never directly on the internet.
- No NLA: the pre-auth login screen exposes the server to unauthenticated bugs and makes brute force cheap. BlueKeep (CVE-2019-0708) was a wormable pre-auth bug; NLA blocks it.
- Man-in-the-middle: users clicking through certificate warnings, and the legacy Standard RDP Security mode, allow interception (Seth, PyRDP).
- Lateral movement: RDP with stolen credentials is quiet and looks like admin work. Event IDs 4624 (logon type 10), 1149 and 21/25 on the target help.
- Session hijacking: with SYSTEM rights,
tsconattaches to another user’s disconnected session without their password. - Pass-the-hash: Restricted Admin mode lets an NT hash log in to RDP.
- Tunnelling: RDP over SSH or through
plink, ngrok and similar tools hides it from port-based rules; RDP on a non-standard port is still recognisable by the TPKT header (03 00). - Drive and clipboard redirection: a way to copy files in and out; disable it where not needed.
Versions and related
- Standard RDP Security (RC4, server-generated keys) is legacy; TLS and CredSSP (NLA) replaced it.
- RD Gateway tunnels RDP inside HTTPS (443) and adds a central authentication point.
- Restricted Admin and Remote Credential Guard keep credentials off the target host.
- Encryption is TLS; logins are NTLM or Kerberos (see SMB). VNC and SSH are the non-Windows counterparts.
References
- MS-RDPBCGR: RDP basic connectivity and graphics
- MS-CSSP: CredSSP
- CVE-2019-0708 (BlueKeep)