feat(mstsgu): add NTLM RPC association setup - #1838
Merged
Marc-André Moreau (mamoreau-devolutions) merged 2 commits intoAug 30, 2026
Merged
Conversation
Add the DCE/RPC NTLM handshake needed for RD Gateway association setup. Keep its SSPI context independent from HTTP authentication contexts. This excludes live RPC-over-HTTP transport and protected RPC traffic.
Marc-André Moreau (mamoreau-devolutions)
deployed
to
llm-providers
August 29, 2026 23:45 — with
GitHub Actions
Active
Copilot started reviewing on behalf of
Marc-André Moreau (mamoreau-devolutions)
August 29, 2026 23:45
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds NTLM-authenticated DCE/RPC association setup for RD Gateway while keeping HTTP authentication contexts separate.
Changes:
- Adds NTLM bind, bind-ack, and
rpc_auth_3codecs. - Introduces independent SSPI association state.
- Adds wire-format and state-transition tests and documentation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/ironrdp-mstsgu/src/rpc.rs |
Implements NTLM association state and authenticated RPC codecs. |
crates/ironrdp-mstsgu/tests/rpc_pdu.rs |
Tests wire layouts, validation, and NTLM sequencing. |
crates/ironrdp-mstsgu/tests/rpc_tsgu_stubs.rs |
Adds error stubs required by RPC tests. |
crates/ironrdp-mstsgu/README.md |
Documents the new association support. |
crates/ironrdp-mstsgu/CHANGELOG.md |
Records the added feature. |
Suppressed comments (3)
crates/ironrdp-mstsgu/src/rpc.rs:1699
- The security trailer is required to start on a 16-byte boundary relative to the PDU body (MS-RPCE 2.2.2.11), but the decoder only subtracts the declared padding and never checks the trailer offset. A packet can therefore use a self-consistent
auth_pad_lengthwhile placing the trailer at a nonconforming offset and still be accepted. Validatebody_with_padding.len() % 16 == 0before decoding the body.
let body_with_padding = &source[RPC_COMMON_HEADER_SIZE..trailer_offset];
let padding_length = usize::from(trailer[2]);
// The gateway profile accepts canonical zero-filled padding and uses
// auth_pad_length rather than a fixed bind_ack layout.
let body_length = body_with_padding
.len()
.checked_sub(padding_length)
.ok_or(RpcPduError::InvalidAuthenticationPadding { actual: trailer[2] })?;
crates/ironrdp-mstsgu/src/rpc.rs:1682
- MS-RPCE 2.2.2.11 says
auth_reservedshould be ignored on read. Rejecting a nonzero value makes the bind acknowledgement decoder unnecessarily incompatible with peers that populate this reserved byte. Ignore it during decoding; retaining zero on encode is correct.
if trailer[3] != 0 {
return Err(RpcPduError::NonZeroAuthenticationReserved { actual: trailer[3] });
crates/ironrdp-mstsgu/src/rpc.rs:1701
- The authentication padding is alignment-only; MS-RPCE 2.2.2.11 specifies its length and placement but does not require its octets to be zero. Rejecting nonzero padding imposes an extra wire constraint and can reject otherwise conforming bind acknowledgements. Strip the declared padding without inspecting its contents.
if body_with_padding[body_length..].iter().any(|&byte| byte != 0) {
return Err(RpcPduError::NonZeroAuthenticationPadding);
Accept a bind acknowledgement that clears header-signing support. Expose the negotiated value for later protected RPC traffic.
Marc-André Moreau (mamoreau-devolutions)
deployed
to
llm-providers
August 30, 2026 00:47 — with
GitHub Actions
Active
Marc-André Moreau (mamoreau-devolutions)
merged commit Aug 30, 2026
2b40f47
into
master
46 of 60 checks passed
Marc-André Moreau (mamoreau-devolutions)
deleted the
copilot/rpch-ntlm-bind
branch
August 30, 2026 02:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add DCE/RPC NTLM association setup for RD Gateway, including header-signing negotiation.
Keep its SSPI context independent from HTTP authentication contexts.
This excludes live RPC-over-HTTP transport and protected RPC traffic.