Skip to content

Commit 6a47c41

Browse files
committed
Add PA_PAC_REQUEST to probe AS-REQ for accounts without preauth
Accounts with DONT_REQUIRE_PREAUTH return an AS-REP directly from the probe. Without PA_PAC_REQUEST the KDC response could be missing enc-part, causing PyAsn1Error. Add PA_PAC_REQUEST alongside the kinit-style PA_AS_FRESHNESS and PA_REQ_ENC_PA_REP padata.
1 parent 0bda29c commit 6a47c41

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

impacket/krb5/kerberosv5.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ def getKerberosTGT(clientName, password, domain, lmhash, nthash, aesKey='', kdcH
276276
return tgt, cipher, key, sessionKey
277277

278278
# Step 1: Probe AS-REQ without PA_ENC_TIMESTAMP (matching kinit)
279+
pacRequest = KERB_PA_PAC_REQUEST()
280+
pacRequest['include-pac'] = requestPAC
281+
encodedPacRequest = encoder.encode(pacRequest)
282+
279283
asReq = AS_REQ()
280284
asReq['pvno'] = 5
281285
asReq['msg-type'] = int(constants.ApplicationTagNumbers.AS_REQ.value)
@@ -287,6 +291,9 @@ def getKerberosTGT(clientName, password, domain, lmhash, nthash, aesKey='', kdcH
287291
asReq['padata'][1] = noValue
288292
asReq['padata'][1]['padata-type'] = int(constants.PreAuthenticationDataTypes.PA_REQ_ENC_PA_REP.value)
289293
asReq['padata'][1]['padata-value'] = b''
294+
asReq['padata'][2] = noValue
295+
asReq['padata'][2]['padata-type'] = int(constants.PreAuthenticationDataTypes.PA_PAC_REQUEST.value)
296+
asReq['padata'][2]['padata-value'] = encodedPacRequest
290297

291298
reqBody = seq_set(asReq, 'req-body')
292299

0 commit comments

Comments
 (0)