Skip to content

Commit 7162fd9

Browse files
committed
Moved the fix for Pennyw0rth#592 to kerberoast class because otherwise user without password crashes without DNS
1 parent 725c96f commit 7162fd9

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

nxc/protocols/ldap.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,6 @@ def asreproast(self):
806806
if self.password == "" and self.nthash == "" and self.kerberos is False:
807807
return False
808808

809-
# If kdcHost isn't set, use the target IP for DNS resolution
810-
if not self.kdcHost:
811-
self.kdcHost = self.host
812-
813809
# Building the search filter
814810
search_filter = "(&(UserAccountControl:1.2.840.113556.1.4.803:=%d)(!(UserAccountControl:1.2.840.113556.1.4.803:=%d))(!(objectCategory=computer)))" % (UF_DONT_REQUIRE_PREAUTH, UF_ACCOUNTDISABLE)
815811
attributes = [

nxc/protocols/ldap/kerberos.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(self, connection):
2828
self.username = connection.username
2929
self.password = connection.password
3030
self.domain = connection.domain
31+
self.host = connection.host
3132
self.targetDomain = connection.targetDomain
3233
self.hash = connection.hash
3334
self.lmhash = ""
@@ -223,6 +224,10 @@ def get_tgt_asroast(self, userName, requestPAC=True):
223224

224225
message = encoder.encode(as_req)
225226

227+
# If kdcHost isn't set, use the target IP for DNS resolution
228+
if not self.kdcHost:
229+
self.kdcHost = self.host
230+
226231
try:
227232
r = sendReceive(message, domain, self.kdcHost)
228233
except KerberosError as e:

0 commit comments

Comments
 (0)