Skip to content

Commit 98c7e56

Browse files
committed
impr
1 parent 27d07ae commit 98c7e56

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

src/pentesting-cloud/azure-security/README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ With this information the most common ways to try to get a foothold are:
3838
- Vulnerabilities in Azure-Hosted Applications
3939
- [**Server Side Request Forgery**](https://book.hacktricks.wiki/en/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf.html) with access to metadata endpoint
4040
- **Subdomain takeovers** like in [https://godiego.co/posts/STO-Azure/](https://godiego.co/posts/STO-Azure/)
41+
- **Other azure services misconfigurations**
4142
- If some developer laptop is compromised ([WinPEAS and LinPEAS](https://github.com/peass-ng/PEASS-ng) can find this info):
4243
- Inside **`<HOME>/.Azure`**
4344
- **`azureProfile.json`** contains info about logged in users from the past
@@ -54,6 +55,11 @@ With this information the most common ways to try to get a foothold are:
5455
- In Windows this just generates id tokens.
5556
- Possible to see if Az PowerShell was used in Linux and macSO checking is `$HOME/.local/share/.IdentityService/` exists (although the contained files are empty and useless)
5657

58+
Find **other Azure Services misconfigurations** that cal lead to a foothold in the following page:
59+
60+
{{#ref}}
61+
az-unauthenticated-enum-and-initial-entry/
62+
{{#endref}}
5763

5864
> [!NOTE]
5965
> Remember that usually the **noisiest** part of the enumeration is the **login**, not the enumeration itself.
@@ -159,13 +165,32 @@ az-enumeration-tools.md#automated-post-exploitation-tools
159165

160166
Once you know who you are, you can start enumerating the **Azure services you have access to**.
161167

168+
You should start finding out the **permissions you have** over the resources. For this:
169+
170+
1. **Find the resource you have some acecss to**:
171+
162172
The Az PoswerShell command **`Get-AzResource`** lets you **know the resources your current user has visibility over**.
163173

164174
Moreover, you can get the same info in the **web console** going to [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) or searching for "All resources" or executing: `az rest --method GET --url "https://management.azure.com/subscriptions/<subscription-id>/resources?api-version=2021-04-01"`
165175

166-
Furthermore, with enough permissions, the role **`Get-AzRoleAssignment`** can be used to **enumerate all the roles** in the subscription or the permission over a specific resource indicatig it like in: **`Get-AzRoleAssignment -Scope /subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.RecoveryServices/vaults/vault-m3ww8ut4`**
176+
2. **Find the permissions you have over the resources you have access to and find the roles assigned to you**:
177+
178+
Note that you need the permission **`Microsoft.Authorization/roleAssignments/read`** to execute this action.
179+
180+
Furthermore, with enough permissions, the role **`Get-AzRoleAssignment`** can be used to **enumerate all the roles** in the subscription or the permission over a specific resource indicatig it like in: **`Get-AzRoleAssignment -Scope /subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.RecoveryServices/vaults/vault-m3ww8ut4`**.
181+
182+
It's also possible to get this information running **`az rest --method GET --uri "https://management.azure.com/<Scope>/providers/Microsoft.Authorization/roleAssignments?api-version=2020-08-01-preview" | jq ".value"`** like in:
183+
184+
- **`az rest --method GET --uri "https://management.azure.com//subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.KeyVault/vaults/vault-m3ww8ut4/providers/Microsoft.Authorization/roleAssignments?api-version=2020-08-01-preview" | jq ".value"`**
185+
186+
3. **Find the granular permissions of the roles attached to you **:
187+
188+
Then, to get the granular permission you could run **`(Get-AzRoleDefinition -Id "<RoleDefinitionId>").Actions`**.
189+
190+
Or call the API directly with **`az rest --method GET --uri "https://management.azure.com//subscriptions/<subscription-id>/providers/Microsoft.Authorization/roleDefinitions/<RoleDefinitionId>?api-version=2020-08-01-preview" | jq ".properties"`**.
191+
167192

168-
In the following section you can find information about the most common Azure services and how to enumerate them:
193+
In the following section you can find **information about the most common Azure services and how to enumerate them**:
169194

170195
{{#ref}}
171196
az-services/

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

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/az-storage-unauth.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,3 @@ Use [**Storage Explorer**](https://azure.microsoft.com/en-us/features/storage-ex
4646
{{#include ../../../banners/hacktricks-training.md}}
4747

4848

49-

0 commit comments

Comments
 (0)