Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
3bb3550
Add mssql_dumper module for sensitive data discovery
LTJAXSON May 19, 2025
b2827ad
Updating e2e_commands.txt
Wyndoo Dec 16, 2025
beedfe0
Create get-scriptpath.py
Wyndoo Dec 16, 2025
44ddcdc
Add mssql_cbt checker module
Dec 24, 2025
21c0af3
Update e2e
Dec 24, 2025
5761da9
Simplified logic
Dec 24, 2025
d9610f1
Simplified again
Dec 24, 2025
9f27582
feat(ldap): add ADCS collection support via CertiHound
0x0Trace Dec 31, 2025
8c8f430
Merge branch 'main' into feature/adcs-collection
0x0Trace Jan 8, 2026
6bd2de8
Fix incorrect exception handling
Jan 24, 2026
25f567a
feat(ldap): make CertiHound a required dependency
0x0Trace Jan 26, 2026
12c1745
Merge branch 'main' into feature/adcs-collection
0x0Trace Jan 26, 2026
aed1cb3
Add files via upload
pol4ir Jan 27, 2026
ec250af
Update ntlm_mic_bypass.py
pol4ir Jan 27, 2026
fa3ebc1
Update ntlm_mic_bypass.py
pol4ir Jan 27, 2026
f340ab8
Merge: NTLM reflection CVE handling
pol4ir Jan 28, 2026
8e7bc4e
Delete nxc/modules/ntlm_mic_bypass.py
pol4ir Jan 28, 2026
2129198
Merge branch 'main' into feature/adcs-collection
0x0Trace Jan 31, 2026
e3b97c6
fix : support NTLM hash and AES key auth
azoxlpf Feb 4, 2026
bbcd292
use kdcHost only for dc_ip
azoxlpf Feb 5, 2026
d4dd096
Remove function
Feb 6, 2026
28343fe
refactor : switch from ldap3 to impacket CRUD and add LDAPS
azoxlpf Feb 6, 2026
54ab075
Merge branch 'main' into feature/adcs-collection
0x0Trace Feb 7, 2026
e1dfde2
fix AttributeError on NetBIOSTimeout in kerberos_login
azoxlpf Feb 4, 2026
a7ebd5c
restore OSError logging with secret in kerberos_login
azoxlpf Feb 8, 2026
e1a6f15
show auth credentials in kerberos_login connection error logs
azoxlpf Feb 9, 2026
a9efad3
Merge branch 'main' into feature/adcs-collection
0x0Trace Feb 9, 2026
933b971
Switch to terminaltables3
elboulangero Feb 10, 2026
bda56dd
Merge branch 'main' into feature/adcs-collection
0x0Trace Feb 11, 2026
b20a7c1
PR changes 13_02_26
0x0Trace Feb 13, 2026
8424b49
PR changes 16_02_26
0x0Trace Feb 16, 2026
9af3e37
PR changes 16_02_26_comments_newline_fixes
0x0Trace Feb 16, 2026
d06d179
SAM History Dumping
Coontzy1 Feb 6, 2026
f8b44d2
Fix DPAPI credential lookup: add lowercase username for dploot compat…
mverschu Feb 18, 2026
80d4818
Merge branch 'main' into feature/adcs-collection
0x0Trace Feb 23, 2026
156eaf6
fix(backup_operator): add random suffix to dump filenames to avoid ER…
PatchRequest Feb 27, 2026
e065856
Merge branch 'main' into fix/backup_operator_random_suffix
NeffIsBack Feb 27, 2026
41b3fc2
fix(coerce_plus): move get_dynamic_endpoint back to module-level func…
Marshall-Hallenbeck Mar 3, 2026
82ff6b6
db: do not add credential if guest or null auth
lap1nou Mar 3, 2026
77d2c1c
Fix authentication from CCACHE when using kerberos S4U over SMB
Eliotsehr Mar 5, 2026
e820d96
Match entire string and add source for error msgs
NeffIsBack Mar 11, 2026
282fbe1
Align hashes with lm:nt as required in the docstring
NeffIsBack Mar 11, 2026
bd1654b
Merge pull request #1081 from serwiz/fix/add-computer-exception-catch
NeffIsBack Mar 11, 2026
bad31bc
Improve clarity when login times out
NeffIsBack Mar 11, 2026
0e4a049
Merge pull request #1095 from azoxlpf/fix/certipy-auth-kerberos
NeffIsBack Mar 11, 2026
bac2a95
Merge pull request #1096 from azoxlpf/fix/netbios-exception-handling
NeffIsBack Mar 11, 2026
1b9c93e
Use internal gen_random_string
NeffIsBack Mar 11, 2026
1d24435
Merge pull request #1124 from PatchRequest/fix/backup_operator_random…
NeffIsBack Mar 11, 2026
2b5b92b
Formatting
NeffIsBack Mar 11, 2026
9a2544b
Merge pull request #1133 from lap1nou/db-guest-null
NeffIsBack Mar 11, 2026
011416b
Get username from TGT/ST if not supplied
NeffIsBack Mar 11, 2026
d41ff46
Remove obsolete parsing for ccache inside ldap
NeffIsBack Mar 11, 2026
e873e8f
Merge pull request #1135 from Eliotsehr/fix_krb_S4U
NeffIsBack Mar 11, 2026
3ac03b6
Remove duplicate line
NeffIsBack Mar 11, 2026
e57ba1c
Merge pull request #1113 from mverschu/fix/dpapi-username-case
NeffIsBack Mar 11, 2026
b312263
Fix lock file
NeffIsBack Mar 11, 2026
26465b1
Merge pull request #1102 from elboulangero/terminaltables3
NeffIsBack Mar 11, 2026
78902ee
Don't follow symlinks and especially don't reconnect because this doe…
NeffIsBack Mar 11, 2026
0e90245
Merge pull request #1140 from Pennyw0rth/neff-fix-spider_plus
NeffIsBack Mar 11, 2026
543a5b3
Fix nfs for nfs4 only servers
NeffIsBack Mar 11, 2026
c3b7e4a
Merge pull request #1141 from Pennyw0rth/neff-fix-nfs4
NeffIsBack Mar 11, 2026
1a59962
Merge branch 'main' into fix/moduleloader-namespace-collision
Marshall-Hallenbeck Mar 11, 2026
d161db2
Deprecate ntlm_reflection module
NeffIsBack Mar 12, 2026
ac73551
Initial enum_cve module
NeffIsBack Mar 12, 2026
3d7ae49
Update log output to use zone instead of domain
gatariee Mar 12, 2026
77b1efe
Module description and formatting
NeffIsBack Mar 12, 2026
65a7389
Formatting
NeffIsBack Mar 12, 2026
3dbef63
Add CVE dict and logic for enumeration
NeffIsBack Mar 12, 2026
f61bf5a
Improve messages
NeffIsBack Mar 12, 2026
9a7a302
Simplify logic
NeffIsBack Mar 12, 2026
1e90ead
Fix CVE UBRs
NeffIsBack Mar 12, 2026
627aeff
Prevent stacktrace when guest try access winreg
NeffIsBack Mar 12, 2026
138f606
Add UBR to debug output
NeffIsBack Mar 12, 2026
ffd615e
Add exploitation source
NeffIsBack Mar 12, 2026
92e2b8f
Add exploitation source
NeffIsBack Mar 12, 2026
82b1336
Remove deprecated open call
NeffIsBack Mar 12, 2026
3c4e387
Remove unused imports
NeffIsBack Mar 12, 2026
32796c6
Merge pull request #1142 from gatariee/get-network-patch
NeffIsBack Mar 12, 2026
087ee8b
Don't display the index error when guest auth is active
NeffIsBack Mar 12, 2026
90ef481
Merge pull request #1131 from Pennyw0rth/fix/moduleloader-namespace-c…
Marshall-Hallenbeck Mar 12, 2026
b037969
Merge pull request #1145 from Pennyw0rth/neff-fix-shares-guest
NeffIsBack Mar 12, 2026
c015d2c
There are users with empty passwords
NeffIsBack Mar 12, 2026
2347874
Merge branch 'main' into main
pol4ir Mar 12, 2026
0347c13
Merge pull request #1147 from Pennyw0rth/neff-fix-shares-empty-pw
NeffIsBack Mar 12, 2026
83dcd26
Merge pull request #1086 from pol4ir/main
NeffIsBack Mar 13, 2026
44a24f0
Catch KDC_ERR_ETYPE_NOSUPP if there are no etypes left to request
NeffIsBack Mar 13, 2026
845f8d9
Use connection logger instead of universal logger
NeffIsBack Mar 13, 2026
e7fa3fd
Merge pull request #1149 from Pennyw0rth/neff-fix-asreproast
NeffIsBack Mar 13, 2026
d5ff66b
add BadSuccessor and dc_only flag
azoxlpf Mar 13, 2026
defda58
Merge branch 'main' into feat/add-badsuccessor-check
azoxlpf Mar 13, 2026
25166e0
Add support for dploot 3.2.2 and google chrome +137 decryption
zblurx Mar 13, 2026
f55a234
update poetry lock
zblurx Mar 13, 2026
429764c
Log as success and not full highlight
NeffIsBack Mar 14, 2026
8a1fa2f
If retreiving lsass pid failed this would lead to a crash when trying…
NeffIsBack Mar 14, 2026
6bb2d66
Wording
NeffIsBack Mar 14, 2026
f94b139
Prevent doing database stuff if we don't have a valid connection
NeffIsBack Mar 14, 2026
2bd69e0
Merge pull request #1154 from Pennyw0rth/neff-minor-fixes
NeffIsBack Mar 14, 2026
75b207c
Merge pull request #1151 from Pennyw0rth/dpapi_chrome_fix
NeffIsBack Mar 14, 2026
faea737
Merge pull request #1155 from Pennyw0rth/neff-fix-relaying
NeffIsBack Mar 14, 2026
65cc672
call is_host_dc() for dc_only CVEs and cache result
azoxlpf Mar 14, 2026
f42be28
Merge branch 'main' into feat/add-badsuccessor-check
azoxlpf Mar 14, 2026
1f7cdb1
Merge pull request #1150 from azoxlpf/feat/add-badsuccessor-check
NeffIsBack Mar 16, 2026
a1cadc4
Update enum_av.py
0xaled Mar 16, 2026
1fb8433
Merge pull request #1156 from 0xaled/NetExec-Avast-AVG-Enum
NeffIsBack Mar 17, 2026
08e1b74
Add missing lm hash var
NeffIsBack Mar 17, 2026
e4cb390
Formatting
NeffIsBack Mar 17, 2026
1f9f9e3
Formatting
NeffIsBack Mar 17, 2026
d469fc6
Fix logging
NeffIsBack Mar 17, 2026
b83e345
Switch to Pennyw0rth impacket fork for fake cbt value
NeffIsBack Mar 17, 2026
bc1efe1
Formatting
NeffIsBack Mar 17, 2026
e00d08f
Merge branch 'main' into mssql-cbt
NeffIsBack Mar 17, 2026
29b4012
Fix lock file
NeffIsBack Mar 17, 2026
ce04940
Merge branch 'main' into certihound
NeffIsBack Mar 17, 2026
b951b5c
Merge branch 'main' into feat/add-ldaps-addccomputer
azoxlpf Mar 17, 2026
11bb8fb
Move import
NeffIsBack Mar 17, 2026
7999b77
Move bh collection method logic out of ldap proto
NeffIsBack Mar 17, 2026
a0573a6
Simplify resolving logic
NeffIsBack Mar 17, 2026
aecad76
Simplify resolving logic
NeffIsBack Mar 17, 2026
fa26792
Formatting
NeffIsBack Mar 17, 2026
ab88315
Formatting
NeffIsBack Mar 17, 2026
f4967a6
Formatting
NeffIsBack Mar 17, 2026
ea9b661
Simplify filtering
NeffIsBack Mar 17, 2026
37194c6
Fix json formatting
NeffIsBack Mar 17, 2026
39f3a28
fix conflicts
azoxlpf Mar 17, 2026
475078d
ruff fix
azoxlpf Mar 17, 2026
1fdd259
Fix options text
NeffIsBack Mar 18, 2026
1517597
Remove unnecessary checks
NeffIsBack Mar 18, 2026
c169d28
Remove LDAPS statements
NeffIsBack Mar 18, 2026
9bff5bb
Formatting
NeffIsBack Mar 18, 2026
25b72e1
Remove unnecessary checks
NeffIsBack Mar 18, 2026
b7d0463
Formatting
NeffIsBack Mar 18, 2026
06c0735
Simplify code
NeffIsBack Mar 18, 2026
7724e88
Clarify variable name
NeffIsBack Mar 18, 2026
05cc920
Formatting
NeffIsBack Mar 18, 2026
6228c18
Fix exception handling as in #1081
NeffIsBack Mar 18, 2026
170ce53
Merge pull request #1098 from azoxlpf/feat/add-ldaps-addccomputer
NeffIsBack Mar 18, 2026
5a955dd
fallback kdcHost to target IP when DNS resolution fails
azoxlpf Mar 18, 2026
8e5a4fb
handle kdcHost None gracefully, avoid self.host fallback for non-DC t…
azoxlpf Mar 18, 2026
a869a3f
Update enum_av.py With Elastic EDR Version 9.3.0 indicator
0xaled Mar 18, 2026
82dcdd1
ruff fix
azoxlpf Mar 18, 2026
ca62afc
Update enum_av.py : Reorder products alphabetically and add Elastic E…
0xaled Mar 18, 2026
ce30d43
fix spacing for improved code readability
0xaled Mar 18, 2026
6d1df54
Merge pull request #1162 from 0xaled/NetExec-Enum-AV
NeffIsBack Mar 18, 2026
756abe1
Merge pull request #1160 from azoxlpf/fix/pfx-auth
NeffIsBack Mar 18, 2026
36180b3
Merge branch 'main' into add-mssql-dumper-module
NeffIsBack Mar 18, 2026
cbc40f7
Formatting
NeffIsBack Mar 18, 2026
c7b8e5b
Sort pii values
NeffIsBack Mar 18, 2026
d2640c9
Formatting
NeffIsBack Mar 18, 2026
46bfbcf
Fix module and options
NeffIsBack Mar 19, 2026
848b7b0
Optimise code
NeffIsBack Mar 19, 2026
1b5cd4d
Optimise code
NeffIsBack Mar 19, 2026
5f2d347
Comments and removing unnecessary exception handler
NeffIsBack Mar 19, 2026
a17137f
Replace exception handler with lastError check
NeffIsBack Mar 19, 2026
dc3cd90
Optimise code
NeffIsBack Mar 19, 2026
02f521e
Standardize json output
NeffIsBack Mar 19, 2026
11fe13e
Save output file into nxc folder and remove unnecessary parsing
NeffIsBack Mar 19, 2026
62ae17d
Add SHOW_DATA options to regex check
NeffIsBack Mar 19, 2026
9f5ba4f
Update impacket
NeffIsBack Mar 19, 2026
9d65d3c
Merge pull request #1164 from Pennyw0rth/neff-fix-dependencies
NeffIsBack Mar 19, 2026
7c64f92
Add e2e tests
NeffIsBack Mar 19, 2026
2204ea8
Merge pull request #1054 from 0x0Trace/feature/adcs-collection
NeffIsBack Mar 19, 2026
5d2b8fd
Update dependencies
NeffIsBack Mar 20, 2026
4c6ee6b
Remove obsolete ruff setting
NeffIsBack Mar 20, 2026
6a443a5
Clean up ruff
NeffIsBack Mar 20, 2026
76433ab
Replace os.path with async safe anyio.Path
NeffIsBack Mar 20, 2026
7b3aed0
Await forever
NeffIsBack Mar 20, 2026
8dbf09c
Merge pull request #1166 from Pennyw0rth/neff-update-dependencies
NeffIsBack Mar 20, 2026
59272d5
Patches the insert error
Dfte Mar 21, 2026
e3b61df
Merge branch 'main' into mssql-cbt
NeffIsBack Mar 22, 2026
8a9102d
Fix lock file
NeffIsBack Mar 22, 2026
6ca1706
Update impacket
NeffIsBack Mar 22, 2026
4795fbc
Fix ruff
NeffIsBack Mar 22, 2026
ee20734
Fix auth with hashes
NeffIsBack Mar 22, 2026
5e6bd51
Should be lm or nt hash
NeffIsBack Mar 22, 2026
6de83de
Merge pull request #1047 from Dfte/main
NeffIsBack Mar 22, 2026
e8d8966
Merge branch 'main' into mssql-dumper
NeffIsBack Mar 22, 2026
1eb6c51
Add like_search file input and disable preset option
NeffIsBack Mar 22, 2026
1f8d03e
Use connection.port variable on lsassy
T1erno Mar 23, 2026
31bdfe4
Update lsassy
NeffIsBack Mar 23, 2026
bac38ac
Merge pull request #1171 from T1erno/Fix-lsassy-port
NeffIsBack Mar 23, 2026
d7abaf2
fix: add thread-safety to failed login counters
A3-N Mar 24, 2026
931f281
Merge branch 'main' into main
NeffIsBack Mar 25, 2026
1ef7e79
Update enum_av.py: add HarfangLab Hurukai EDR indicators
0xaled Mar 25, 2026
ccbf41d
Update enum_av.py : Minor fix ( HarfangLab PR )
0xaled Mar 25, 2026
ee652ba
Update enum_av.py : Minor fix ( HarfangLab PR )
0xaled Mar 25, 2026
409b027
Merge pull request #698 from LTJAXSON/add-mssql-dumper-module
NeffIsBack Mar 25, 2026
6cfb52c
Just directly use arg and formatting
NeffIsBack Mar 25, 2026
43027f4
Merge pull request #1173 from 0xaled/NetExec-Enum-AV
NeffIsBack Mar 25, 2026
d2342db
Merge pull request #1110 from Coontzy1/main
NeffIsBack Mar 26, 2026
623e6aa
removed outer check, no time save
A3-N Mar 27, 2026
7fb80e6
Update search filter for computer accounts
ledrypotato Mar 28, 2026
08ad1cc
Merge pull request #1041 from Wyndoo/module-get-scriptpath
NeffIsBack Mar 29, 2026
4a5cbf6
Merge pull request #1172 from A3-N/fix/connection-thread-safety
NeffIsBack Mar 30, 2026
4d112e7
abort rid_brute on invalid connection after failed login
azoxlpf Mar 30, 2026
04da125
Merge branch 'main' into fix/mssql-fix-infinite-loop
azoxlpf Mar 30, 2026
a1f3aaa
Attempt to resolve and open target user; abort if not found or not ac…
termanix Mar 30, 2026
7c97ed1
fix ruff. That changes for preventing unnecessary RPC calls
termanix Mar 30, 2026
e6ca7f4
Added try except for understanding errors
termanix Mar 30, 2026
8a0957e
return early from rid_brute on SID/domain query failure
azoxlpf Mar 30, 2026
95f67b7
removed duplicate try&except
termanix Mar 30, 2026
9d90e0d
fix: avoid AttributeError when MSSQL command output is None
azoxlpf Mar 31, 2026
081ab77
fix(mssql): handle TDS error when NTLM challenge absent and fix local…
azoxlpf Mar 31, 2026
3ff1e89
Merge branch 'main' into fix/mssql-integrated-auth-tds-error-handling
azoxlpf Mar 31, 2026
e8c2584
Merge branch 'main' into fix/mssql-attribute-error
azoxlpf Mar 31, 2026
600abd6
Merge pull request #1179 from azoxlpf/fix/mssql-fix-infinite-loop
NeffIsBack Mar 31, 2026
b27b20f
Merge branch 'main' into fix/mssql-integrated-auth-tds-error-handling
azoxlpf Apr 1, 2026
7147aa2
parse TDS ERROR/INFO via impacket
azoxlpf Apr 1, 2026
19f979c
Merge branch 'main' into fix/mssql-attribute-error
azoxlpf Apr 1, 2026
1b4900d
always return str from MSSQLEXEC.execute
azoxlpf Apr 1, 2026
a073c2d
Merge pull request #1182 from azoxlpf/fix/mssql-attribute-error
NeffIsBack Apr 1, 2026
12cb8e3
Merge branch 'Pennyw0rth:main' into pre2k-module-adjustment
ledrypotato Apr 3, 2026
6e39d16
add module option to query every computer object
ledrypotato Apr 3, 2026
8ebf8fe
fix module option description
ledrypotato Apr 3, 2026
c78bb6b
Move error handling to login function, so if we crash we don't add us…
NeffIsBack Apr 3, 2026
ee37fc0
Remove unnecessary None checks
NeffIsBack Apr 3, 2026
3e4a7bc
Merge pull request #1180 from termanix/patch-2
NeffIsBack Apr 3, 2026
c2efe58
small adjustments + separate writing pre2k & non pre2k computers to d…
ledrypotato Apr 3, 2026
f2d2a72
add e2e commands
ledrypotato Apr 3, 2026
ddc66c1
Only display accounts that have been found
NeffIsBack Apr 3, 2026
ee466af
Still display failed TGT retreival for pre2k accounts
NeffIsBack Apr 3, 2026
121d6c4
Only apply ALL option if indeed set to true
NeffIsBack Apr 3, 2026
1f4acea
Merge pull request #1177 from ledrypotato/pre2k-module-adjustment
NeffIsBack Apr 3, 2026
6ada3ea
rename ntlm_parser to negotiate_parser, add TDS LOGIN7 helpers
azoxlpf Apr 3, 2026
4cb4978
Switch if logic
NeffIsBack Apr 6, 2026
804aeb0
Remove unused variable and add no_ntlm
NeffIsBack Apr 6, 2026
6c957f9
Remove print message
NeffIsBack Apr 6, 2026
a1ecc1d
Add NTLM:False flag
NeffIsBack Apr 6, 2026
31472fb
Merge branch 'main' into fix/mssql-integrated-auth-tds-error-handling
azoxlpf Apr 6, 2026
67d90e0
Merge pull request #1183 from azoxlpf/fix/mssql-integrated-auth-tds-e…
NeffIsBack Apr 6, 2026
6584260
Resolve merge conflicts and sync fork with upstream
Mercury0 Apr 8, 2026
9a39a07
fix: ruff lint fixes
Mercury0 Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netexec.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ a = Analysis(
'nxc.helpers.bloodhound',
'nxc.helpers.even6_parser',
'nxc.helpers.msada_guids',
'nxc.helpers.ntlm_parser',
'nxc.helpers.negotiate_parser',
'paramiko',
'pefile',
'pypsrp.client',
Expand Down
36 changes: 20 additions & 16 deletions nxc/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import contextlib

from os.path import isfile
from threading import BoundedSemaphore
from threading import BoundedSemaphore, Lock
from functools import wraps
from time import sleep
from ipaddress import ip_address
Expand All @@ -23,8 +23,10 @@
from nxc.helpers.pfx import pfx_auth

from impacket.dcerpc.v5 import transport
from impacket.krb5.ccache import CCache

sem = BoundedSemaphore(1)
fail_lock = Lock()
global_failed_logins = 0
user_failed_logins = {}

Expand Down Expand Up @@ -315,26 +317,28 @@ def call_modules(self):
def inc_failed_login(self, username):
global global_failed_logins, user_failed_logins

if username not in user_failed_logins:
user_failed_logins[username] = 0
with fail_lock:
if username not in user_failed_logins:
user_failed_logins[username] = 0

user_failed_logins[username] += 1
global_failed_logins += 1
self.failed_logins += 1
user_failed_logins[username] += 1
global_failed_logins += 1
self.failed_logins += 1

def over_fail_limit(self, username):
global global_failed_logins, user_failed_logins

if global_failed_logins == self.args.gfail_limit:
return True
with fail_lock:
if global_failed_logins == self.args.gfail_limit:
return True

if self.failed_logins == self.args.fail_limit:
return True
if self.failed_logins == self.args.fail_limit:
return True

if username in user_failed_logins and self.args.ufail_limit == user_failed_logins[username]: # noqa: SIM103
return True
if username in user_failed_logins and self.args.ufail_limit == user_failed_logins[username]: # noqa: SIM103
return True

return False
return False

def query_db_creds(self):
"""Queries the database for credentials to be used for authentication.
Expand Down Expand Up @@ -481,8 +485,6 @@ def try_credentials(self, domain, username, owned, secret, cred_type, data=None)
- NTLM-hash (/kerberos)
- AES-key
"""
if self.over_fail_limit(username):
return False
if self.args.continue_on_success and owned:
return False

Expand All @@ -498,6 +500,8 @@ def try_credentials(self, domain, username, owned, secret, cred_type, data=None)
sleep(value)

with sem:
if self.over_fail_limit(username):
return False
if cred_type == "plaintext":
if self.kerberos:
self.logger.debug("Trying to authenticate using Kerberos")
Expand Down Expand Up @@ -553,7 +557,7 @@ def login(self):
if self.args.use_kcache:
self.logger.debug("Trying to authenticate using Kerberos cache")
with sem:
username = self.args.username[0] if len(self.args.username) else ""
username = self.args.username[0] if len(self.args.username) else CCache.parseFile()[1]
password = self.args.password[0] if len(self.args.password) else ""
self.kerberos_login(self.domain, username, password, "", "", self.kdcHost, True)
self.logger.info("Successfully authenticated using Kerberos cache")
Expand Down
92 changes: 92 additions & 0 deletions nxc/helpers/negotiate_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Parsing helpers for auth negotiation: NTLM challenges and TDS ERROR/INFO on MSSQL LOGIN7.
# Original NTLM parsing from: https://github.com/fortra/impacket/blob/master/examples/DumpNTLMInfo.py#L568

import struct

from impacket import ntlm
from impacket.smb3 import WIN_VERSIONS
from impacket.tds import TDS_ERROR_TOKEN, TDS_INFO_TOKEN, TDS_INFO_ERROR
import contextlib


def parse_challenge(challange):
target_info = {
"hostname": None,
"domain": None,
"os_version": None
}
challange = ntlm.NTLMAuthChallenge(challange)
av_pairs = ntlm.AV_PAIRS(challange["TargetInfoFields"][:challange["TargetInfoFields_len"]])
if av_pairs[ntlm.NTLMSSP_AV_HOSTNAME] is not None:
with contextlib.suppress(Exception):
target_info["hostname"] = av_pairs[ntlm.NTLMSSP_AV_HOSTNAME][1].decode("utf-16le")
if av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME] is not None:
with contextlib.suppress(Exception):
target_info["domain"] = av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME][1].decode("utf-16le")
if "Version" in challange.fields:
version = challange["Version"]
if len(version) >= 4:
major_version = version[0]
minor_version = version[1]
product_build = struct.unpack("<H", version[2:4])[0]
if product_build in WIN_VERSIONS:
target_info["os_version"] = f"{WIN_VERSIONS[product_build]} Build {product_build}"
else:
target_info["os_version"] = f"{major_version}.{minor_version} Build {product_build}"
return target_info


