T1484.002 Elastic Security · Elastic

Detect Trust Modification in Elastic Security

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

Tactic
Defense Evasion Privilege Escalation
Technique
T1484 Domain or Tenant Policy Modification
Sub-technique
T1484.002 Trust Modification
Canonical reference
https://attack.mitre.org/techniques/T1484/002/

Elastic Detection Query

Elastic Security (Elastic)
eql
any where
(
  (
    data_stream.dataset == "azure.auditlogs" and
    azure.auditlogs.operation_name 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"
    )
  )
  or
  (
    winlog.channel == "Security" and
    event.code in ("4706", "4707", "4716")
  )
)
critical severity high confidence

Detects MITRE ATT&CK T1484.002 domain trust modification via Azure AD federation operation changes (Elastic Azure integration fields) and on-premises Windows Security Event IDs 4706 (trust created), 4707 (trust removed), and 4716 (trust modified) captured via Winlogbeat or Elastic Agent. Covers Golden SAML prerequisites, federated IdP injection used by Scattered Spider and Storm-0501, and on-premises AD trust manipulation.

Data Sources

Azure AD Audit Logs via Elastic Azure integration (logs-azure.auditlogs-*)Windows Security Event Log via Winlogbeat or Elastic Agent (winlogbeat-*, logs-system.security-*)

Required Tables

logs-azure.auditlogs-*winlogbeat-*logs-system.security-*

False Positives & Tuning

  • Legitimate M365 or hybrid identity deployment projects where IT is intentionally converting managed domains to federated authentication against ADFS or a third-party IdP under an approved change ticket
  • Enterprise SSO rollout projects adding sanctioned identity providers (Okta, Ping, Azure AD B2B) for new SaaS platforms such as Salesforce or Workday
  • Scheduled federation certificate renewals where administrators update trust metadata for existing ADFS or SAML configurations to replace expiring signing certificates
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Unlock Pro Content

Get the full detection package for T1484.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections