Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multiple PEKs in Windows 2016 #618

Merged
merged 1 commit into from
Apr 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions impacket/examples/secretsdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,21 @@ def __getPek(self):
decryptedPekList = self.PEKLIST_PLAIN(
self.__cryptoCommon.decryptAES(self.__bootKey, encryptedPekList['EncryptedPek'],
encryptedPekList['KeyMaterial']))
self.__PEK.append(decryptedPekList['DecryptedPek'][4:][:16])
LOG.info("PEK # 0 found and decrypted: %s", hexlify(decryptedPekList['DecryptedPek'][4:][:16]).decode('utf-8'))

# PEK list entries take the form:
# index (4 byte LE int), PEK (16 byte key)
# the entries are in ascending order, and the list is terminated
# by an entry with a non-sequential index (08080808 observed)
pos, cur_index = 0, 0
while True:
pek_entry = decryptedPekList['DecryptedPek'][pos:pos+20]
if len(pek_entry) < 20: break # if list truncated, should not happen
index, pek = unpack('<L16s', pek_entry)
if index != cur_index: break # break on non-sequential index
self.__PEK.append(pek)
LOG.info("PEK # %d found and decrypted: %s", index, hexlify(pek).decode('utf-8'))
cur_index += 1
pos += 20

def __removeRC4Layer(self, cryptedHash):
md5 = hashlib.new('md5')
Expand Down