Performance degradation when SharpHound attempts to resolve unresolvable SIDs
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- performance, security
Research direction
Start by tracing the SID-resolution path that uses DirectoryContext and GetDomain(...), then reproduce the non-domain-joined command and compare behavior with and without the existing cache. Done means repeated failures for the same unresolvable SID no longer trigger repeated requests, or the resolution attempt can be disabled, with the observed timing and error behavior covered by verification.
Written by the indexing model from the issue text.
Description
When running SharpHound from a non-domain-joined Windows machine using supplied credentials, if target objects in the domain contain unresolvable SIDs (e.g., due to stale entries from broken two-way trusts), the tool repeatedly attempts to resolve them.
- Environment
- SharpHound Version: 2.6.5
- SharpHoundCommon Version: 4.2.6
- Command : SharpHound -c DCOnly --ldapusername domainuser@ludus.domain --ldappassword ******** -d ludus.domain -v 1 --skipportcheck --disablecertverification --disablesigning --domaincontroller ludus.domain
- Conditions
- The machine executing SharpHound is not joined to the domain
- Some AD objects contain SIDs from a previously trusted domain (e.g., due to removed two-way trust)
- unresolvable SID (from a previously trusted domain) was present on many AD objects.
- Total object count is large (e.g., 500,000+ objects)
- Screenshot
-
non-domain-joined
-
domain-joined
- Observed Behavior
- SharpHound attempts to resolve unknown or external SIDs via DirectoryContext using GetDomain(...)
- Each failed resolution logs:
System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException: Current security context is not associated with an Active Directory domain or forest.
- Comparison Results
| Scenario | Cache | Execution Time |
|---|---|---|
| Domain-joined host | ❌ / ✅ | 13 mins |
| Non-domain host, same creds | ✅ | 30 mins |
| Non-domain host, same creds | ❌ | 90 mins |
Is it possible to add unresolvable SID cache to avoid repeated requests or disable try get unresolvable SID?
- Dominant language
- C#
- Stars
- 104
- Forks
- 56
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SpecterOps/SharpHoundCommon
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SpecterOps/SharpHoundCommon#248 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
SpecterOps/SharpHoundCommon#249 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
SpecterOps/SharpHoundCommon#245 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
.NET Version Open
Difficulty 4/5 3-5 days Newbie friendliness 32/100
SpecterOps/SharpHoundCommon#53 · 4 comments · 2 reactions ·
All issues in SpecterOps/SharpHoundCommon
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·