Skip to content

Commit 55afbe8

Browse files
committed
pe - azure
1 parent fd84f36 commit 55afbe8

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

src/pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,116 @@ az rest --method PUT \
8181
--body '{"properties":{"issuer":"https://token.actions.githubusercontent.com","subject":"repo:carlospolop/azure_func4:ref:refs/heads/main","audiences":["api://AzureADTokenExchange"]}}'
8282
```
8383

84+
### Microsoft.Authorization/policyAssignments/write | Microsoft.Authorization/policyAssignments/delete
85+
86+
An attacker with the permission `Microsoft.Authorization/policyAssignments/write` or `Microsoft.Authorization/policyAssignments/delete` over a management group, subscription, or resource group can **modify or delete Azure policy assignments**, potentially **disabling security restrictions** that block specific operations.
87+
88+
This allows access to resources or functionalities that were previously protected by the policy.
89+
90+
**Delete a policy assignment:**
91+
92+
```bash
93+
az policy assignment delete \
94+
--name "<policyAssignmentName>" \
95+
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
96+
```
97+
98+
**Disable a policy assignment:**
99+
100+
```bash
101+
az policy assignment update \
102+
--name "<policyAssignmentName>" \
103+
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>" \
104+
--enforcement-mode Disabled
105+
```
106+
107+
**Verify the changes:**
108+
109+
```bash
110+
# List policy assignments
111+
az policy assignment list \
112+
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
113+
114+
# Show specific policy assignment details
115+
az policy assignment show \
116+
--name "<policyAssignmentName>" \
117+
--scope "/providers/Microsoft.Management/managementGroups/<managementGroupId>"
118+
```
119+
120+
### Microsoft.Authorization/policyDefinitions/write
121+
122+
An attacker with the permission `Microsoft.Authorization/policyDefinitions/write` can **modify Azure policy definitions**, changing the rules that control security restrictions across the environment.
123+
124+
For example, a policy that limits the allowed regions for creating resources can be modified to allow any region, or the policy effect can be changed to make it ineffective.
125+
126+
**Modify a policy definition:**
127+
128+
```bash
129+
az policy definition update \
130+
--name "<policyDefinitionName>" \
131+
--rules @updated-policy-rules.json
132+
```
133+
134+
**Verify the changes:**
135+
136+
```bash
137+
az policy definition list --output table
138+
139+
az policy definition show --name "<policyDefinitionName>"
140+
```
141+
142+
### Microsoft.Management/managementGroups/write
143+
144+
An attacker with the permission `Microsoft.Management/managementGroups/write` can **modify the hierarchical structure of management groups** or **create new management groups**, potentially evading restrictive policies applied at higher levels.
145+
146+
For example, an attacker can create a new management group without restrictive policies and then move subscriptions to it.
147+
148+
**Create a new management group:**
149+
150+
```bash
151+
az account management-group create \
152+
--name "yourMGname" \
153+
--display-name "yourMGDisplayName"
154+
```
155+
156+
**Modify a management group hierarchy:**
157+
158+
```bash
159+
az account management-group update \
160+
--name "<managementGroupId>" \
161+
--parent "/providers/Microsoft.Management/managementGroups/<parentGroupId>"
162+
```
163+
164+
**Verify the changes:**
165+
166+
```bash
167+
az account management-group list --output table
168+
169+
az account management-group show \
170+
--name "<managementGroupId>" \
171+
--expand
172+
```
173+
174+
### Microsoft.Management/managementGroups/subscriptions/write
175+
176+
An attacker with the permission `Microsoft.Management/managementGroups/subscriptions/write` can **move subscriptions between management groups**, potentially **evading restrictive policies** by moving a subscription to a group with less restrictive or no policies.
177+
178+
**Move a subscription to a different management group:**
179+
180+
```bash
181+
az account management-group subscription add \
182+
--name "<managementGroupName>" \
183+
--subscription "<subscriptionId>"
184+
```
185+
186+
**Verify the changes:**
187+
188+
```bash
189+
az account management-group subscription show \
190+
--name "<managementGroupId>" \
191+
--subscription "<subscriptionId>"
192+
```
193+
84194
{{#include ../../../banners/hacktricks-training.md}}
85195

86196

0 commit comments

Comments
 (0)