Which algorithm signs an SMB session on each dialect, and why do Kerberos and connecting by name matter to its strength?
answer
- the algorithm follows the dialect
- SMB1 used MD5, SMB 2 replaced it
- AES-CMAC arrived with SMB 3.0
- 3.1.1 negotiates, GMAC on newer Windows
- every key derives from the session key
basics
~10 sSMB 2.0.2 and 2.1 sign with HMAC-SHA256, 3.0 and 3.0.2 with AES-128-CMAC, and 3.1.1 with a negotiated algorithm, AES-128-GMAC on Windows 11 and Server 2022 and later. All keys derive from the session key.
solid answer
~40 sThe dialect picks the algorithm. **SMB 2.0.2 and 2.1** use HMAC-SHA256 (the first 16 of 32 bytes go into the header), **SMB 3.0 and 3.0.2** use AES-128-CMAC, and **SMB 3.1.1** uses whatever the signing-capabilities negotiate: HMAC-SHA256, AES-CMAC or AES-GMAC, with AES-128-GMAC on Windows 11 and Windows Server 2022 and later. SMB1 signed with MD5 and is retired. Every key used for signing and encryption is derived from the session key, so the session is only as strong as the authentication behind it: NTLMv2 derives the key from the password, Kerberos starts stronger, and a connection by IP address or CNAME forces NTLM instead of Kerberos.
go deeper
Recall that signing uses a MAC keyed from the session, and that SMB1 used MD5 while SMB 2 replaced it.
Map the dialect to the algorithm: HMAC-SHA256 for 2.0.2 and 2.1, AES-128-CMAC for 3.0 and 3.0.2, a negotiated algorithm on 3.1.1 with AES-128-GMAC on Windows 11 and Server 2022 and later.
Explain why Kerberos, host names and password strength matter: every signing key derives from the session key, so the weakest authentication in the chain sets the strength.
Judge the trade between trimming algorithms for hygiene and the dialects you lose, since removing an algorithm from a list also removes the older dialects that depend on it.
## The algorithm follows the dialect Every signed SMB2 message carries a 16-byte signature in its header and the `SMB2_FLAGS_SIGNED` flag. MS-SMB2 defines how the signature is computed, and the dialect decides. | Dialect | Signing algorithm | Note | |---|---|---| | SMB 1 (retired) | MD5 | Replaced from SMB 2.0.2 onward | | SMB 2.0.2, 2.1 | HMAC-SHA256 | Computed over 32 bytes, the first 16 go in the header | | SMB 3.0, 3.0.2 | AES-128-CMAC | The AES-based MAC that SMB 3.0 introduced | | SMB 3.1.1 | The negotiated one | HMAC-SHA256 (`0x0000`), AES-CMAC (`0x0001`) or AES-GMAC (`0x0002`) | On SMB 3.1.1 the client offers a list in the signing-capabilities negotiate context, most preferred first, and the server returns the one it chose. If the server supports none of the offered algorithms, the specification says it uses AES-CMAC. Windows 11 and Windows Server 2022 and later offer AES-GMAC first, then AES-CMAC, then HMAC-SHA256, and Microsoft describes AES-128-GMAC as a signing acceleration introduced in those releases. How the lists travel in NEGOTIATE belongs to the dialect-negotiation material; here it only matters which one ends up signing. ## Why the session key matters All cryptographic keys used for SMB 2 and 3 signing are derived from the session key. The algorithm only protects as well as that key, so Microsoft's guidance is about where the key comes from: - **A long, complex, non-dictionary password** helps, because with NTLMv2 the session key is derived from the password. - **Kerberos instead of NTLMv2** gives the session key a stronger start. - **Do not connect by IP address or to a CNAME alias**, because both make Windows use NTLM instead of Kerberos. Use the host name, such as `files01.example.internal`, and for an alias assign an alternate computer name rather than a DNS CNAME record. ## What does not change the algorithm - `EnableSecuritySignature` is ignored for SMB 2 and later, so it cannot select or strengthen anything. - `RequireSecuritySignature` decides whether signing is required, not which algorithm is used. - A session is signed when either side requires signing; it is unsigned only when both sides have the requirement at 0. ## Samba's equivalent Samba's `server smb3 signing algorithms` sets which algorithms are offered for SMB 3.1.1. Its default is `AES-128-GMAC, AES-128-CMAC, HMAC-SHA256`. smb.conf(5) notes that removing AES-128-CMAC makes SMB3_00 and SMB3_02 unavailable, and removing HMAC-SHA256 makes SMB2_02 and SMB2_10 unavailable, because those are the only algorithms those dialects have. A Samba setting such as `server smb3 signing algorithms = -HMAC-SHA256` therefore also lowers the dialects the server can speak. ## Pitfalls to avoid in an answer 1. Saying SMB 2 and 3 all sign with the same algorithm. 2. Treating GMAC as available everywhere: it needs SMB 3.1.1 and a peer that offers it, such as Windows 11 or Windows Server 2022 and later, or Samba with it in its list. 3. Forgetting that connecting by IP address silently weakens the key material, whatever the algorithm is. ## Why the choice of algorithm matters operationally Once signing is required by default on newer Windows, every file operation on those sessions is signed, so the cost of signing is paid constantly rather than occasionally. Microsoft presents AES-128-GMAC as a signing acceleration: faster signing operations than the earlier methods, with the benefit most noticeable in high-throughput scenarios. That is the practical reason Windows 11 and Windows Server 2022 and later prefer it, and the reason a baseline that requires signing everywhere is reasonable. An administrator answering a review therefore says three things: which dialect each client really negotiated, which algorithm that dialect implies, and where the session key comes from. The first is a dialect question, the second a lookup in the table above, and the third is the one that depends on the name and the authentication protocol the client used. ```ini # Samba (smb.conf), global section: offer only the two AES-based algorithms # Side effect: SMB 2.0.2 and 2.1 clients can no longer connect (HMAC-SHA256 removed) [global] server smb3 signing algorithms = AES-128-GMAC, AES-128-CMAC ```
- What happens on SMB 3.1.1 if the client offers signing algorithms the server does not support?MS-SMB2 says the server uses AES-128-CMAC, the algorithm with identifier 1, when none of the client's offered algorithms is supported. Otherwise it picks the algorithm common to both and returns it, and both sides then sign with it for that connection.
- Why does Microsoft advise against opening \\192.0.2.10\Finance by address?Connecting by IP address, or to a CNAME alias, makes Windows authenticate with NTLM instead of Kerberos. The session key, and so every signing and encryption key, then derives from an NTLMv2 password exchange rather than a Kerberos start. Use the host name `files01.example.internal` instead.
- On a Samba server, how would you stop it offering HMAC-SHA256 for signing?Set `server smb3 signing algorithms = -HMAC-SHA256`, which removes it from the default list. smb.conf(5) warns that this makes SMB2_02 and SMB2_10 unavailable, since HMAC-SHA256 is the only signing algorithm those dialects have.
- SMB 2 and later still sign with MD5.
- Every SMB 3 dialect signs with AES-128-GMAC.
- Signing strength depends only on the algorithm, not on the authentication behind the session key.
- EnableSecuritySignature selects which signing algorithm is used.
- Connecting by IP address is as good as connecting by name for signing.