Language:
A Microsoft Entra tenant can federate with an external domain to establish trust with another domain for authentication and authorization. Organizations use federation to delegate authentication for Active Directory users to their on-premises Active Directory Federation Services (AD FS). (Note: the external domain is not an Active Directory "domain".) However, if malicious actors gain elevated privileges in Microsoft Entra ID, they can abuse this federation mechanism to create a backdoor by adding their own federated domain or editing an existing one to add a secondary configuration with their own settings. This attack would enable the following actions:
This Indicator of Exposure detects federated domain backdoors that the AADInternals hacking toolkit creates, in particular the ConvertTo-AADIntBackdoor
and New-AADIntBackdoor
cmdlets, based on certain characteristics of the backdoor domain it created or converted.
Also, refer to the related Indicator of Exposure "Federation Signing Certificates Mismatch".
The federation protocol used to transmit the authentication proof from the malicious federated domain to the targeted Microsoft Entra ID can be either WS-Federation or SAML. When using SAML, the attack resembles a "Golden SAML" attack, with these key differences:
The microsoft.directory/domains/allProperties/allTasks
and microsoft.directory/domains/federation/update
permissions grants administrators the ability to modify the federated domains. As of November 2023, the following built-in Microsoft Entra roles hold this permission in addition to potential custom roles:
The APT29 threat group abused this method in the infamous December 2020 attack against SolarWinds called "Solorigate", as documented by Microsoft and by Mandiant.
This finding indicates a potential backdoor from an attacker. Initiate an incident response procedure with a forensic analysis in order to confirm the alleged attack, identify the origin and time of the attack, and assess the extent of the possible intrusion.
To view the list of federated domains in the Azure portal, navigate to the "Custom domain names" blade and look for those with a checkmark in the "Federated" column. The name of the potentially malicious domain matches the one flagged in the finding. However, unlike the MS Graph API, the Azure portal does not display the federation technical details.
Use PowerShell cmdlets from MS Graph API to list the domains with Get-MgDomain
and their federation configuration with Get-MgDomainFederationConfiguration
, as follows:
Connect-MgGraph -Scopes "Domain.Read.All"
Get-MgDomain -All | Where-Object { $_.AuthenticationType -eq "Federated" } | ForEach-Object { $_ ; Get-MgDomainFederationConfiguration -DomainId $_.Id }
After saving evidence for forensic analysis:
Remove-MgDomain
.Remove-MgDomainFederationConfiguration
.You can follow this remediation guide from Microsoft "Emergency rotation of the AD FS certificates".
To confirm the operation, ensure that the reported finding from this Indicator of Exposure has cleared.
Additionally, it is important to anticipate that the attacker may have set up other persistence mechanisms such as backdoors. Seek assistance from incident response experts to help identify and eliminate these additional threats.
Note that this type of attack abuses federation which is a normal and legitimate feature of Microsoft Entra ID. To prevent future attacks, limit the number of administrators who can modify federation settings. This is a proactive measure since an attacker must have high privileges to create such a backdoor. Check the vulnerability description for specific permissions and a list of roles.
Name: Known Federated Domain Backdoor
Codename: KNOWN-FEDERATED-DOMAIN-BACKDOOR
Severity: Critical