Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 1ba6ff2

Browse files
committed
Filter out session domain names with spaces
1 parent 52106b9 commit 1ba6ff2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

SharpHound3/ResolutionHelpers.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ private static string GetDomainControllerForDomain(string domainName)
257257
string accountDomain)
258258
{
259259
var domain = Helpers.NormalizeDomainName(accountDomain);
260+
//If we have a space in the domain name, its most likely NT AUTHORITY or some other variation, and its not a valid name either way. Ignore it
261+
if (domain.Contains(" "))
262+
return (false, null, LdapTypeEnum.Unknown);
263+
260264
var key = new UserDomainKey
261265
{
262266
AccountDomain = domain,

SharpHound3/Tasks/LoggedOnTasks.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ private static async Task<List<Session>> GetLoggedOnUsersAPI(Computer computer)
112112
continue;
113113

114114
//Remove blank accounts and computer accounts
115-
if (username.Trim() == "" || username.EndsWith("$"))
115+
if (username.Trim() == "" || username.EndsWith("$") || username == "ANONYMOUS LOGON" || username == Options.Instance.CurrentUserName)
116+
continue;
117+
118+
//Any domain with a space is unusable (ex: NT AUTHORITY, FONT DRIVER HOST)
119+
if (domain.Contains(" "))
116120
continue;
117121

118122
var (rSuccess, sid, _) = await ResolutionHelpers.ResolveAccountNameToSidAndType(username, domain);

0 commit comments

Comments
 (0)