Debian Codegraph @

docs/scenarios/heimdal_macos_ntlm.md

raw
1 ## Distro
2
3 macOS 10.15.4
4
5
6 ## GSSAPI Impl
7
8 Kerberos 5 release 1.7-prerelease (Heimdal)
9
10
11 ## Connection Info:
12
13 Connecting to host using FQDN with an invalid SPN `http@test`. Using explicit creds with the oid NTLM. Cannot seem to
14 get credentials for the SPNEGO OID.
15
16
17 ## Notes
18
19 * This fails to authenticate with a Windows host with an invalid token error
20 * The error in the security event log is
21
22 ```
23 An account failed to log on.
24
25 Subject:
26 Security ID: NULL SID
27 Account Name: -
28 Account Domain: -
29 Logon ID: 0x0
30
31 Logon Type: 3
32
33 Account For Which Logon Failed:
34 Security ID: NULL SID
35 Account Name: vagrant-domain
36 Account Domain: DOMAIN.LOCAL
37
38 Failure Information:
39 Failure Reason: An Error occured during Logon.
40 Status: 0x80090308 # SEC_E_INVALID_TOKEN
41 Sub Status: 0x0
42
43 Process Information:
44 Caller Process ID: 0x0
45 Caller Process Name: -
46
47 Network Information:
48 Workstation Name: JBOREAN-OSX
49 Source Network Address: -
50 Source Port: -
51
52 Detailed Authentication Information:
53 Logon Process: NtLmSsp
54 Authentication Package: NTLM
55 Transited Services: -
56 Package Name (NTLM only): -
57 Key Length: 0
58
59 This event is generated when a logon request fails. It is generated on the computer where access was attempted.
60
61 The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.
62
63 The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).
64
65 The Process Information fields indicate which account and process on the system requested the logon.
66
67 The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.
68
69 The authentication information fields provide detailed information about this specific logon request.
70 - Transited services indicate which intermediate services have participated in this logon request.
71 - Package name indicates which sub-protocol was used among the NTLM protocols.
72 - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.
73 ```
74
75 * Will need to check a few things but IIRC the NTProofStr and MIC were actually calculated correctly
76 * Even if the user was `vagrant-domain@DOMAIN` or `DOMAIN\vagrant-domain` it will fail with the same error
77
78 I feel like the error in this case is due to a badly documented `ExportedSessionKey` value when
79 `NTLMSSP_NEGOTIATE_KEY_EXCH` is set without the sign or seal flags. The `ExportedSessionKey` is meant to be the
80 `KeyExchangeKey` except this is using the documented logic of it being `RC4K(KeyExchangeKey, Z(16))`. NTLM on macOS
81 actually works when the sign or seal flags are set because the logic is now correct. Might have to revisit this
82 and use on macOS instead of the builtin NTLM provider if possible.
83
84
85 ## Tokens
86
87 ```yaml
88 MessageType: NEGOTIATE_MESSAGE (1)
89 Data:
90 NegotiateFlags:
91 raw: 1653080581
92 flags:
93 - NTLMSSP_NEGOTIATE_KEY_EXCH (1073741824)
94 - NTLMSSP_NEGOTIATE_128 (536870912)
95 - NTLMSSP_NEGOTIATE_VERSION (33554432)
96 - NTLMSSP_NEGOTIATE_TARGET_INFO (8388608)
97 - NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY (524288)
98 - NTLMSSP_NEGOTIATE_NTLM (512)
99 - NTLMSSP_REQUEST_TARGET (4)
100 - NTLMSSP_NEGOTIATE_UNICODE (1)
101 DomainNameFields:
102 Len: 0
103 MaxLen: 0
104 BufferOffset: 0
105 WorkstationFields:
106 Len: 0
107 MaxLen: 0
108 BufferOffset: 0
109 Version:
110 Major: 6
111 Minor: 1
112 Build: 7600
113 Reserved: 0F0000
114 NTLMRevision: 0
115 Payload:
116 DomainName:
117 Workstation:
118 RawData: 4E544C4D535350000100000005028862000000000000000000000000000000000601B01D0F000000
119 ```
120
121 ```yaml
122 MessageType: CHALLENGE_MESSAGE (2)
123 Data:
124 TargetNameFields:
125 Len: 12
126 MaxLen: 12
127 BufferOffset: 56
128 NegotiateFlags:
129 raw: 1653146117
130 flags:
131 - NTLMSSP_NEGOTIATE_KEY_EXCH (1073741824)
132 - NTLMSSP_NEGOTIATE_128 (536870912)
133 - NTLMSSP_NEGOTIATE_VERSION (33554432)
134 - NTLMSSP_NEGOTIATE_TARGET_INFO (8388608)
135 - NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY (524288)
136 - NTLMSSP_TARGET_TYPE_DOMAIN (65536)
137 - NTLMSSP_NEGOTIATE_NTLM (512)
138 - NTLMSSP_REQUEST_TARGET (4)
139 - NTLMSSP_NEGOTIATE_UNICODE (1)
140 ServerChallenge: 4A16FA1A20160E80
141 Reserved: '0000000000000000'
142 TargetInfoFields:
143 Len: 162
144 MaxLen: 162
145 BufferOffset: 68
146 Version:
147 Major: 10
148 Minor: 0
149 Build: 17763
150 Reserved: '000000'
151 NTLMRevision: 15
152 Payload:
153 TargetName: DOMAIN
154 TargetInfo:
155 - AvId: MSV_AV_NB_DOMAIN_NAME (2)
156 Value: DOMAIN
157 - AvId: MSV_AV_NB_COMPUTER_NAME (1)
158 Value: SERVER2019
159 - AvId: MSV_AV_DNS_DOMAIN_NAME (4)
160 Value: domain.local
161 - AvId: MSV_AV_DNS_COMPUTER_NAME (3)
162 Value: SERVER2019.domain.local
163 - AvId: MSV_AV_DNS_TREE_NAME (5)
164 Value: domain.local
165 - AvId: MSV_AV_TIMESTAMP (7)
166 Value: '2020-04-30T19:04:55.6277277Z'
167 - AvId: MSV_AV_EOL (0)
168 Value:
169 RawData: 4E544C4D53535000020000000C000C0038000000050289624A16FA1A20160E800000000000000000A200A200440000000A0063450000000F44004F004D00410049004E0002000C0044004F004D00410049004E000100140053004500520056004500520032003000310039000400180064006F006D00610069006E002E006C006F00630061006C0003002E0053004500520056004500520032003000310039002E0064006F006D00610069006E002E006C006F00630061006C000500180064006F006D00610069006E002E006C006F00630061006C00070008001DEE5F3C221FD60100000000
170 ```
171
172 ```yaml
173 MessageType: AUTHENTICATE_MESSAGE (3)
174 Data:
175 LmChallengeResponseFields:
176 Len: 24
177 MaxLen: 24
178 BufferOffset: 162
179 NtChallengeResponseFields:
180 Len: 260
181 MaxLen: 260
182 BufferOffset: 186
183 DomainNameFields:
184 Len: 24
185 MaxLen: 24
186 BufferOffset: 88
187 UserNameFields:
188 Len: 28
189 MaxLen: 28
190 BufferOffset: 112
191 WorkstationFields:
192 Len: 22
193 MaxLen: 22
194 BufferOffset: 140
195 EncryptedRandomSessionKeyFields:
196 Len: 16
197 MaxLen: 16
198 BufferOffset: 446
199 NegotiateFlags:
200 raw: 1653080581
201 flags:
202 - NTLMSSP_NEGOTIATE_KEY_EXCH (1073741824)
203 - NTLMSSP_NEGOTIATE_128 (536870912)
204 - NTLMSSP_NEGOTIATE_VERSION (33554432)
205 - NTLMSSP_NEGOTIATE_TARGET_INFO (8388608)
206 - NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY (524288)
207 - NTLMSSP_NEGOTIATE_NTLM (512)
208 - NTLMSSP_REQUEST_TARGET (4)
209 - NTLMSSP_NEGOTIATE_UNICODE (1)
210 Version:
211 Major: 6
212 Minor: 1
213 Build: 7600
214 Reserved: 0F0000
215 NTLMRevision: 0
216 MIC: 79DFC3EE99849A8EB6B02FF50A2C4847
217 Payload:
218 LmChallengeResponse:
219 ResponseType: LMv1
220 LMProofStr: '000000000000000000000000000000000000000000000000'
221 NtChallengeResponse:
222 ResponseType: NTLMv2
223 NTProofStr: B225C3CCD6D6AD526A4624A2342B319E
224 ClientChallenge:
225 RespType: 1
226 HiRespType: 1
227 Reserved1: 0
228 Reserved2: 0
229 TimeStamp: '2020-04-30T19:05:57Z'
230 ChallengeFromClient: 3442FEE968D48AE3
231 Reserved3: 0
232 AvPairs:
233 - AvId: MSV_AV_NB_COMPUTER_NAME (1)
234 Value: SERVER2019
235 - AvId: MSV_AV_NB_DOMAIN_NAME (2)
236 Value: DOMAIN
237 - AvId: MSV_AV_DNS_COMPUTER_NAME (3)
238 Value: SERVER2019.domain.local
239 - AvId: MSV_AV_DNS_DOMAIN_NAME (4)
240 Value: domain.local
241 - AvId: MSV_AV_DNS_TREE_NAME (5)
242 Value: domain.local
243 - AvId: MSV_AV_FLAGS (6)
244 Value:
245 raw: 2
246 flags:
247 - MIC_PROVIDED (2)
248 - AvId: MSV_AV_TIMESTAMP (7)
249 Value: '2020-04-30T19:04:55.6277277Z'
250 - AvId: MSV_AV_TARGET_NAME (9)
251 Value: http/test
252 - AvId: MSV_AV_CHANNEL_BINDINGS (10)
253 Value: '00000000000000000000000000000000'
254 - AvId: MSV_AV_EOL (0)
255 Value:
256 Reserved4: 0
257 DomainName: DOMAIN.LOCAL
258 UserName: vagrant-domain
259 Workstation: JBOREAN-OSX
260 EncryptedRandomSessionKey: 1DE89553B73834ABDFE761A306A00E0C
261 SessionKey: FEA879A2B112FFDB42A213E7F2D838ED
262 RawData: 4E544C4D535350000300000018001800A200000004010401BA00000018001800580000001C001C0070000000160016008C00000010001000BE010000050288620601B01D0F00000079DFC3EE99849A8EB6B02FF50A2C484744004F004D00410049004E002E004C004F00430041004C00760061006700720061006E0074002D0064006F006D00610069006E004A0042004F005200450041004E002D004F0053005800000000000000000000000000000000000000000000000000B225C3CCD6D6AD526A4624A2342B319E01010000000000008098F460221FD6013442FEE968D48AE30000000001001400530045005200560045005200320030003100390002000C0044004F004D00410049004E0003002E0053004500520056004500520032003000310039002E0064006F006D00610069006E002E006C006F00630061006C000400180064006F006D00610069006E002E006C006F00630061006C000500180064006F006D00610069006E002E006C006F00630061006C000600040002000000070008001DEE5F3C221FD6010900120068007400740070002F0074006500730074000A0010000000000000000000000000000000000000000000000000001DE89553B73834ABDFE761A306A00E0C
263 ```