Detect Trust Modification in CrowdStrike LogScale
Adversaries may add new domain trusts, modify the properties of existing domain trusts, or otherwise change the configuration of trust relationships between domains and tenants to evade defenses and/or elevate privileges. In Microsoft Azure AD / Entra ID environments this includes converting a managed domain to federated authentication and injecting a backdoor signing certificate to forge SAML tokens (Golden SAML) without compromising the original cert. Adversaries may also add entirely new federated identity providers to Okta, AWS IAM Identity Center, or other identity tenants, enabling them to authenticate as any user in the tenant. On-premises Active Directory trust manipulation generates Windows Security Event IDs 4706/4707/4716. Threat actors observed using this technique include Scattered Spider (adding federated IdPs to SSO tenants with automatic account linking), Storm-0501 (creating new federated domains in Microsoft Entra for persistent backdoor), and AADInternals tooling which automates federated domain backdoor creation.
MITRE ATT&CK
- Sub-technique
- T1484.002 Trust Modification
- Canonical reference
- https://attack.mitre.org/techniques/T1484/002/
LogScale Detection Query
(
(
#repo = "WinEventLog"
| EventCode in ["4706", "4707", "4716"]
| Channel = "Security"
)
or
(
#repo = "azure_ad_audit"
| OperationName in [
"Set domain authentication",
"Set federation settings on domain",
"Set DomainFederationSettings",
"Add domain to company",
"Add trusted CA for certificate-based auth",
"Update federation settings on domain",
"Add identity provider to organization",
"Set company information"
]
)
)
| Source := case {
#repo = "WinEventLog" => "OnPremAD";
#repo = "azure_ad_audit" => "AzureAD";
* => "Unknown"
}
| EventType := case {
EventCode = "4706" => "New Domain Trust Created";
EventCode = "4707" => "Domain Trust Removed";
EventCode = "4716" => "Trusted Domain Information Modified";
* => OperationName
}
| Actor := coalesce(
initiatedBy.user.userPrincipalName,
initiatedBy.app.displayName,
SubjectUserName,
"Unknown"
)
| ActorIP := coalesce(initiatedBy.user.ipAddress, "N/A")
| TargetResource := coalesce(targetResources[0].displayName, Computer, "Unknown")
| IsManagedToFederation := if(
match(regex="(?i)federated", field=OperationName) and Source = "AzureAD",
true, false
)
| select([_time, Source, EventType, Actor, ActorIP, TargetResource, IsManagedToFederation])
| sort(_time, order=desc) CrowdStrike LogScale (Humio CQL) query detecting T1484.002 trust modification from Windows Security Event Log events forwarded via Falcon Log Forwarder or a compatible log shipper into the WinEventLog repository, and Azure AD audit logs ingested into the azure_ad_audit repository via Azure Event Hub integration. Covers on-premises AD trust lifecycle events and Azure AD federation manipulation including Golden SAML setup and federated IdP injection.
Data Sources
Required Tables
False Positives & Tuning
- Authorized federation setup or reconfiguration during enterprise SSO projects where an administrator is legitimately adding a new SAML IdP or updating existing federation metadata under a tracked change request
- Domain controller maintenance windows where IT performs trust relationship modifications between AD forests as part of infrastructure consolidation or domain rename operations
- Authorized red team or penetration testing engagements that include testing AADInternals-based federation backdoor creation or BloodHound-identified trust escalation paths within documented scope
Other platforms for T1484.002
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Enumerate Current Federation Settings via MSOnline
Expected signal: Azure AD AuditLogs: OperationName='Get domain federation settings' or similar read operation, initiatedBy showing the authenticated UPN. PowerShell ScriptBlock Log Event ID 4104 capturing the Get-MsolDomainFederationSettings command with domain parameter. Sysmon Event ID 1 showing powershell.exe process with MSOnline module loaded.
- Test 2Convert Domain to Federated Authentication via Set-MsolDomainAuthentication
Expected signal: Azure AD AuditLogs: OperationName='Set domain authentication' with Category='DirectoryManagement', Result='success', InitiatedBy.user.userPrincipalName showing the test account, TargetResources[0].displayName='testlab.onmicrosoft.com', modifiedProperties showing oldValue containing 'Managed' and newValue containing 'Federated' along with the adversary IssuerUri. PowerShell ScriptBlock Log Event ID 4104 capturing the full Set-MsolDomainAuthentication command.
- Test 3Create New On-Premises AD Domain Trust (netdom)
Expected signal: Windows Security Event ID 4706 on all domain controllers: SubjectUserName=DomainAdmin, SubjectDomainName=VICTIMCORP, TdoType=2 (External), TdoDomainName=adversarydomain.local, TdoSid showing the SID of the adversary domain, SidFilteringEnabled=Yes (if default). Also generates replication events across the domain.
- Test 4Add Federated Identity Provider to Azure AD via Microsoft Graph API
Expected signal: Azure AD AuditLogs: OperationName='Add identity provider to organization' or 'Create identity provider', Category='DirectoryManagement', Result='success', InitiatedBy showing the authenticating application or user, TargetResources containing the new federation configuration details including the adversary IssuerUri and signing certificate.
References (10)
- https://attack.mitre.org/techniques/T1484/002/
- https://o365blog.com/post/federation-vulnerability/
- https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/ADFSDomainTrustMods.yaml
- https://us-cert.cisa.gov/ncas/alerts/aa21-008a
- https://docs.microsoft.com/en-us/azure/active-directory/hybrid/whatis-fed
- https://sec.okta.com/articles/2023/08/cross-tenant-impersonation-prevention-and-detection
- https://www.sygnia.co/threat-reports-and-advisories/golden-saml-attack/
- https://reinforce.awsevents.com/content/dam/reinforce/2024/slides/TDR432_New-tactics-and-techniques-for-proactive-threat-detection.pdf
- https://docs.microsoft.com/en-us/office365/troubleshoot/active-directory/update-federated-domain-office-365
- https://learn.microsoft.com/en-us/graph/api/resources/federationconfigurations-overview
Unlock Pro Content
Get the full detection package for T1484.002 including response playbook, investigation guide, and atomic red team tests.