Skip to content

Commit 9e780c7

Browse files
committed
Use kerberos with no-preauth and allow preauth authentication if flag is set
1 parent 4cd0bf1 commit 9e780c7

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

nxc/connection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ def __init__(self, args, db, target):
136136
# Authentication info
137137
self.password = ""
138138
self.username = ""
139-
self.kerberos = bool(self.args.kerberos or self.args.use_kcache or self.args.aesKey or (hasattr(self.args, "delegate") and self.args.delegate))
139+
self.kerberos = bool(self.args.kerberos or
140+
self.args.use_kcache or
141+
self.args.aesKey or
142+
(hasattr(self.args, "delegate") and self.args.delegate) or
143+
(hasattr(self.args, "no_preauth") and self.args.no_preauth))
140144
self.aesKey = None if not self.args.aesKey else self.args.aesKey[0]
141145
self.use_kcache = None if not self.args.use_kcache else self.args.use_kcache
142146
self.admin_privs = False

nxc/protocols/ldap.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,11 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="",
409409
f"{domain}\\{self.username}{' account vulnerable to asreproast attack'} {''}",
410410
color="yellow",
411411
)
412-
return False
412+
# If no preauth is set, we want to be able to execute commands such as --kerberoasting
413+
if self.args.no_preauth: # noqa: SIM103
414+
return True
415+
else:
416+
return False
413417
except SessionError as e:
414418
error, desc = e.getErrorString()
415419
used_ccache = " from ccache" if useCache else f":{process_secret(kerb_pass)}"

0 commit comments

Comments
 (0)