Skip to content

[servers/SMB] Handle NEGOEX clients for SMBv2#327

Open
SAERXCIT wants to merge 1 commit into
lgandx:masterfrom
SAERXCIT:smb_negoex
Open

[servers/SMB] Handle NEGOEX clients for SMBv2#327
SAERXCIT wants to merge 1 commit into
lgandx:masterfrom
SAERXCIT:smb_negoex

Conversation

@SAERXCIT
Copy link
Copy Markdown

Hi!

This PR lets Responder handle SMB2 clients requiring the use of NEGOEX during SMB authentication.

I have here a W11 machine that absolutely wants NEGOEX as an available SPNEGO MechType in the Negotiate Response, and FINs the connection if it's not present. The changes to packets.py make Responder add it at this step*. :
1_responder_negoans

Then, this machine starts the SMB2 Session Setup Request with an additional step before the NTLMSSP_NEGOTIATE message : a NEGOEX message with expected parameters. At this step, it also still allows NTLMSSP as an SPNEGO MechType:
2_client_negoex

The changes in servers/SMB.py make Responder answer with a generic SPNEGO message requiring the use of NTLMSSP and ignoring NEGOEX completely. Pardon the use of an ugly raw hex string in the code, but as you can see there is no dynamic parameter that needs to be computed at runtime in this message, so I went with the easy solution. The raw hex string is the SMB2 Session Setup Response, highlighted in the hex dump:
3_responder_resp

The regular NTLM flow then kicks off as expected. We end up capturing the NTLMv2 authentication, and it cracks as expected. Here is the complete authentication dance:
summary

I did manage to try out this modified SMB server on multiple Windows clients (as well as in live conditions), and clients that did prefer the NTLMSSP MechType still do even with NEGOEX offered. I still managed to capture their hashes, I did not observe any regression there.

However I did not manage to find a setting to force a client to use the NEGOEX mechanism. As such my testing for NEGOEX handling was only done on the one live machine that displayed this behaviour (for reasons unknown).

* : Looking at the blame, the NEGOEX mechanism was actually enabled until commit 2f1b81b in Dec 2023. If you have more context on why it was disabled it could help make a decision on whether to merge this PR. Maybe it made some clients kick off a NEGOEX negotiation, which Responder was not equipped to handle then?

Cheers!

@lgandx
Copy link
Copy Markdown
Owner

lgandx commented Dec 31, 2025

can you share here or via email the pcap of this exchange?

@SAERXCIT
Copy link
Copy Markdown
Author

Hi, unfortunately I do not have the pcap anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants