In a packet capture of one SMB 2 or 3 connection, why do two negotiate exchanges appear, and what does 0x02FF mean?
answer
- first message may be SMB1-framed
- dialect strings, not numbers
- a wildcard revision, not a dialect
- then the real SMB2 NEGOTIATE
- NetBIOS transport caveat for 3.1.1
basics
~20 sA client that is not sure the server speaks SMB 2 sends an SMB1-framed NEGOTIATE listing the strings "SMB 2.002" and "SMB 2.???". The server replies with an SMB2 NEGOTIATE response; 0x02FF tells the client to send the real SMB2 NEGOTIATE.
solid answer
~40 sMS-SMB2 lets a client negotiate in one of two ways. The multi-protocol negotiate is an SMB1-framed NEGOTIATE whose dialect list ends with the strings `SMB 2.002` and `SMB 2.???`. A server that implements SMB 2.1 or later answers with an SMB2 NEGOTIATE response whose DialectRevision is the wildcard `0x02FF`, which is not a dialect; it means "send me the real SMB2 NEGOTIATE". The client then sends that request listing `0x0202`, `0x0210`, `0x0300`, `0x0302` and `0x0311`, and the server picks the greatest common dialect. So a capture shows two negotiations. The second way, an SMB2-only NEGOTIATE, skips the first step but works only against servers that implement SMB 2.
code
pseudocode · 9 lines1. client -> server SMB1-framed NEGOTIATE
dialects: ..., NT LM 0.12, SMB 2.002, SMB 2.???
2. server -> client SMB2 NEGOTIATE response
DialectRevision = 0x02FF (wildcard, not a dialect)
3. client -> server SMB2 NEGOTIATE request, MessageId 1
Dialects: 0x0202 0x0210 0x0300 0x0302 0x0311
negotiate contexts offered because 0x0311 is listed
4. server -> client SMB2 NEGOTIATE response
DialectRevision = 0x0311 (the dialect in use)go deeper
Recall the dialect list from 2.0.2 to 3.1.1 and that SMB negotiates the highest dialect both sides share.
Explain the multi-protocol NEGOTIATE, the 0x02FF wildcard and the second SMB2 NEGOTIATE, and read both in a capture.
Use the final DialectRevision and the negotiate contexts to answer which dialect a client really uses, and explain the NetBIOS reconnect rule.
Know that the multi-protocol path is what lets SMBv1 fallback exist, and use that to justify disabling SMBv1 centrally.
## The dialect ladder MS-SMB2 identifies each dialect by a revision number: | Revision | Dialect | What the specification says it introduced | |---|---|---| | `0x0202` | SMB 2.0.2 | the SMB 2 base: reconnectable opens, credits, symbolic links, a stronger integrity algorithm | | `0x0210` | SMB 2.1 | the multi-protocol negotiate listing several SMB 2 dialects; client caching state across opens | | `0x0300` | SMB 3.0 | per-share encryption, multiple channels per session, RDMA transports, enhanced failover, directory leases | | `0x0302` | SMB 3.0.2 | asymmetric share detection, unbuffered read and write requests | | `0x0311` | SMB 3.1.1 | negotiated encryption and integrity algorithms, enhanced protection of negotiation and session establishment | The specification's product notes say SMB 2.1 is not in Windows Vista SP1 or Windows Server 2008, SMB 3.0 is not before Windows 8 and Windows Server 2012, SMB 3.0.2 is not before Windows 8.1 and Windows Server 2012 R2, and SMB 3.1.1 is not before Windows 10 and Windows Server 2016. ## Method one: the multi-protocol negotiate A client does not know in advance whether the server speaks SMB 2. MS-SMB2 therefore allows it to start with an SMB1-framed NEGOTIATE that carries the old SMBv1 dialect strings plus extra ones: 1. The client includes `SMB 2.002` if it implements SMB 2.0.2, and `SMB 2.???` if it implements SMB 2.1 or the SMB 3 family. 2. A server that implements SMB 2.1 or later and sees `SMB 2.???` answers with an **SMB2 NEGOTIATE response** whose DialectRevision is `0x02FF`. The specification says this value is sent only in answer to a multi-protocol negotiate with that string. 3. The client sees `0x02FF` and sends a **new, real SMB2 NEGOTIATE request** (its MessageId is 1) listing its actual dialect revisions. For 3.1.1 it also carries negotiate contexts. 4. The server selects the **greatest common dialect**. With no common dialect it fails the request with `STATUS_NOT_SUPPORTED`. A server that only knows `SMB 2.002` answers with an SMB2 response straight away, and a server that sees neither string and still implements SMBv1 continues as SMBv1. That fallback is exactly why SMBv1 availability matters for downgrade questions. ## Method two: the SMB2-only negotiate The client may instead send an SMB2 NEGOTIATE straight away. Per MS-SMB2 this succeeds only for servers that implement SMB 2; there is no fallback to SMBv1. A client set to a single dialect sends a one-entry Dialects list; Microsoft's dialect-management page shows a client configured for 3.1.1 only asking for exactly that. ## What a capture teaches you - **Two NEGOTIATE exchanges are normal** when the client used the multi-protocol method. - **The DialectRevision in the final response is the dialect in use.** A response of `0x02FF` is not a result. - **For 3.1.1, the second request carries negotiate contexts**: pre-authentication integrity (type `0x0001`), encryption capabilities (`0x0002`), compression (`0x0003`), the server name the client dialled (`0x0005`), transport capabilities (`0x0006`), RDMA transforms (`0x0007`) and signing capabilities (`0x0008`). The server must accept them in any order and ignores context types it does not know. - **A 3.1.1 request must carry exactly one pre-authentication integrity context**, or the server fails it with `STATUS_INVALID_PARAMETER`. ## The NetBIOS transport caveat MS-SMB2 allows NetBIOS over TCP only for dialects 2.0.2, 2.1, 3.0 and 3.0.2. If a client implements 3.1.1, receives `0x02FF` and is on NetBIOS over TCP, it **must close the connection and reconnect over direct TCP**. A capture on port 139 that shows a client reconnecting on 445 is this rule at work. ## What to do with it as an administrator When a review asks "which dialect is each client really using?", the answer in a capture is the DialectRevision of the second response. On the server, `Get-SmbSession` gives the same answer for current sessions. A client that never gets past the first exchange is one that offered only SMBv1 strings, and your audit trail for that is the previous question's subject.
- What does a server do when the client's Dialects list shares no dialect with it?MS-SMB2 says the server must select the greatest common dialect between what it implements and the client's Dialects array, and fail the request with STATUS_NOT_SUPPORTED if there is none. That is a failed negotiation, which is different from the 0x02FF wildcard that merely asks for a second NEGOTIATE.
- Why must a 3.1.1 client leave NetBIOS over TCP when it gets 0x02FF?The specification allows NetBIOS over TCP only for dialects 2.0.2 through 3.0.2; 3.1.1 runs over direct TCP, RDMA or QUIC. So a client that implements 3.1.1 and meets 0x02FF on NetBIOS closes the connection and reconnects over direct TCP, which is port 445.
- 0x02FF means the server picked an unknown future dialect
- The first NEGOTIATE in a capture is always a failure
- SMB 2.??? is a real dialect revision number
- A 3.1.1 session can stay on NetBIOS port 139
- Negotiate contexts must arrive in a fixed order