4 ntlmssp interface definition
8 pointer_default(unique),
9 helper
("../librpc/ndr/ndr_ntlmssp.h"),
10 helpstring("NTLM messages"),
11 uuid("6e746c6d-7373-700a-0000-00000000")
15 typedef [v1_enum] enum {
16 NtLmNegotiate
= 0x00000001,
17 NtLmChallenge
= 0x00000002,
18 NtLmAuthenticate
= 0x00000003
19 } ntlmssp_MessageType
;
21 /* [MS-NLMP] 2.2.2.5 NEGOTIATE */
23 typedef [bitmap32bit
] bitmap
{
24 NTLMSSP_NEGOTIATE_UNICODE
= 0x00000001,
25 NTLMSSP_NEGOTIATE_OEM
= 0x00000002, /* NTLM_NEGOTIATE_OEM in MS-NLMP */
26 NTLMSSP_REQUEST_TARGET
= 0x00000004,
27 NTLMSSP_NEGOTIATE_SIGN
= 0x00000010, /* Message integrity */
28 NTLMSSP_NEGOTIATE_SEAL
= 0x00000020, /* Message confidentiality */
29 NTLMSSP_NEGOTIATE_DATAGRAM
= 0x00000040,
30 NTLMSSP_NEGOTIATE_LM_KEY
= 0x00000080,
31 NTLMSSP_NEGOTIATE_NETWARE
= 0x00000100, /* not mentioned in MS-NLMP */
32 NTLMSSP_NEGOTIATE_NTLM
= 0x00000200,
33 NTLMSSP_NEGOTIATE_NT_ONLY
= 0x00000400,
34 NTLMSSP_ANONYMOUS
= 0x00000800, /* no symbol name in MS-NLMP */
35 NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED
= 0x00001000,
36 NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED
= 0x00002000,
37 NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL
= 0x00004000, /* not mentioned in MS-NLMP */
38 NTLMSSP_NEGOTIATE_ALWAYS_SIGN
= 0x00008000,
39 NTLMSSP_TARGET_TYPE_DOMAIN
= 0x00010000,
40 NTLMSSP_TARGET_TYPE_SERVER
= 0x00020000,
41 NTLMSSP_TARGET_TYPE_SHARE
= 0x00040000,
42 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
= 0x00080000,
43 NTLMSSP_NEGOTIATE_IDENTIFY
= 0x00100000,
44 NTLMSSP_REQUEST_NON_NT_SESSION_KEY
= 0x00400000,
45 NTLMSSP_NEGOTIATE_TARGET_INFO
= 0x00800000,
46 NTLMSSP_NEGOTIATE_VERSION
= 0x02000000,
47 NTLMSSP_NEGOTIATE_128
= 0x20000000, /* 128-bit encryption */
48 NTLMSSP_NEGOTIATE_KEY_EXCH
= 0x40000000,
49 NTLMSSP_NEGOTIATE_56
= 0x80000000
52 /* convenience mapping */
53 const int NTLMSSP_NEGOTIATE_NTLM2
= NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
;
56 NTLMSSP_WINDOWS_MAJOR_VERSION_5: Windows XP SP2 and Server 2003
57 NTLMSSP_WINDOWS_MAJOR_VERSION_6: Windows Vista, Server 2008, 7, Server 2008 R2, 8, Server 2012, 8.1, Server 2012 R2
58 NTLMSSP_WINDOWS_MAJOR_VERSION_10: Windows 10, Windows Server 2016 Technical Preview
61 typedef [enum8bit
] enum {
62 NTLMSSP_WINDOWS_MAJOR_VERSION_5
= 0x05,
63 NTLMSSP_WINDOWS_MAJOR_VERSION_6
= 0x06,
64 NTLMSSP_WINDOWS_MAJOR_VERSION_10
= 0x0A
65 } ntlmssp_WindowsMajorVersion
;
68 NTLMSSP_WINDOWS_MINOR_VERSION_0: Windows Vista, 10, Server 2016 Technical Preview
69 NTLMSSP_WINDOWS_MINOR_VERSION_1: Windows XP SP2, 7, Server 2008 R2
70 NTLMSSP_WINDOWS_MINOR_VERSION_2: Windows Server 2003, 8, Server 2012
71 NTLMSSP_WINDOWS_MINOR_VERSION_3: Windows 8.1, Server 2012 R2
74 typedef [enum8bit
] enum {
75 NTLMSSP_WINDOWS_MINOR_VERSION_0
= 0x00,
76 NTLMSSP_WINDOWS_MINOR_VERSION_1
= 0x01,
77 NTLMSSP_WINDOWS_MINOR_VERSION_2
= 0x02,
78 NTLMSSP_WINDOWS_MINOR_VERSION_3
= 0x03
79 } ntlmssp_WindowsMinorVersion
;
82 NTLMSSP_REVISION_W2K3_RC1:
83 NTLMSSP_REVISION_W2K3: Windows XP SP2, Server 2003, Vista, Server 2008, 7, Server 2008 R2
86 typedef [enum8bit
] enum {
87 NTLMSSP_REVISION_W2K3_RC1
= 0x0A,
88 NTLMSSP_REVISION_W2K3
= 0x0F
89 } ntlmssp_NTLMRevisionCurrent
;
91 /* [MS-NLMP] 2.2.2.10 VERSION */
93 typedef [public] struct {
94 ntlmssp_WindowsMajorVersion ProductMajorVersion
;
95 ntlmssp_WindowsMinorVersion ProductMinorVersion
;
98 ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent
;
101 typedef [noprint
,nodiscriminant
] union {
102 [case(NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_VERSION
version;
106 /* [MS-NLMP] 2.2.1.1 NEGOTIATE_MESSAGE */
108 typedef [public] struct {
109 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
110 [value
(NtLmNegotiate
)] ntlmssp_MessageType MessageType
;
111 NEGOTIATE NegotiateFlags
;
112 [value
(DomainName ? strlen
(DomainName
) : 0)] uint16 DomainNameLen
;
113 [value
(DomainNameLen
)] uint16 DomainNameMaxLen
;
114 [relative
] [subcontext
(0),subcontext_size
(DomainNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_OEM
))] string *DomainName
;
115 [value
(Workstation ? strlen
(Workstation
) : 0)] uint16 WorkstationLen
;
116 [value
(WorkstationLen
)] uint16 WorkstationMaxLen
;
117 [relative
] [subcontext
(0),subcontext_size
(WorkstationLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_OEM
))] string *Workstation
;
118 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
123 MsvAvNbComputerName
= 1,
124 MsvAvNbDomainName
= 2,
125 MsvAvDnsComputerName
= 3,
126 MsvAvDnsDomainName
= 4,
127 MsvAvDnsTreeName
= 5,
130 MsAvRestrictions
= 8,
132 MsvChannelBindings
= 10
135 /* [MS-NLMP] 2.2.2.2 Restriction_Encoding */
139 [value
(0)] uint32 Z4
;
140 boolean32 IntegrityLevel
;
141 uint32 SubjectIntegrityLevel
;
143 } Restriction_Encoding
;
145 typedef [bitmap32bit
] bitmap
{
146 NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT
= 0x00000001,
147 NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE
= 0x00000002,
148 NTLMSSP_AVFLAG_TARGET_SPN_FROM_UNTRUSTED_SOURCE
= 0x00000004
151 typedef [gensize
,nodiscriminant
,flag
(NDR_NOALIGN
)] union {
153 [case(MsvAvNbComputerName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvNbComputerName
;
154 [case(MsvAvNbDomainName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvNbDomainName
;
155 [case(MsvAvDnsComputerName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsComputerName
;
156 [case(MsvAvDnsDomainName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsDomainName
;
157 [case(MsvAvDnsTreeName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsTreeName
;
158 [case(MsvAvFlags
)] ntlmssp_AvFlags AvFlags
;
159 [case(MsvAvTimestamp
)] NTTIME AvTimestamp
;
160 [case(MsAvRestrictions
)] Restriction_Encoding AvRestrictions
;
161 [case(MsvAvTargetName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvTargetName
;
162 [case(MsvChannelBindings
)] uint8 ChannelBindings
[16];
163 [default] [flag
(NDR_REMAINING
)] DATA_BLOB blob
;
166 /* [MS-NLMP] 2.2.2.1 AV_PAIR */
168 typedef [public,flag
(NDR_NOALIGN
)] struct {
170 [value
(ndr_size_ntlmssp_AvValue
(&r
->Value
, r
->AvId
, 0))] uint16 AvLen
;
171 [subcontext
(0),subcontext_size
(AvLen
),switch_is(AvId
)] ntlmssp_AvValue Value
;
174 typedef [gensize
,nopush
,nopull
,flag
(NDR_NOALIGN
)] struct {
179 /* [MS-NLMP] 2.2.1.2 CHALLENGE_MESSAGE */
181 typedef [public,flag
(NDR_PAHEX
)] struct {
182 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
183 [value
(NtLmChallenge
)] ntlmssp_MessageType MessageType
;
184 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, TargetName
))] uint16 TargetNameLen
;
185 [value
(TargetNameLen
)] uint16 TargetNameMaxLen
;
186 [relative
] [subcontext
(0),subcontext_size
(TargetNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *TargetName
;
187 NEGOTIATE NegotiateFlags
;
188 uint8 ServerChallenge
[8];
190 [value
(ndr_size_AV_PAIR_LIST
(TargetInfo
, ndr
->flags
))] uint16 TargetInfoLen
;
191 [value
(TargetInfoLen
)] uint16 TargetInfoMaxLen
;
192 [relative
] [subcontext
(0),subcontext_size
(TargetInfoLen
)] AV_PAIR_LIST
*TargetInfo
;
193 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
196 /* [MS-NLMP] 2.2.2.3 LM_RESPONSE */
198 typedef [public,flag
(NDR_PAHEX
)] struct {
202 /* [MS-NLMP] 2.2.2.4 LMv2_RESPONSE */
204 typedef [public,flag
(NDR_PAHEX
)] struct {
206 uint8 ChallengeFromClient
[8];
209 typedef [nodiscriminant
] union {
210 [case(24)] LM_RESPONSE v1
;
212 } ntlmssp_LM_RESPONSE
;
214 /* [MS-NLMP] 2.2.2.6 NTLM_RESPONSE */
216 typedef [public,flag
(NDR_PAHEX
)] struct {
220 /* [MS-NLMP] 2.2.2.7 NTLMv2_CLIENT_CHALLENGE */
222 typedef [flag
(NDR_PAHEX
)] struct {
223 [value
(1)] uint8 RespType
;
224 [value
(1)] uint8 HiRespType
;
228 uint8 ChallengeFromClient
[8];
230 [subcontext
(0)] [flag
(NDR_REMAINING
)] AV_PAIR_LIST AvPairs
;
231 } NTLMv2_CLIENT_CHALLENGE
;
233 /* [MS-NLMP] 2.2.2.8 NTLMv2_RESPONSE */
235 typedef [public,flag
(NDR_PAHEX
)] struct {
237 NTLMv2_CLIENT_CHALLENGE Challenge
;
240 typedef [public,nodiscriminant
] union {
242 [case(0x18)] NTLM_RESPONSE v1
;
243 [default] NTLMv2_RESPONSE v2
;
244 } ntlmssp_NTLM_RESPONSE
;
246 typedef [flag
(NDR_PAHEX
)] struct {
250 /* [MS-NLMP] 2.2.1.3 AUTHENTICATE_MESSAGE */
252 typedef [public,flag
(NDR_REMAINING
)] struct {
253 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
254 [value
(NtLmAuthenticate
)] ntlmssp_MessageType MessageType
;
255 uint16 LmChallengeResponseLen
;
256 [value
(LmChallengeResponseLen
)] uint16 LmChallengeResponseMaxLen
;
257 [relative
] [subcontext
(0),subcontext_size
(LmChallengeResponseLen
),switch_is(LmChallengeResponseLen
)] ntlmssp_LM_RESPONSE
*LmChallengeResponse
;
258 uint16 NtChallengeResponseLen
;
259 [value
(NtChallengeResponseLen
)] uint16 NtChallengeResponseMaxLen
;
260 [relative
] [subcontext
(0),subcontext_size
(NtChallengeResponseMaxLen
),switch_is(NtChallengeResponseLen
)] ntlmssp_NTLM_RESPONSE
*NtChallengeResponse
;
261 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, DomainName
))] uint16 DomainNameLen
;
262 [value
(DomainNameLen
)] uint16 DomainNameMaxLen
;
263 [relative
] [subcontext
(0),subcontext_size
(DomainNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *DomainName
;
264 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, UserName
))] uint16 UserNameLen
;
265 [value
(UserNameLen
)] uint16 UserNameMaxLen
;
266 [relative
] [subcontext
(0),subcontext_size
(UserNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *UserName
;
267 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, Workstation
))] uint16 WorkstationLen
;
268 [value
(WorkstationLen
)] uint16 WorkstationMaxLen
;
269 [relative
] [subcontext
(0),subcontext_size
(WorkstationLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *Workstation
;
270 [value
(EncryptedRandomSessionKey
->length
)] uint16 EncryptedRandomSessionKeyLen
;
271 [value
(EncryptedRandomSessionKeyLen
)] uint16 EncryptedRandomSessionKeyMaxLen
;
272 [relative
] [subcontext
(0),subcontext_size
(EncryptedRandomSessionKeyLen
)] DATA_BLOB
*EncryptedRandomSessionKey
;
273 NEGOTIATE NegotiateFlags
;
274 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
275 /* MIC (Message Integrity) is only included when the client has
276 * sent a timestap Av struct in the CHALLENGE_MESSAGE AvPair */
277 /* [flag(NDR_REMAINING)] MIC mic; */
278 } AUTHENTICATE_MESSAGE
;
280 /* NTLMSSP signature version */
281 const int NTLMSSP_SIGN_VERSION
= 0x01;
283 /* NTLMSSP signature size */
284 const int NTLMSSP_SIG_SIZE
= 16;
286 /* [MS-NLMP] 2.2.2.9.1 NTLMSSP_MESSAGE_SIGNATURE */
288 typedef [public] struct {
289 [value
(NTLMSSP_SIGN_VERSION
)] uint32
Version;
293 } NTLMSSP_MESSAGE_SIGNATURE
;
295 /* [MS-NLMP] 2.2.2.9.2 NTLMSSP_MESSAGE_SIGNATURE for Extended Session Security */
297 typedef [public,flag
(NDR_PAHEX
)] struct {
298 [value
(NTLMSSP_SIGN_VERSION
)] uint32
Version;
301 } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2
;
303 /* some ndrdump helpers */
305 void decode_NEGOTIATE_MESSAGE
(
306 [in] NEGOTIATE_MESSAGE negotiate
309 void decode_CHALLENGE_MESSAGE
(
310 [in] CHALLENGE_MESSAGE challenge
313 void decode_AUTHENTICATE_MESSAGE
(
314 [in] AUTHENTICATE_MESSAGE authenticate
317 void decode_NTLMv2_CLIENT_CHALLENGE
(
318 [in] NTLMv2_CLIENT_CHALLENGE challenge
321 void decode_NTLMv2_RESPONSE
(
322 [in] NTLMv2_RESPONSE response