Detect Trust Modification in Google Chronicle
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/
YARA-L Detection Query
rule trust_modification_t1484_002 {
meta:
author = "Detection Engineering"
description = "Detects MITRE ATT&CK T1484.002 - Domain Trust Modification including Azure AD federation manipulation and on-premises AD trust events (4706/4707/4716). Covers Golden SAML setup, federated IdP injection, and AD trust changes by Scattered Spider and Storm-0501."
mitre_attack_tactic = "Privilege Escalation, Defense Evasion"
mitre_attack_technique = "T1484.002"
severity = "HIGH"
priority = "HIGH"
version = "1.0"
events:
(
(
$e.metadata.vendor_name = "Microsoft"
and $e.metadata.product_name = "Azure Active Directory"
and (
$e.metadata.product_event_type = "Set domain authentication"
or $e.metadata.product_event_type = "Set federation settings on domain"
or $e.metadata.product_event_type = "Set DomainFederationSettings"
or $e.metadata.product_event_type = "Add domain to company"
or $e.metadata.product_event_type = "Add trusted CA for certificate-based auth"
or $e.metadata.product_event_type = "Update federation settings on domain"
or $e.metadata.product_event_type = "Add identity provider to organization"
or $e.metadata.product_event_type = "Set company information"
)
)
or
(
$e.metadata.vendor_name = "Microsoft"
and $e.metadata.product_name = "Microsoft-Windows-Security-Auditing"
and $e.metadata.product_event_type in ("4706", "4707", "4716")
)
)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting T1484.002 trust modification events using UDM fields. Matches Azure AD audit log events where product_event_type is a federation-related operation name, and Windows Security Auditing events with product_event_type 4706 (trust created), 4707 (trust removed), or 4716 (trust modified). Requires Azure AD logs ingested via Chronicle's Microsoft Azure AD log type and Windows events via the Chronicle forwarder with Windows Event Log parser.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate federation configuration during Microsoft 365 tenant deployment or hybrid AD rollout projects where ADFS is being connected or a third-party IdP is being registered under an approved change
- Authorized changes to existing federation trusts during ADFS token-signing certificate rotation procedures which require updating federation metadata on the Azure AD side
- Domain trust additions during approved corporate mergers, acquisitions, or subsidiary onboarding workflows that involve establishing cross-forest trusts between newly joined AD environments
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.