Az - Exchange Hybrid Impersonation (ACS Actor Tokens)

Tip

AWS Hacking’i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking’i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin

Temel Bilgi

In legacy Exchange Hybrid designs, the on-prem Exchange deployment could authenticate as the same Entra application identity used by Exchange Online. If an attacker compromised the Exchange server, extracted the hybrid certificate private key, and performed an OAuth client-credentials flow, they could obtain first-party tokens with Exchange Online privilege context.

Pratik risk yalnızca posta kutusu erişimiyle sınırlı değildi. Exchange Online’ın geniş arka uç güven ilişkileri nedeniyle bu kimlik ek Microsoft 365 hizmetleriyle etkileşime girebiliyor ve eski davranışta daha derin tenant kompromisine yol açabiliyordu.

Saldırı Yolları ve Teknik Akış

Modify Federation Configuration via Exchange

Exchange tokens historically had permissions to write domain/federation settings. From an attacker perspective, this enabled direct manipulation of federated domain trust data, including token-signing certificate lists and configuration flags that controlled MFA-claim acceptance from on-prem federation infrastructure.

Bu, saldırgan perspektifinden token-signing sertifika listeleri ve on-prem federation altyapısından gelen MFA-claim kabulünü kontrol eden yapılandırma bayrakları dahil olmak üzere federated domain güven verisinin doğrudan manipüle edilebilmesini sağlıyordu. Exchange tokenları tarihsel olarak domain/federation ayarlarını yazma izinlerine sahipti.

That means a compromised Exchange Hybrid server could be used to stage or reinforce ADFS-style impersonation by changing federation config from the cloud side, even when the attacker started only from on-prem Exchange compromise.

Bu, ele geçirilmiş bir Exchange Hybrid sunucusunun, saldırgan sadece on-prem Exchange’yi ele geçirmiş olsa bile, federasyon konfigürasyonunu bulut tarafından değiştirerek ADFS-style impersonation’ı sahnelemek veya güçlendirmek için kullanılabileceği anlamına gelir.

ACS Actor Tokens and Service-to-Service Impersonation

Exchange’s hybrid auth path used Access Control Service (ACS) actor tokens with trustedfordelegation=true. Those actor tokens were then embedded into a second, unsigned service token that carried the target user identity in an attacker-controlled section. Because the outer token was unsigned and the actor token delegated broadly, the caller could swap target users without re-authenticating.

Exchange’in hybrid auth yolu, trustedfordelegation=true ile Access Control Service (ACS) actor tokenlarını kullanıyordu. Bu actor tokenlar daha sonra hedef kullanıcı kimliğini saldırganın kontrol ettiği bir bölümde taşıyan, imzasız ikinci bir service token içine gömülüyordu. Dış token imzasız ve actor token geniş yetki devretmiş olduğundan, çağıran yeniden kimlik doğrulaması yapmadan hedef kullanıcıları değiştirebiliyordu.

In practice, once the actor token was obtained, the attacker had a long-lived impersonation primitive (typically around 24 hours) that was difficult to revoke mid-lifetime. This enabled user impersonation across Exchange Online and SharePoint/OneDrive APIs, including high-value data exfiltration.

Pratikte, actor token elde edildiğinde saldırganın ortalama ~24 saat süren ve süresi dolmadan iptali zor olan uzun ömürlü bir impersonation primitive’i vardı. Bu, Exchange Online ve SharePoint/OneDrive API’leri üzerinde kullanıcı impersonation’ına ve yüksek değerli veri exfiltration’ına olanak sağlıyordu.

Historically, the same pattern also worked against graph.windows.net by building an impersonation token with the victim’s netId value. That provided direct Entra administrative action as arbitrary users and enabled full-tenant takeover workflows (for example, creating a new Global Administrator account).

Tarihsel olarak, aynı desen kurbanın netId değeriyle bir impersonation tokenı oluşturarak graph.windows.net karşısında da işe yarıyordu. Bu, rastgele kullanıcılar olarak doğrudan Entra yönetici aksiyonu yapılmasına izin veriyor ve tam tenant takeover iş akışlarını mümkün kılıyordu (örneğin yeni bir Global Administrator hesabı oluşturmak).

What No Longer Works

The graph.windows.net impersonation path via Exchange Hybrid actor tokens has been fixed. The old “Exchange to arbitrary Entra admin over Graph” chain should be considered removed for this specific token route.

graph.windows.net üzerinden Exchange Hybrid actor tokenları yoluyla impersonation yolu düzeltilmiştir. Eski “Exchange to arbitrary Entra admin over Graph” zinciri bu özel token rotası için kaldırılmış olarak kabul edilmelidir.

This is the most important correction when documenting the attack: keep the Exchange/SharePoint impersonation risk separate from the now-patched Graph impersonation escalation.

Bu, saldırıyı belgelendirirken en önemli düzeltmedir: Exchange/SharePoint impersonation riskini şimdi yamalanmış Graph impersonation yükselmesiyle ayrı ayrı ele alın.

Pratikte Hâlâ Önemli Olabilecekler

If an organization still runs an old or incomplete hybrid configuration with shared trust and exposed certificate material, Exchange/SharePoint impersonation impact can remain severe. The federation-configuration abuse angle can also remain relevant depending on tenant setup and migration state.

Bir kuruluş hâlâ paylaşılan trust ve açığa çıkmış sertifika materyali ile eski veya tamamlanmamış bir hybrid konfigürasyonu çalıştırıyorsa, Exchange/SharePoint impersonation etkisi ciddi kalabilir. Federation-configuration suiistimali açısı da tenant kurulumu ve migration durumu bağlı olarak alaka düzeyini koruyabilir.

Microsoft’s long-term mitigation is splitting the on-prem and Exchange Online identities so the shared-service-principal trust path no longer exists. Environments that completed that migration materially reduce this attack surface.

Microsoft’un uzun vadeli hafifletmesi, on-prem ve Exchange Online kimliklerini ayırmak; böylece shared-service-principal trust yolu artık ortadan kalkar. Bu migrasyonu tamamlayan ortamlar bu saldırı yüzeyini önemli ölçüde azaltır.

Tespit Notları

When this technique is abused, audit events can show identity mismatches where the user principal name corresponds to an impersonated user while the display/source context points to Exchange Online activity. That mixed identity pattern is a high-value hunting signal, though defenders should baseline legitimate Exchange-admin workflows to reduce false positives.

Bu teknik suistimal edildiğinde, denetim olayları user principal name’in impersonated user ile eşleştiği ancak display/source bağlamının Exchange Online aktivitesine işaret ettiği kimlik uyuşmazlıkları gösterebilir. Bu karışık kimlik paterni yüksek değerli bir hunting sinyalidir; ancak savunucuların false positive’leri azaltmak için meşru Exchange-admin iş akışlarını temel alması gerekir.

References

Tip

AWS Hacking’i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking’i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin