# Foreign SID details by domain should be investigated

Foreign security principals (FSPs) represent security principals from trusted external domains or forests.

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

<!-- 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-07
```

## Overview

Foreign security principals (FSPs) represent security principals from trusted external domains or forests. Understanding their distribution is important because:

- **Trust visibility**: Identifies external trusts that may have been forgotten or are no longer needed
- **Security boundaries**: Helps assess the blast radius if an external domain is compromised
- **Access control**: Reveals who has access to resources from outside the domain
- **Cleanup opportunities**: May highlight groups that can be cleaned up after domain migrations

#### Control Type

**Operational**

#### Security Recommendation

Regularly review foreign security principals:
- Remove memberships from domains that are no longer trusted
- Audit groups containing external accounts for appropriate access levels
- Document all domain trusts and their business justifications
- Consider converting external access to local accounts where appropriate
- Monitor for unexpected foreign principal additions

#### How the Test Works

This test examines all group memberships in Active Directory and identifies security principals with SIDs that don't match the local domain SID. It groups these foreign principals by their domain SID and counts how many exist from each external domain.

#### Related Tests

- `Test-MtAdGroupMemberForeignSidCount` - Counts total foreign security principals
- `Test-MtAdGroupPrivilegedWithMembersDetails` - Reviews privileged group memberships

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-GMC-07 |
| 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-MtAdGroupMemberForeignSidDetails](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GMC-07.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-07.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GMC-07.ps1)
- Documentation: [`tests/ad/group/Test.AD-GMC-07.md`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GMC-07.md)
