Escalating to Domain Admin in Microsoft’s Cloud Hosted Active Directory (Azure AD Domain Services)
Azure AD Domain Services delegates the DNSAdmins group to the customer's AAD DC Administrators group, and DNSAdmins can load an arbitrary DLL on the domain controller via the ServerLevelPluginDll setting. An attacker who compromises an account in that group could execute code as SYSTEM on the domain controller and escalate to domain admin.
hub.trimarcsecurity.com
Published on hub.trimarcsecurity.com
While preparing for my DEFCON 28 SafeMode talk in 2020, I reviewed hosted Active Directory (AD) environments from the three big cloud providers: Amazon, Microsoft, and Google. This review involved running a version of the Trimarc Active Directory Security Assessment Tool which is a custom, internal, proprietary…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could compromise the Azure AD DS domain and persist at the domain controller or domain level without the customer's knowledge or ability to resolve.
What the attacker needed
Compromise of an account in AAD DC Administrators; or ability to modify that group; a network share accessible by the DC
The fix
Microsoft should fix this as a security issue, or the service account the DNS service runs under could be changed, or DLLs that can operate on domain controllers could be restricted.
How it was found
- Compromise an account that is a member of the AAD DC Administrators group or can modify it.
- Use DNS management over RPC to set the ServerLevelPluginDll option to a DLL on a network share.
- Ensure the DLL is available on a share the domain controller's computer account can access.
- Wait for the DNS service to restart, which loads the DLL and runs it as SYSTEM.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In a cloud-hosted Active Directory, the provider normally keeps full control so customers cannot become domain admins. Here, the customer is given a group that can manage DNS, and that group has a known ability to make the domain controller load a file of the attacker's choosing. By doing so, an attacker with that group membership could run code at the highest privilege level on the domain controller.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.