def decode_tds_info_error_msgtext(data, offset):
"""Extract MsgText from a TDS ERROR (0xAA) or INFO (0xAB) token at *offset*.

Official spec: [MS-TDS] Tabular Data Stream Protocol (Microsoft Learn).
Token layout per MS-TDS 2.2.7.9 (INFO) / 2.2.7.10 (ERROR):
TokenType BYTE 0xAA | 0xAB
Length USHORT LE byte count of the remaining fields
Number LONG LE error / info number
State BYTE
Class BYTE severity
MsgText US_VARCHAR (2-byte LE length prefix + UTF-16LE)
... (ServerName, ProcName, LineNumber follow but are unused here)

The minimum *Length* value for a valid token is 8: Number(4) + State(1) +
Class(1) + MsgText length prefix(2, may be zero-length string).

References (Microsoft Learn, MS-TDS):
INFO: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/284bb815-d083-4ed5-b33a-bdc2492e322b
ERROR: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/9805e9fa-1f8b-4cf8-8f78-8d2602228635
Data packet stream tokens: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/f79bb5b8-5919-439a-a696-48064b78b091
"""
remaining = len(data) - offset
if remaining < 3 or data[offset] not in (TDS_ERROR_TOKEN, TDS_INFO_TOKEN):
return None

# Length (USHORT LE) after TokenType, see MS-TDS INFO/ERROR links in docstring
payload_len = int.from_bytes(data[offset + 1 : offset + 3], "little")

