Skip to content

Commit 9b8b26e

Browse files
committed
Fix target FQDN directly for Kerberos SPN when host is already fully qualified
1 parent 73420b2 commit 9b8b26e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

nxc/protocols/smb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,9 @@ def enum_host_info(self):
305305
except Exception as e:
306306
self.logger.debug(f"Error adding host {self.host} into db: {e!s}")
307307

308-
# DCOM connection with kerberos needed
309-
self.remoteName = self.host if not self.kerberos else f"{self.hostname}.{self.targetDomain}"
308+
# When the target is already an FQDN, use it directly so the SPN matches
309+
# the host's AD registration (e.g. host.evil.com, not host.corp.evil.com).
310+
self.remoteName = self.host if (not self.kerberos or "." in self.host) else f"{self.hostname}.{self.targetDomain}"
310311

311312
# 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
312313
if not self.kdcHost and self.domain and self.domain == self.targetDomain:

0 commit comments

Comments
 (0)