You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/README.md
+27-2Lines changed: 27 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@ With this information the most common ways to try to get a foothold are:
38
38
- Vulnerabilities in Azure-Hosted Applications
39
39
-[**Server Side Request Forgery**](https://book.hacktricks.wiki/en/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf.html) with access to metadata endpoint
40
40
-**Subdomain takeovers** like in [https://godiego.co/posts/STO-Azure/](https://godiego.co/posts/STO-Azure/)
41
+
-**Other azure services misconfigurations**
41
42
- If some developer laptop is compromised ([WinPEAS and LinPEAS](https://github.com/peass-ng/PEASS-ng) can find this info):
42
43
- Inside **`<HOME>/.Azure`**
43
44
-**`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:
54
55
- In Windows this just generates id tokens.
55
56
- 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)
56
57
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}}
57
63
58
64
> [!NOTE]
59
65
> Remember that usually the **noisiest** part of the enumeration is the **login**, not the enumeration itself.
Once you know who you are, you can start enumerating the **Azure services you have access to**.
161
167
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
+
162
172
The Az PoswerShell command **`Get-AzResource`** lets you **know the resources your current user has visibility over**.
163
173
164
174
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"`
165
175
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
+
167
192
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**:
0 commit comments