Detect Trust Modification in IBM QRadar
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/
QRadar Detection Query
SELECT
DATEFORMAT(devicetime, 'yyyy-MM-dd HH:mm:ss') AS EventTime,
LOGSOURCENAME(logsourceid) AS LogSource,
LOGSOURCETYPENAME(devicetype) AS LogSourceType,
username AS Actor,
sourceip AS ActorIP,
QIDNAME(qid) AS EventName,
"EventID",
"operationName",
"targetResourceDisplayName",
CASE
WHEN LOGSOURCETYPENAME(devicetype) ILIKE '%Azure Active Directory%' THEN 'AzureAD'
WHEN "EventID" IN ('4706','4707','4716') THEN 'OnPremAD'
ELSE 'Unknown'
END AS Source,
CASE
WHEN "EventID" = '4706' THEN 'New Domain Trust Created'
WHEN "EventID" = '4707' THEN 'Domain Trust Removed'
WHEN "EventID" = '4716' THEN 'Trusted Domain Information Modified'
ELSE "operationName"
END AS EventType
FROM events
WHERE
devicetime > NOW() - 86400000
AND (
(
LOGSOURCETYPENAME(devicetype) ILIKE '%Azure Active Directory%'
AND (
"operationName" ILIKE 'Set domain authentication'
OR "operationName" ILIKE 'Set federation settings on domain'
OR "operationName" ILIKE 'Set DomainFederationSettings'
OR "operationName" ILIKE 'Add domain to company'
OR "operationName" ILIKE 'Add trusted CA for certificate-based auth'
OR "operationName" ILIKE 'Update federation settings on domain'
OR "operationName" ILIKE 'Add identity provider to organization'
OR "operationName" ILIKE 'Set company information'
)
)
OR (
LOGSOURCETYPENAME(devicetype) ILIKE '%Windows%'
AND "EventID" IN ('4706', '4707', '4716')
)
)
ORDER BY devicetime DESC
LAST 1440 MINUTES QRadar AQL query detecting T1484.002 trust modification events from Microsoft Azure Active Directory DSM (federation operation changes via custom extracted property operationName) and Windows Security Event Log DSM (Event IDs 4706, 4707, 4716 on domain controllers). Requires the Azure AD audit log DSM and Windows Security DSM to be configured with operationName and EventID as custom properties or standard extracted fields.
Data Sources
Required Tables
False Positives & Tuning
- Authorized identity federation projects during Microsoft 365 tenant onboarding or hybrid identity migration where domains are intentionally converted to federated authentication with ADFS
- Change-management-approved trust additions between corporate AD forests during mergers, acquisitions, or subsidiary onboarding with corresponding tickets in the ticketing system
- Domain trust removals as part of decommissioning legacy domains or cleaning up stale forest trusts following a consolidation project
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.