In the RDP X.224 negotiation, what do requestedProtocols, selectedProtocol and a failure code such as SSL_REQUIRED_BY_SERVER each tell the client?
answer
- client offers, server picks
- flags in the Connection Request
- response or failure structure
- failure code names server policy
- no negotiation data at all
basics
~20 sThe client lists the protocols it supports in requestedProtocols; the server picks one in selectedProtocol, or refuses with a failure code. A code such as SSL_REQUIRED_BY_SERVER tells the client the server's policy, and the server then closes the connection.
solid answer
~40 sRDP negotiates its security layer in the X.224 exchange. The client appends an RDP Negotiation Request to the Connection Request; its `requestedProtocols` flags are `PROTOCOL_RDP` (0x0), `PROTOCOL_SSL` (0x1), `PROTOCOL_HYBRID` (0x2), `PROTOCOL_RDSTLS` (0x4) and `PROTOCOL_HYBRID_EX` (0x8). The server answers in the Connection Confirm with either an RDP Negotiation Response, whose `selectedProtocol` is the one layer it chose, or an RDP Negotiation Failure whose `failureCode` states why none was acceptable; after a failure the server closes the connection. Codes such as `SSL_REQUIRED_BY_SERVER` (0x1), `SSL_NOT_ALLOWED_BY_SERVER` (0x2), `SSL_CERT_NOT_ON_SERVER` (0x3) and `HYBRID_REQUIRED_BY_SERVER` (0x5) are how a client learns the server's policy. If no negotiation data comes back, the client assumes `PROTOCOL_RDP`. A client that offers CredSSP should also set the TLS flag, and a client that receives a failure structure SHOULD drop the connection.
go deeper
Recall that the client offers flags, the server selects one or refuses with a failure code, and that PROTOCOL_RDP is the legacy value.
Explain requestedProtocols, selectedProtocol and failureCode, the implicit PROTOCOL_RDP when no negotiation data is returned, and the meaning of the three common failure codes.
Read a client-side failure code as evidence of the server's configured policy and say what each one asks you to change.
Treat the failure codes as the measurement channel for a layer-retirement programme: which clients report which code tells you where the debt is.
## Where the negotiation sits Before any security layer exists, RDP uses the X.224 Connection Request and Connection Confirm to agree on one. The Remote Desktop Protocol specification, MS-RDPBCGR, calls this the negotiation-based approach: the client advertises the security protocols it supports, the server selects one, and then the handshake of the selected protocol runs. This answer covers the two small structures that carry the offer and the answer, and what the server's choice means. ## The client's offer The RDP Negotiation Request (section 2.2.1.1.1) is appended to the Connection Request. Its `requestedProtocols` field is a set of flags. | Flag | Value | Meaning | |---|---|---| | `PROTOCOL_RDP` | 0x00000000 | Standard RDP Security | | `PROTOCOL_SSL` | 0x00000001 | TLS | | `PROTOCOL_HYBRID` | 0x00000002 | CredSSP; `PROTOCOL_SSL` SHOULD also be set because TLS is a subset of CredSSP | | `PROTOCOL_RDSTLS` | 0x00000004 | RDSTLS, outside this answer | | `PROTOCOL_HYBRID_EX` | 0x00000008 | CredSSP with the Early User Authorization Result PDU; `PROTOCOL_HYBRID` SHOULD also be set | Because `PROTOCOL_RDP` is zero, "the client offered only the legacy layer" means no other bit is set. ## The server's answer The Connection Confirm carries one of three things (sections 2.2.1.2.1, 2.2.1.2.2 and 3.3.5.3.2). 1. **An RDP Negotiation Response** (type 0x02) whose `selectedProtocol` holds one identifier. The server sends it when it supports, and is configured to use, one of the protocols the client offered. The choice is the server's: a server that supports `PROTOCOL_RDP` and is not configured to refuse it can answer with it. 2. **An RDP Negotiation Failure** (type 0x03) whose `failureCode` says why. After sending it the server MUST close the connection. 3. **No negotiation data**, which is what a server without Enhanced RDP Security sends, and what it sends when the client sent no request. The client then assumes the server does not support Enhanced RDP Security and that `PROTOCOL_RDP` is in effect. ## Reading the failure codes The code is the message a refused client receives about the server's policy. | Failure code | Value | What it says about the server | |---|---|---| | `SSL_REQUIRED_BY_SERVER` | 0x1 | Requires Enhanced RDP Security, with TLS or CredSSP; if only CredSSP was requested, the server supports only TLS | | `SSL_NOT_ALLOWED_BY_SERVER` | 0x2 | Configured to use only Standard RDP Security; supports no external protocol | | `SSL_CERT_NOT_ON_SERVER` | 0x3 | Has no valid authentication certificate, so cannot start the external protocol | | `INCONSISTENT_FLAGS` | 0x4 | The offer disagrees with the protocol already in effect; possible only with the direct approach | | `HYBRID_REQUIRED_BY_SERVER` | 0x5 | Requires Enhanced RDP Security with CredSSP | The specification defines two further codes, for other authentication requirements; they are not covered here. ## What the client does with the answer Section 3.2.5.3.2 says the client SHOULD drop the connection on a failure structure. If a response selects an external protocol, the client runs it and then sends the MCS Connect Initial PDU. If the server selected `PROTOCOL_RDP`, the client SHOULD either continue, or disconnect and restart offering only `PROTOCOL_RDP`; the second option lets a client application ask the user before continuing. ```pseudocode if rdpNegData absent: selected = PROTOCOL_RDP # server has no Enhanced RDP Security elif RDP_NEG_FAILURE: read failureCode; drop the connection elif RDP_NEG_RSP: selected = selectedProtocol if selected != PROTOCOL_RDP: run the selected external protocol, then MCS Connect Initial else: continue, or restart offering only PROTOCOL_RDP ``` ## Why an administrator cares - A client that reports `SSL_NOT_ALLOWED_BY_SERVER` has found a listener that allows only the legacy layer; that is an audit finding, not a client fault. - `SSL_REQUIRED_BY_SERVER` or `HYBRID_REQUIRED_BY_SERVER` shows a listener refusing the legacy layer, which is the intended result of a hardening change on a client that cannot offer more. - `SSL_CERT_NOT_ON_SERVER` points at the server's certificate, not at the client. - A refusal that arrives right after a server-side change is the change working, not an outage; check the code before opening a fault. - The negotiation structures are exchanged before the selected protocol's handshake, so section 5.4.2.1 has both sides re-exchange them afterwards (the client replays the server's choice, the server replays the client's request) to confirm that nothing was altered. ## Common misreadings - **The flags are not strengths.** They name layers; none is a key size or a TLS version. The specification's flag table names TLS 1.0, 1.1 and 1.2 for `PROTOCOL_SSL`, while the later text of section 5.4.5.1 says TLS 1.0 to 1.3. - **A requested list is not a guarantee.** The client asks; the server's configuration decides. - **`INCONSISTENT_FLAGS` is rare.** It arises only with the direct approach, where the server expects CredSSP from the first byte.
- Why does a client offering CredSSP also set the TLS flag?The specification says that when `PROTOCOL_HYBRID` is set, `PROTOCOL_SSL` SHOULD also be set, because TLS is a subset of CredSSP: a CredSSP exchange always runs the TLS handshake first. The same pattern holds one step up, where `PROTOCOL_HYBRID_EX` SHOULD be accompanied by `PROTOCOL_HYBRID`. The practical reading is that a client's requested list is a stack of fallbacks, ending at the legacy zero value.
- How would you use the failure codes in an audit of kiosks that cannot connect after a hardening change?Collect the code each client reports. `SSL_REQUIRED_BY_SERVER` or `HYBRID_REQUIRED_BY_SERVER` on a kiosk means it offered only the legacy value and the new server policy refused it, so the kiosk needs a newer client or a documented exception. `SSL_CERT_NOT_ON_SERVER` means the fault is on the server. A code is evidence of the server's policy, not of what the client could have supported.
- Says the client decides the security layer, and the server just follows.
- Thinks a failure code can be ignored and the session continues on the legacy layer.
- Reads SSL_NOT_ALLOWED_BY_SERVER as a certificate problem.
- Treats PROTOCOL_RDP as a bit that is set, when it is the zero value.
- Says an absent negotiation response means TLS was selected.