Repository navigation
fix(mssql): handle NoneType in rid_brute when SUSER_SNAME returns NULL - #1534
JordaoMbambu wants to merge 1 commit into
Conversation
|
Thanks for the PR! This is already fixed on main by #1295: |
|
@mpgn you are right, completely missed that. Closing now |
|
Thanks @mpgn and @NeffIsBack, makes sense! FYI I did check I was on the latest version, I'm on the Exegol free image which says it's up to date. Turns out it was built just before #1295 got merged, so the fix isn't in there yet. Might be worth knowing if other Exegol users report the same thing. Really appreciate you both taking the time to look into it, even though it ended up being a duplicate :) |
Description
Fixes #1533
When running
--rid-bruteagainst an MSSQL target using a SQL login (not a Windows/domain account), NetExec crashes withAttributeError: 'NoneType' object has no attribute 'split'atmssql.py:480.The root cause:
SUSER_SNAME()returnsNULLfor RIDs that don't resolve to any account. Python receives this asNone(not the string"NULL"), so the existingif username == "NULL": continuecheck never matches, and the code reaches line 480 where.split("\\")is called onNone→ crash.The fix adds a null check before splitting: if
usernameisNoneor doesn't contain a backslash, return it as-is instead of crashing.No dependencies required.
Type of change
Setup guide for the review
Target: Windows Server 2022, MSSQL (SQL Server 2019 RTM 15.0.2000)
How to trigger the bug:
nxc mssql <IP> --local-auth -u <sql_user> -p <password> --rid-bruteSUSER_SNAME()→ crash atmssql.py:480After the fix:
Screenshots
Before: crash on first NULL RID:
The fix in
mssql.py:After : NULL RIDs skipped, brute force continues:
After with
| grep -v Nonedomain users enumerated correctly:Checklist
tests/e2e_commands.txtfile if necessary