語系:
第一方服務主體 (企業應用程式) 來自屬於 Microsoft 的應用程式 (應用程式註冊)。它們大多數在 Microsoft Entra ID 中擁有在安全性檢查中經常被忽略的機密權限。攻擊者可藉此將憑證新增至這些主體,以隱蔽地利用主體特權。
因為擁有應用程式管理員角色的主體可以將憑證新增至應用程式 (包括擁有更高特權的應用程式),所以這項技術使攻擊者能夠長期潛伏和提升權限。
除極少數情況外 (請參閱「建議」),第一方服務主體不應擁有任何憑證。
APT29 威脅集團曾在 2020 年 12 月濫用此方法對 SolarWinds 發動惡名昭彰的「Solorigate」攻擊,Microsoft 和 Mandiant 均有相關記錄。
首先評估觀察到的憑證正當性。如果這些憑證與下列服務主體之一相關聯,便可視這些憑證為正當憑證: Exchange Online/Skype for Business/AAD Password Protection Proxy。
在懷疑憑證不正當的其他情況下:
與附加在應用程式中的憑證不同,您無法使用 Azure 入口網站列出服務主體憑證。使用 Microsoft Graph PowerShell 的 Get-MgServicePrincipal 指令程式列出服務主體憑證:
Get-MgServicePrincipal -ServicePrincipalId <objectid> -Property keyCredentials | select -ExpandProperty keyCredentials
Get-MgServicePrincipal -ServicePrincipalId <objectid> -Property passwordCredentials | select -ExpandProperty passwordCredentials
若要刪除這些憑證,請使用:
$keycredentials = (Get-MgServicePrincipal -ServicePrincipalId <objectid>).KeyCredentials
取得金鑰憑證陣列,接著從 $keycredentials
移除不需要的憑證,最後使用 Update-MgServicePrincipal -ServicePrincipalId <objectid> -KeyCredentials $keycredentials
來套用新的陣列。若要清除所有金鑰憑證,您只需使用: Update-MgServicePrincipal -ServicePrincipalId <objectid> -KeyCredentials @()
。或者,您也可以選擇使用目前已淘汰的 AzureAD PowerShell 模組:
Get-AzureADServicePrincipalKeyCredential
和 Remove-AzureADServicePrincipalKeyCredential
Get-AzureADServicePrincipalPasswordCredential
和 Remove-AzureADServicePrincipalPasswordCredential
名稱: 擁有憑證的第一方服務主體
代碼名稱: FIRST-PARTY-SERVICE-PRINCIPAL-WITH-CREDENTIALS
嚴重性: High
技術: T1098.001
More: Azure AD privilege escalation - Taking over default application permissions as Application Admin