if payload_len < 8 or remaining < 3 + payload_len:
return None
try:
token = TDS_INFO_ERROR(data[offset:])
text = token["MsgText"].decode("utf-16le").strip()
except Exception:
return None
return text or None


def login7_integrated_auth_error_message(packet_data, data_after_login_header):
"""Scan raw LOGIN7 response buffers for the first ERROR/INFO message.

When a server does not support Integrated Windows Authentication it replies
to the LOGIN7 NTLMSSP negotiate with a TDS error token instead of an
NTLMSSP challenge. This helper locates the first ERROR (0xAA) or INFO
(0xAB) token in either the full packet or the payload after the 3-byte
LOGIN7 response header and returns its MsgText.
"""
token_markers = (TDS_ERROR_TOKEN, TDS_INFO_TOKEN)
for buf in filter(None, (packet_data, data_after_login_header)):
for offset in (i for i in range(len(buf)) if buf[i] in token_markers):
msg = decode_tds_info_error_msgtext(buf, offset)
if msg:
return msg
return None
34 changes: 0 additions & 34 deletions nxc/helpers/ntlm_parser.py

This file was deleted.

4 changes: 4 additions & 0 deletions nxc/helpers/pfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ def pfx_auth(self):
req = ini.build_asreq(self.domain, username)
self.logger.info("Requesting TGT")

if not self.kdcHost:
self.logger.fail(f"Could not resolve KDC host for domain {self.domain}. Use --kdcHost to specify the domain controller IP")
return False

sock = KerberosClientSocket(KerberosTarget(self.kdcHost))
try:
res = sock.sendrecv(req)
Expand Down
Loading
Loading