Skip to content

Commit c3e15ba

Browse files
authored
Merge pull request #11 from BloodHoundAD/fix-highvalue
fix: ensure highlevel is being set on all objects
2 parents f076806 + 35eb874 commit c3e15ba

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/Runtime/ObjectProcessors.cs

+32-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ private async Task<User> ProcessUserObject(ISearchResultEntry entry,
8585
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
8686
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
8787
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
88+
ret.Properties.Add("highvalue", false);
8889

8990
if ((_methods & ResolvedCollectionMethod.ACL) != 0)
9091
{
@@ -136,6 +137,7 @@ private async Task<Computer> ProcessComputerObject(ISearchResultEntry entry,
136137
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
137138
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
138139
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
140+
ret.Properties.Add("highvalue", false);
139141

140142
var hasLaps = entry.HasLAPS();
141143
ret.Properties.Add("haslaps", hasLaps);
@@ -320,6 +322,7 @@ private Group ProcessGroupObject(ISearchResultEntry entry,
320322
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
321323
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
322324
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
325+
ret.Properties.Add("highvalue", IsHighValueGroup(resolvedSearchResult.ObjectId));
323326

324327
if ((_methods & ResolvedCollectionMethod.ACL) != 0)
325328
{
@@ -341,6 +344,30 @@ private Group ProcessGroupObject(ISearchResultEntry entry,
341344
return ret;
342345
}
343346

347+
private bool IsHighValueGroup(string objectId)
348+
{
349+
// TODO: replace w/ a more definitive/centralized list
350+
var suffixes = new string []
351+
{
352+
"-512",
353+
"-516",
354+
"-519",
355+
"S-1-5-32-544",
356+
"S-1-5-32-548",
357+
"S-1-5-32-549",
358+
"S-1-5-32-550",
359+
"S-1-5-32-551",
360+
};
361+
foreach (var suffix in suffixes)
362+
{
363+
if (objectId.EndsWith(suffix))
364+
{
365+
return true;
366+
}
367+
}
368+
return false;
369+
}
370+
344371
private async Task<Domain> ProcessDomainObject(ISearchResultEntry entry,
345372
ResolvedSearchResult resolvedSearchResult)
346373
{
@@ -353,6 +380,7 @@ private async Task<Domain> ProcessDomainObject(ISearchResultEntry entry,
353380
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
354381
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
355382
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
383+
ret.Properties.Add("highvalue", true);
356384

357385
if ((_methods & ResolvedCollectionMethod.ACL) != 0)
358386
{
@@ -393,6 +421,7 @@ private GPO ProcessGPOObject(ISearchResultEntry entry,
393421
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
394422
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
395423
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
424+
ret.Properties.Add("highvalue", false);
396425

397426
if ((_methods & ResolvedCollectionMethod.ACL) != 0)
398427
{
@@ -418,6 +447,7 @@ private async Task<OU> ProcessOUObject(ISearchResultEntry entry,
418447
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
419448
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
420449
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
450+
ret.Properties.Add("highvalue", false);
421451

422452
if ((_methods & ResolvedCollectionMethod.ACL) != 0)
423453
{
@@ -457,6 +487,7 @@ private Container ProcessContainerObject(ISearchResultEntry entry,
457487
ret.Properties.Add("name", resolvedSearchResult.DisplayName);
458488
ret.Properties.Add("distinguishedname", entry.DistinguishedName.ToUpper());
459489
ret.Properties.Add("domainsid", resolvedSearchResult.DomainSid);
490+
ret.Properties.Add("highvalue", false);
460491

461492
if ((_methods & ResolvedCollectionMethod.Container) != 0)
462493
ret.ChildObjects = _containerProcessor.GetContainerChildObjects(entry.DistinguishedName).ToArray();
@@ -477,4 +508,4 @@ private Container ProcessContainerObject(ISearchResultEntry entry,
477508
return ret;
478509
}
479510
}
480-
}
511+
}

0 commit comments

Comments
 (0)