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 typedef [bitmap32bit
] bitmap
{
22 NTLMSSP_NEGOTIATE_UNICODE
= 0x00000001,
23 NTLMSSP_NEGOTIATE_OEM
= 0x00000002, /* NTLM_NEGOTIATE_OEM in MS-NLMP */
24 NTLMSSP_REQUEST_TARGET
= 0x00000004,
25 NTLMSSP_NEGOTIATE_SIGN
= 0x00000010, /* Message integrity */
26 NTLMSSP_NEGOTIATE_SEAL
= 0x00000020, /* Message confidentiality */
27 NTLMSSP_NEGOTIATE_DATAGRAM
= 0x00000040,
28 NTLMSSP_NEGOTIATE_LM_KEY
= 0x00000080,
29 NTLMSSP_NEGOTIATE_NETWARE
= 0x00000100, /* not mentioned in MS-NLMP */
30 NTLMSSP_NEGOTIATE_NTLM
= 0x00000200,
31 NTLMSSP_NEGOTIATE_NT_ONLY
= 0x00000400,
32 NTLMSSP_ANONYMOUS
= 0x00000800, /* no symbol name in MS-NLMP */
33 NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED
= 0x00001000,
34 NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED
= 0x00002000,
35 NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL
= 0x00004000, /* not mentioned in MS-NLMP */
36 NTLMSSP_NEGOTIATE_ALWAYS_SIGN
= 0x00008000,
37 NTLMSSP_TARGET_TYPE_DOMAIN
= 0x00010000,
38 NTLMSSP_TARGET_TYPE_SERVER
= 0x00020000,
39 NTLMSSP_TARGET_TYPE_SHARE
= 0x00040000,
40 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
= 0x00080000,
41 NTLMSSP_NEGOTIATE_IDENTIFY
= 0x00100000,
42 NTLMSSP_REQUEST_NON_NT_SESSION_KEY
= 0x00400000,
43 NTLMSSP_NEGOTIATE_TARGET_INFO
= 0x00800000,
44 NTLMSSP_NEGOTIATE_VERSION
= 0x02000000,
45 NTLMSSP_NEGOTIATE_128
= 0x20000000, /* 128-bit encryption */
46 NTLMSSP_NEGOTIATE_KEY_EXCH
= 0x40000000,
47 NTLMSSP_NEGOTIATE_56
= 0x80000000
50 /* convenience mapping */
51 const int NTLMSSP_NEGOTIATE_NTLM2
= NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
;
54 NTLMSSP_WINDOWS_MAJOR_VERSION_5: Windows XP SP2 and Server 2003
55 NTLMSSP_WINDOWS_MAJOR_VERSION_6: Windows Vista, Server 2008, 7 and Server 2008 R2
58 typedef [enum8bit
] enum {
59 NTLMSSP_WINDOWS_MAJOR_VERSION_5
= 0x05,
60 NTLMSSP_WINDOWS_MAJOR_VERSION_6
= 0x06
61 } ntlmssp_WindowsMajorVersion
;
64 NTLMSSP_WINDOWS_MINOR_VERSION_0: Windows Vista, Server 2008, 7, Server 2008 R2
65 NTLMSSP_WINDOWS_MINOR_VERSION_1: Windows XP SP2
66 NTLMSSP_WINDOWS_MINOR_VERSION_2: Windows Server 2003
69 typedef [enum8bit
] enum {
70 NTLMSSP_WINDOWS_MINOR_VERSION_0
= 0x00,
71 NTLMSSP_WINDOWS_MINOR_VERSION_1
= 0x01,
72 NTLMSSP_WINDOWS_MINOR_VERSION_2
= 0x02
73 } ntlmssp_WindowsMinorVersion
;
76 NTLMSSP_REVISION_W2K3_RC1:
77 NTLMSSP_REVISION_W2K3: Windows XP SP2, Server 2003, Vista, Server 2008, 7, Server 2008 R2
80 typedef [enum8bit
] enum {
81 NTLMSSP_REVISION_W2K3_RC1
= 0x0A,
82 NTLMSSP_REVISION_W2K3
= 0x0F
83 } ntlmssp_NTLMRevisionCurrent
;
86 ntlmssp_WindowsMajorVersion ProductMajorVersion
;
87 ntlmssp_WindowsMinorVersion ProductMinorVersion
;
90 ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent
;
93 typedef [nodiscriminant
] union {
94 [case(NTLMSSP_NEGOTIATE_VERSION
)] VERSION version;
98 /* NTLMSSP negotiate message */
100 typedef [public] struct {
101 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
102 [value
(NtLmNegotiate
)] ntlmssp_MessageType MessageType
;
103 NEGOTIATE NegotiateFlags
;
104 [value
(strlen
(DomainName
))] uint16 DomainNameLen
;
105 [value
(DomainNameLen
)] uint16 DomainNameMaxLen
;
106 [relative
] [subcontext
(0),subcontext_size
(DomainNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_OEM
))] string *DomainName
;
107 [value
(strlen
(Workstation
))] uint16 WorkstationLen
;
108 [value
(WorkstationLen
)] uint16 WorkstationMaxLen
;
109 [relative
] [subcontext
(0),subcontext_size
(WorkstationLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_OEM
))] string *Workstation
;
110 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
115 MsvAvNbComputerName
= 1,
116 MsvAvNbDomainName
= 2,
117 MsvAvDnsComputerName
= 3,
118 MsvAvDnsDomainName
= 4,
119 MsvAvDnsTreeName
= 5,
122 MsAvRestrictions
= 8,
124 MsvChannelBindings
= 10
129 [value
(0)] uint32 Z4
;
130 boolean32 IntegrityLevel
;
131 uint32 SubjectIntegrityLevel
;
133 } Restriction_Encoding
;
135 typedef [bitmap32bit
] bitmap
{
136 NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT
= 0x00000001,
137 NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE
= 0x00000002
140 typedef [gensize
,nodiscriminant
,flag
(NDR_NOALIGN
)] union {
142 [case(MsvAvNbComputerName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvNbComputerName
;
143 [case(MsvAvNbDomainName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvNbDomainName
;
144 [case(MsvAvDnsComputerName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsComputerName
;
145 [case(MsvAvDnsDomainName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsDomainName
;
146 [case(MsvAvDnsTreeName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvDnsTreeName
;
147 [case(MsvAvFlags
)] ntlmssp_AvFlags AvFlags
;
148 [case(MsvAvTimestamp
)] NTTIME AvTimestamp
;
149 [case(MsAvRestrictions
)] Restriction_Encoding AvRestrictions
;
150 [case(MsvAvTargetName
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(NTLMSSP_NEGOTIATE_UNICODE
))] string AvTargetName
;
151 [case(MsvChannelBindings
)] uint8 ChannelBindings
[16];
152 [default] [flag
(NDR_REMAINING
)] DATA_BLOB blob
;
155 typedef [public,flag
(NDR_NOALIGN
)] struct {
157 [value
(ndr_size_ntlmssp_AvValue
(&r
->Value
, r
->AvId
, ndr
->iconv_convenience
, 0))] uint16 AvLen
;
158 [subcontext
(0),subcontext_size
(AvLen
),switch_is(AvId
)] ntlmssp_AvValue Value
;
161 typedef [gensize
,nopush
,nopull
,flag
(NDR_NOALIGN
)] struct {
166 /* NTLMSSP challenge message */
168 typedef [public,flag
(NDR_PAHEX
)] struct {
169 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
170 [value
(NtLmChallenge
)] ntlmssp_MessageType MessageType
;
171 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, TargetName
))] uint16 TargetNameLen
;
172 [value
(TargetNameLen
)] uint16 TargetNameMaxLen
;
173 [relative
] [subcontext
(0),subcontext_size
(TargetNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *TargetName
;
174 NEGOTIATE NegotiateFlags
;
175 uint8 ServerChallenge
[8];
177 [value
(ndr_size_AV_PAIR_LIST
(TargetInfo
, ndr
->iconv_convenience
, ndr
->flags
))] uint16 TargetInfoLen
;
178 [value
(TargetInfoLen
)] uint16 TargetNameInfoMaxLen
;
179 [relative
] [subcontext
(0),subcontext_size
(TargetInfoLen
)] AV_PAIR_LIST
*TargetInfo
;
180 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
183 typedef [public,flag
(NDR_PAHEX
)] struct {
187 typedef [public,flag
(NDR_PAHEX
)] struct {
189 uint8 ChallengeFromClient
[8];
192 typedef [nodiscriminant
] union {
193 [case(24)] LM_RESPONSE v1
;
195 } ntlmssp_LM_RESPONSE
;
197 typedef [public,flag
(NDR_PAHEX
)] struct {
201 typedef [flag
(NDR_PAHEX
)] struct {
202 [value
(1)] uint8 RespType
;
203 [value
(1)] uint8 HiRespType
;
207 uint8 ChallengeFromClient
[8];
209 [subcontext
(0)] [flag
(NDR_REMAINING
)] AV_PAIR_LIST AvPairs
;
210 } NTLMv2_CLIENT_CHALLENGE
;
212 typedef [public,flag
(NDR_PAHEX
)] struct {
214 NTLMv2_CLIENT_CHALLENGE Challenge
;
217 typedef [public,nodiscriminant
] union {
219 [case(0x18)] NTLM_RESPONSE v1
;
220 [default] NTLMv2_RESPONSE v2
;
221 } ntlmssp_NTLM_RESPONSE
;
223 typedef [flag
(NDR_PAHEX
)] struct {
227 /* NTLMSSP authenticate message */
229 typedef [public,flag
(NDR_REMAINING
)] struct {
230 [charset
(DOS
),value
("NTLMSSP")] uint8 Signature
[8];
231 [value
(NtLmAuthenticate
)] ntlmssp_MessageType MessageType
;
232 uint16 LmChallengeResponseLen
;
233 [value
(LmChallengeResponseLen
)] uint16 LmChallengeResponseMaxLen
;
234 [relative
] [subcontext
(0),subcontext_size
(LmChallengeResponseLen
),switch_is(LmChallengeResponseLen
)] ntlmssp_LM_RESPONSE
*LmChallengeResponse
;
235 uint16 NtChallengeResponseLen
;
236 [value
(NtChallengeResponseLen
)] uint16 NtChallengeResponseMaxLen
;
237 [relative
] [subcontext
(0),subcontext_size
(NtChallengeResponseMaxLen
),switch_is(NtChallengeResponseLen
)] ntlmssp_NTLM_RESPONSE
*NtChallengeResponse
;
238 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, DomainName
))] uint16 DomainNameLen
;
239 [value
(DomainNameLen
)] uint16 DomainNameMaxLen
;
240 [relative
] [subcontext
(0),subcontext_size
(DomainNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *DomainName
;
241 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, UserName
))] uint16 UserNameLen
;
242 [value
(UserNameLen
)] uint16 UserNameMaxLen
;
243 [relative
] [subcontext
(0),subcontext_size
(UserNameLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *UserName
;
244 [value
(ndr_ntlmssp_string_length
(NegotiateFlags
, Workstation
))] uint16 WorkstationLen
;
245 [value
(WorkstationLen
)] uint16 WorkstationMaxLen
;
246 [relative
] [subcontext
(0),subcontext_size
(WorkstationLen
)] [flag
(ndr_ntlmssp_negotiated_string_flags
(r
->NegotiateFlags
))] string *Workstation
;
247 [value
(EncryptedRandomSessionKey
->length
)] uint16 EncryptedRandomSessionKeyLen
;
248 [value
(EncryptedRandomSessionKeyLen
)] uint16 EncryptedRandomSessionKeyMaxLen
;
249 [relative
] [subcontext
(0),subcontext_size
(EncryptedRandomSessionKeyLen
)] DATA_BLOB
*EncryptedRandomSessionKey
;
250 NEGOTIATE NegotiateFlags
;
251 [switch_is(NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
)] ntlmssp_Version
Version;
252 /* MIC (Message Integrity) is only included when the client has
253 * sent a timestap Av struct in the CHALLENGE_MESSAGE AvPair */
254 /* [flag(NDR_REMAINING)] MIC mic; */
255 } AUTHENTICATE_MESSAGE
;
257 /* NTLMSSP signature version */
258 const int NTLMSSP_SIGN_VERSION
= 0x01;
260 /* NTLMSSP signature size */
261 const int NTLMSSP_SIG_SIZE
= 16;
263 typedef [public] struct {
264 [value
(NTLMSSP_SIGN_VERSION
)] uint32
Version;
268 } NTLMSSP_MESSAGE_SIGNATURE
;
270 typedef [public,flag
(NDR_PAHEX
)] struct {
271 [value
(NTLMSSP_SIGN_VERSION
)] uint32
Version;
274 } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2
;
276 /* some ndrdump helpers */
278 void decode_NEGOTIATE_MESSAGE
(
279 [in] NEGOTIATE_MESSAGE negotiate
282 void decode_CHALLENGE_MESSAGE
(
283 [in] CHALLENGE_MESSAGE challenge
286 void decode_AUTHENTICATE_MESSAGE
(
287 [in] AUTHENTICATE_MESSAGE authenticate
290 void decode_NTLMv2_CLIENT_CHALLENGE
(
291 [in] NTLMv2_CLIENT_CHALLENGE challenge