Skip to content

Commit f0602c7

Browse files
Merge branch 'main' into marshall-db-ip-fix
2 parents 95ae5de + 340bc60 commit f0602c7

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

nxc/protocols/ldap.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ def enum_host_info(self):
259259
ntlm_info = parse_challenge(ntlm_challenge)
260260
self.server_os = ntlm_info["os_version"]
261261

262-
if not self.kdcHost and self.domain and self.domain == self.remoteName:
262+
# using kdcHost is buggy on impacket when using trust relation between ad so we kdcHost must stay to none if targetdomain is not equal to domain
263+
if not self.kdcHost and self.domain and self.domain == self.targetDomain:
263264
result = self.resolver(self.domain)
264265
self.kdcHost = result["host"] if result else None
265266
self.logger.info(f"Resolved domain: {self.domain} with dns, kdcHost: {self.kdcHost}")
@@ -805,6 +806,7 @@ def active_users(self):
805806
def asreproast(self):
806807
if self.password == "" and self.nthash == "" and self.kerberos is False:
807808
return False
809+
808810
# Building the search filter
809811
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)
810812
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)