# Group SID History count should be retrievable

This test identifies group objects that have SID History attributes populated.

Source: https://maester.dev/docs/tests/AD-GRP-05

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/soulemike" title="Michael Soule · Original author"><img src="https://github.com/soulemike.png" alt="Michael Soule" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/soulemike">Michael Soule</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/ad">Active Directory</a> · Active Directory · Groups · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-GRP-05
```

## Overview

- SID History is an attribute used during Active Directory domain migrations to maintain access to resources in the source domain:
- Groups with SID History are important to monitor because persistent SID History on groups can indicate:
- **Incomplete migrations**: Groups that were migrated but never fully transitioned
- **Security risks**: SIDs from untrusted or decommissioned domains may grant unintended access
- **Directory bloat**: Unnecessary data that complicates troubleshooting and auditing
- **Audit complexity**: Makes it difficult to determine effective permissions
- **Trust dependencies**: Hidden dependencies on domains that may no longer exist
- Groups with SID History are particularly concerning because they often control access to resources, and the SID History may grant access to users or groups from the source domain.

#### Control Type

**Detective**

#### Security Recommendation

- Review all groups with SID History to determine if migration is complete
- Remove SID History attributes once group memberships are verified in the new domain
- Be cautious of SID History containing SIDs from external or untrusted domains
- Document any groups that legitimately require long-term SID History
- Regularly audit SID History contents during security reviews

#### How the Test Works

- This test retrieves all group objects from Active Directory and:
- Checks the SIDHistory attribute for each group
- Counts groups where SIDHistory is populated with one or more SIDs
- Calculates the percentage of groups with SID History

#### Related Tests

- `Test-MtAdGroupStaleCount` - Groups with SID History may also be stale if migration was long ago
- `Test-MtAdGroupAdminCount` - Privileged groups with SID History require special attention

#### Related links

- [Microsoft Defender for Identity: Unsecure SID History attributes](https://learn.microsoft.com/defender-for-identity/security-posture-assessments/accounts#unsecure-sid-history-attributes)
- [ANSSI Active Directory checkpoints: Accounts or groups with SID history set](https://www.cert.ssi.gouv.fr/uploads/ad_checklist.html#vuln_sidhistory_present)

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | AD-GRP-05 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Groups |
| Area | Identity lifecycle and hygiene |
| Resource type | Group |
| MITRE ATT&CK | T1134.005 SID-History Injection |
| PowerShell test | [Test-MtAdGroupSidHistoryCount](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-05.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:group:ReadProperty |

</details>

## Source

- Test: [`tests/ad/group/Test.AD-GRP-05.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-05.ps1)
- Documentation: [`tests/ad/group/Test.AD-GRP-05.md`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-05.md)
