Skip to content

fix(credssp): server side CresSSP + SPNEGO + NTLM#689

Merged
Benoît Cortier (CBenoit) merged 1 commit into
masterfrom
fix/server-credssp-spnego-ntlm
Jun 17, 2026
Merged

fix(credssp): server side CresSSP + SPNEGO + NTLM#689
Benoît Cortier (CBenoit) merged 1 commit into
masterfrom
fix/server-credssp-spnego-ntlm

Conversation

@TheBestTvarynka

@TheBestTvarynka Pavlo Myroniuk (TheBestTvarynka) commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Hi,

This PR fixes the same problem as #688. I rework the fix. See this comment for more details: #688 (comment)

closes #687

Co-authored-by: Ki Hyun Park <justkihyun1998@gmail.com>

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the initial research Ki Hyun Park (@kihyun1998)

@CBenoit Benoît Cortier (CBenoit) merged commit 77c2831 into master Jun 17, 2026
64 checks passed
@CBenoit Benoît Cortier (CBenoit) deleted the fix/server-credssp-spnego-ntlm branch June 17, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reworks the CredSSP server-side negotiation flow to correctly handle SPNEGO+NTLM (with mechListMIC) by allowing the server to return the acceptor’s final SPNEGO token and defer pubKeyAuth to the following leg, matching CredSspClient behavior and Windows RDP servers. It also adds a regression test to cover the previously-unexercised Negotiate+NTLM pairing.

Changes:

  • Add a server-side intermediate PubKeyInfo state to support a two-leg mechListMIC-then-pubKeyAuth exchange.
  • Extract server pubKeyAuth decrypt/encrypt logic into a helper to avoid duplication.
  • Add credssp_negotiate_ntlm client↔server test to pin the 4-step handshake flow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/credssp/mod.rs Updates CredSSP server state machine to support an additional leg for SPNEGO+NTLM MIC completion before pubKeyAuth.
tests/sspi/client_server/credssp.rs Adds a regression test covering Negotiate-mode with NTLM pinned, ensuring the handshake converges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/credssp/mod.rs
Comment on lines +668 to +672
} else {
ts_request.nego_tokens = Some(output_token.remove(0).buffer);

self.state = CredSspState::AuthInfo;
self.state = CredSspState::PubKeyInfo;
}
Comment thread src/credssp/mod.rs
.as_ref()
.unwrap()
.peer_version
.expect("an decrypt public key server function cannot be fired without any incoming TSRequest");
Ki Hyun Park (kihyun1998) added a commit to kihyun1998/sspi-rs that referenced this pull request Jun 18, 2026
The tests/sspi/client_server module is gated on
all(network_client, __test-data), but no test-matrix row enabled
__test-data, so the client<->server pairing tests (credssp_ntlm,
credssp_kerberos, and the credssp_negotiate_ntlm regression test merged
in Devolutions#689) never ran in CI. That gap is how Devolutions#687 shipped unnoticed.

This adds __test-data to the three root-manifest matrix rows. The suite
is hermetic (KdcMock / NetworkClientMock, no real network).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

CredSspServer (Negotiate/NTLM) cannot complete a handshake with sspi's own CredSspClient: pubKeyAuth expected one leg too early

4 participants