Translated ['', 'src/pentesting-cloud/azure-security/az-privilege-escala

This commit is contained in:
Translator
2025-11-19 17:18:50 +00:00
parent ddb60d2289
commit e202d17af7

View File

@@ -4,25 +4,57 @@
## 기본 정보
**Dynamic groups**는 설정된 **규칙** 세트를 가진 그룹으로, 규칙에 맞는 모든 **사용자 또는 장치**가 그룹에 추가됩니다. 사용자 또는 장치의 **속성**이 **변경**될 때마다 동적 규칙이 **재확인**됩니다. 그리고 **새 규칙**이 **생성**되면 모든 장치와 사용자가 **확인**됩니다.
**동적 그룹**은 **규칙**이 구성된 그룹이며, 규칙과 일치하는 모든 **사용자 또는 디바이스**가 그룹에 추가됩니다. 사용자나 디바이스의 **속성**이 **변경될 때마다**, 동적 규칙이 **재확인**됩니다. 그리고 **새 규칙**이 **생성되면** 모든 디바이스와 사용자가 **확인**됩니다.
Dynamic groups는 **Azure RBAC 역할** 할당받을 수 있지만, **AzureAD 역할**을 동적 그룹에 추가하는 것은 **불가능**합니다.
동적 그룹에**Azure RBAC roles assigned** 할당 수 있지만, 동적 그룹에 **AzureAD roles**를 추가하는 것은 **불가능합니다**.
이 기능은 Azure AD premium P1 라이센스가 필요합니다.
이 기능은 Azure AD premium P1 license가 필요합니다.
## Privesc
기본적으로 모든 사용자 Azure AD에서 게스트를 초대할 수 있으므로, 동적 그룹의 **규칙**이 **속성**에 따라 사용자에게 **권한**을 부여하는 경우, 이러한 속성을 가진 **게스트**를 **생성**하여 **권한 상승**을 할 수 있습니다. 게스트 자신의 프로필을 관리하고 이러한 속성을 변경할 수도 있습니다.
기본적으로 모든 사용자 Azure AD에서 게스트를 초대할 수 있으므로, 동적 그룹의 **rule**이 새 **게스트**에서 **설정할 수 있는** **attributes**를 기준으로 사용자에게 **permissions**을 부여한다면, 이러한 속성을 가진 게스트를 생성하여 **escalate privileges**할 수 있습니다. 또한 게스트 자신의 프로필을 관리하고 이러한 속성을 변경하는 것도 가능합니다.
동적 멤버십을 허용하는 그룹 가져오기: **`az ad group list --query "[?contains(groupTypes, 'DynamicMembership')]" --output table`**
동적 멤버십을 허용하는 그룹 조회: **`az ad group list --query "[?contains(groupTypes, 'DynamicMembership')]" --output table`**
### 예시
### 동적 그룹 열거
- **규칙 예시**: `(user.otherMails -any (_ -contains "security")) -and (user.userType -eq "guest")`
- **규칙 설명**: 'security' 문자열이 포함된 보조 이메일을 가진 모든 게스트 사용자가 그룹에 추가됩니다.
동적 그룹의 규칙 조회:
게스트 사용자 이메일에 대해 초대를 수락하고 [https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView)에서 **해당 사용자**의 현재 설정을 확인합니다.\
불행히도 페이지에서 속성 값을 수정할 수 없으므로 API를 사용해야 합니다:
With **Azure CLI**:
```bash
az ad group list \
--filter "groupTypes/any(c:c eq 'DynamicMembership')" \
--query "[].{displayName:displayName, rule:membershipRule}" \
-o table
```
**PowerShell** 및 **Microsoft Graph SDK**를 사용하여:
```bash
Install-Module Microsoft.Graph -Scope CurrentUser -Force
Import-Module Microsoft.Graph
Connect-MgGraph -Scopes "Group.Read.All"
Get-MgGroup -Filter "groupTypes/any(c:c eq 'DynamicMembership')" `
-Property Id, DisplayName, GroupTypes
# Get the rules of a specific group
$g = Get-MgGroup -Filter "displayName eq '<GROUP NAME>'" `
-Property DisplayName, GroupTypes, MembershipRule, MembershipRuleProcessingState
$g | Select-Object DisplayName, GroupTypes, MembershipRule
# Get the rules of all dynamic groups
Get-MgGroup -Filter "groupTypes/any(c:c eq 'DynamicMembership')" `
-Property DisplayName, MembershipRule |
Select-Object DisplayName, MembershipRule
```
### 예제
- **Rule example**: `(user.otherMails -any (_ -contains "security")) -and (user.userType -eq "guest")`
- **Rule description**: 보조 이메일에 'security' 문자열이 포함된 모든 Guest 사용자는 그룹에 추가됩니다
Guest 사용자 이메일의 초대를 수락하고 [https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView)에서 **해당 사용자**의 현재 설정을 확인하세요.\
안타깝게도 이 페이지에서는 속성 값을 수정할 수 없으므로 API를 사용해야 합니다:
```bash
# Login with the gust user
az login --allow-no-subscriptions
@@ -41,7 +73,7 @@ az rest --method GET \
--url "https://graph.microsoft.com/v1.0/users/<user-object-id>" \
--query "otherMails"
```
## References
## 참고자료
- [https://www.mnemonic.io/resources/blog/abusing-dynamic-groups-in-azure-ad-for-privilege-escalation/](https://www.mnemonic.io/resources/blog/abusing-dynamic-groups-in-azure-ad-for-privilege-escalation/)