Skip to content

Commit 5d8d74e

Browse files
committed
Ensure we have the FQDN as remoteName to ensure proper decryption
1 parent 71a59a6 commit 5d8d74e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

impacket/examples/regsecrets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ def getMachineKerberosSalt(self):
7777
"""
7878
if self.__smbConnection.getServerName() == '':
7979
host, _ = self.getMachineNameAndDomain()
80-
domain = self.__smbConnection.getRemoteName().split(f"{host}.")[1]
80+
remoteName = self.__smbConnection.getRemoteName()
81+
# Check if remoteName is FQDN, otherwise it will likely be the hostname only and we can't build the salt
82+
if remoteName.lower().startswith(f"{host.lower()}."):
83+
domain = ".".join(remoteName.split(".")[1:])
84+
else:
85+
return b''
8186
else:
8287
host = self.__smbConnection.getServerName()
8388
domain = self.__smbConnection.getServerDNSDomainName()

impacket/examples/secretsdump.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,12 @@ def getMachineKerberosSalt(self):
762762
"""
763763
if self.__smbConnection.getServerName() == '':
764764
host, _ = self.getMachineNameAndDomain()
765-
domain = self.__smbConnection.getRemoteName().split(f"{host}.")[1]
765+
remoteName = self.__smbConnection.getRemoteName()
766+
# Check if remoteName is FQDN, otherwise it will likely be the hostname only
767+
if remoteName.lower().startswith(f"{host.lower()}."):
768+
domain = ".".join(remoteName.split(".")[1:])
769+
else:
770+
return b''
766771
else:
767772
host = self.__smbConnection.getServerName()
768773
domain = self.__smbConnection.getServerDNSDomainName()

0 commit comments

Comments
 (0)