# Foreign SID principals count should be investigated

Foreign SIDs represent security identifiers from domains other than the current domain:

Source: https://maester.dev/docs/tests/AD-GMC-06

<!-- 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-GMC-06
```

## Overview

Foreign SIDs represent security identifiers from domains other than the current domain:

- **SID History**: Migrated accounts may retain original SIDs for access continuity
- **Trust Relationships**: External domain SIDs indicate trust-based access
- **Cross-Forest Access**: Forest trusts may introduce SIDs from entirely different forests
- **Security Auditing**: Foreign SIDs should be tracked as they bypass some local security checks

#### Control Type

**Operational**

#### Security Recommendation

Monitor and audit foreign SIDs carefully:
- Review SID history from domain migrations for continued necessity
- Verify that trust relationships with external domains are still required
- Be cautious of foreign SIDs in highly privileged groups
- Document all foreign SID sources for compliance and security reviews

#### How the Test Works

This test analyzes group membership for foreign SIDs by:
- Comparing member SIDs against the current domain SID
- Identifying SIDs that don't match the local domain pattern
- Grouping foreign SIDs by their domain of origin
- Counting unique foreign SID principals

For performance reasons, the test analyzes the first 50 groups.

#### Related Tests

- `Test-MtAdGroupMemberTrustCount` - Count of trust members overall
- `Test-MtAdGroupMemberTrustDetails` - Detailed view by group

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-GMC-06 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Groups |
| Area | External access and sharing |
| Resource type | Group |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdGroupMemberForeignSidCount](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GMC-06.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:domainDNS:ReadProperty, ActiveDirectory:Ldap:group:ReadProperty, ActiveDirectory:Ldap:group.member:ReadProperty |

</details>

## Source

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