Skip to content

Send the SPNEGO mechListMIC in the SMB2/3 NTLM session setup - #2339

Merged
anadrianmanrique merged 4 commits into
fortra:masterfrom
azoxlpf:fix/spnego-mechlistmic
Nov 18, 2026
Merged

anadrianmanrique merged 4 commits into
fortra:masterfrom
azoxlpf:fix/spnego-mechlistmic

Conversation

@azoxlpf

@azoxlpf azoxlpf commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This PR makes the SMB2/3 NTLM session setup send the SPNEGO mechListMIC (and the AUTHENTICATE MIC that goes with it), which MS-SPNG 3.3.5.1 makes mandatory when NTLM is the preferred mech. Without it, recent versions of Windows Server answers STATUS_INVALID_PARAMETER as soon as the credentials are valid, the LDAP GSS-SPNEGO bind already did this, smb3.login now does the same.

Before & After :

image

@mpgn

mpgn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Nice one

@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Oct 21, 2026
@anadrianmanrique anadrianmanrique self-assigned this Oct 21, 2026
@jeffmcjunkin

Copy link
Copy Markdown
Contributor

+1, I needed this PR for something recent and fun to authenticate to Windows 11 Insider Preview 29704.1000.

godylockz pushed a commit to godylockz/impacket that referenced this pull request Nov 11, 2026
@azoxlpf

azoxlpf commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I noticed that Windows Server vNext (build 29683) also rejects DCE/RPC Kerberos binds when the last SPNEGO leg has no mechListMIC, which breaks secretsdump/DRSUAPI with kerberos (rpc_s_access_denied). I added the Kerberos side of the fix to this PR. Tested against vNext and Server 2022 (no regression).

image

@anadrianmanrique

Copy link
Copy Markdown
Collaborator

Added MsvAvFlags.MIC_PRESENT (0x00000002) whenever SMB3 includes an NTLM AUTHENTICATE_MESSAGE MIC. This follows MS-NLMP §2.2.2.1 (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/83f5e789-660d-4781-8491-5f8c6641f75e), which defines that bit as indicating client-provided message integrity, and §3.2.5.1.2 (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/f9e6fbc4-a953-4f24-b229-ccdcc213b9ec), which specifies how servers detect the MIC field.
Added regression coverage and validated against real Windows Server vNext build 29683: the base branch fails SMB with STATUS_INVALID_PARAMETER, while the updated PR succeeds. Kerberos DCE/RPC was also verified: base fails with rpc_s_access_denied, while the PR succeeds.

@azoxlpf if you are ok, we can merge it

@anadrianmanrique anadrianmanrique added enhancement Implemented features can be improved or revised medium Medium priority item and removed in review This issue or pull request is being analyzed labels Nov 17, 2026
@azoxlpf

azoxlpf commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

LGTM 🙂

@anadrianmanrique

Copy link
Copy Markdown
Collaborator

merging now, Thanks!

@anadrianmanrique
anadrianmanrique merged commit 0957bf2 into fortra:master Nov 18, 2026
8 checks passed
@azoxlpf
azoxlpf deleted the fix/spnego-mechlistmic branch November 18, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Implemented features can be improved or revised medium Medium priority item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants