Skip to content

Commit 9c61bb2

Browse files
author
chack
committed
Add technical details for AD-to-Entra pivot techniques
1 parent 93c2d43 commit 9c61bb2

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-connect-sync-policy-abuse.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Basic Information
66

7-
The **Entra ID Connect Sync** account (or its service principal) can access **internal Graph endpoints** (notably `graph.windows.net` internal API versions). With that access it can **modify tenant policies** beyond simple directory sync, which enables **new pivot paths from on‑prem AD to Entra ID**.
7+
The **Entra ID Connect Sync** account (or its service principal) can access **internal Graph endpoints** (notably **`graph.windows.net` internal versions** such as the **`1.61-internal`** API). With that access it can **modify tenant policies** beyond simple directory sync, which enables **new pivot paths from on‑prem AD to Entra ID**.
88

99
The techniques below are based on practical research and are especially relevant in hybrid environments where Connect Sync is present but ADFS/Seamless SSO are not explicitly enabled.
1010

@@ -16,11 +16,16 @@ If the sync principal can modify the **On‑Premises Authentication Policy**, it
1616

1717
High‑level flow:
1818

19-
- Use Connect Sync credentials (user or service principal) to obtain tokens for `graph.windows.net` internal API.
20-
- Modify the **On‑Premises Authentication Policy** and **add KeyCredentials** for a target domain.
21-
- Use the newly added key to **forge Kerberos tickets** for **hybrid users**, enabling SSO‑based cloud authentication.
19+
- Use Connect Sync credentials (user or service principal) to obtain tokens for **`graph.windows.net` internal API**.
20+
- Query/modify the **On‑Premises Authentication Policy** object.
21+
- **Add new KeyCredentials** for a target domain. The policy stores **symmetric Kerberos keys** used by Seamless SSO.
22+
- Use the **new key material** to **forge Kerberos tickets** for **hybrid users**, enabling SSO‑based cloud authentication.
2223

23-
This enables AD‑to‑Entra impersonation without needing to steal existing key material. In practice, policy changes are **poorly logged** (often only “policy changed” without details).
24+
Notes from the talk:
25+
26+
- Existing keys are **not readable** (even as Global Admin), but **new keys can be added**.
27+
- Adding keys effectively **backdoors Seamless SSO** without enabling it through normal admin flows.
28+
- Audit visibility is minimal: policy changes are **poorly logged** (often only “policy changed” without details).
2429

2530
### Abuse Authentication Methods Policy to Bypass MFA
2631

@@ -29,7 +34,11 @@ The sync principal can also modify **Authentication Methods Policy** (e.g., addi
2934
- **Add a custom external method** as a valid MFA provider.
3035
- Combine this with SSO/ADFS token forging to **satisfy MFA** requirements for hybrid users.
3136

32-
This is useful when MFA is enforced but the policy itself can be modified via internal Graph endpoints.
37+
This is useful when MFA is enforced but the policy itself can be modified via internal Graph endpoints. The talk notes that policy updates may only show a **generic “policy changed”** entry without details.
38+
39+
### (Historical) Conditional Access Policy Tampering
40+
41+
The talk also mentions that **Conditional Access Policies** could historically be modified through internal Graph endpoints by the sync principal, but this was **patched in December 2023** (restricted to first‑party apps). The **policy‑abuse path still applies** for other policy types (on‑prem auth, auth methods, password management, external identities).
3342

3443
## References
3544

src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-exchange-hybrid-impersonation.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Basic Information
66

7-
In **Exchange Hybrid** deployments, the on‑prem Exchange server shares a **service principal identity** with Exchange Online. If an attacker compromises the on‑prem Exchange server, they can often **export the hybrid certificate** and use it to request **client‑credentials tokens** as Exchange Online.
7+
In **Exchange Hybrid** deployments, the on‑prem Exchange server shares a **service principal identity** with Exchange Online. If an attacker compromises the on‑prem Exchange server, they can often **export the hybrid certificate** (commonly marked exportable) and use it to request **client‑credentials tokens** as Exchange Online.
88

99
This opens multiple pivot paths into Entra ID and other services.
1010

@@ -27,7 +27,13 @@ Impact:
2727

2828
- **Impersonate any mailbox user** in Exchange Online.
2929
- **Access SharePoint/OneDrive** as any user (Exchange uses those services under the hood).
30-
- **Impersonate Entra ID users** via `graph.windows.net` by crafting tokens with the target **`netId`**.
30+
- **Impersonate Entra ID users** via `graph.windows.net` by crafting tokens with the target **`netId`** parameter.
31+
32+
Technical notes from the talk:
33+
34+
- The actor token is **issued by ACS**, contains the **Exchange audience**, and has **`trusted for delegation`** set.
35+
- The actor token is embedded into an **unsigned bearer token**, where the **target user** is placed in the unsigned portion.
36+
- For `graph.windows.net`, the call requires a **`netId`** value for the impersonated user (distinct from UPN). Exchange can query this and reuse it in the crafted token.
3137

3238
These actor tokens are **not subject to Conditional Access** and are typically valid for long periods (e.g., ~24 hours). With them, an attacker can perform **Entra ID admin actions** (e.g., create a Global Admin), resulting in full tenant compromise.
3339

0 commit comments

Comments
 (0)