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/az-basic-information/az-tokens-and-public-applications.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,7 @@ These refresh tokens must be minted in that broker context (a regular refresh to
216
216
217
217
### Goal and purpose
218
218
219
-
The goal of BroCI is to reuse a valid user session from a broker-capable app chain and request tokens for another trusted app/resource pair without running a new full interactive flow each time.
219
+
The goal of BroCI is to reuse a valid user session from a broker-capable app chain and request tokens for another trusted app/resource pair. Therefore, allowing to "escalate privileges" from the original token.
220
220
221
221
From an offensive perspective, this matters because:
222
222
@@ -235,6 +235,9 @@ NAA/BroCI token exchanges are **not** the same as a regular OAuth refresh exchan
235
235
- You generally cannot "convert" a normal refresh token into a BroCI-valid one in code.
236
236
- You need a refresh token already issued by a compatible brokered flow.
237
237
238
+
Check the web **<https://entrascopes.com/>** to find BroCI configured apps an the trust relationships they have.
239
+
240
+
238
241
### Mental model
239
242
240
243
Think of BroCI as:
@@ -245,7 +248,7 @@ If any part of that broker chain does not match, the exchange fails.
245
248
246
249
### Where to find a BroCI-valid refresh token
247
250
248
-
In authorized testing/lab scenarios, one practical way is browser portal traffic collection:
251
+
One practical way is browser portal traffic collection:
249
252
250
253
1. Sign in to `https://entra.microsoft.com` (or Azure portal).
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/README.md
+78-2Lines changed: 78 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ az ad app update --id <app-id> --web-redirect-uris "https://original.com/callbac
100
100
101
101
### Applications Privilege Escalation
102
102
103
-
**As explained in [this post](https://dirkjanm.io/azure-ad-privilege-escalation-application-admin/)** it was very common to find default applications that have **API permissions** of type **`Application`** assigned to them. An API Permission (as called in the Entra ID console) of type **`Application`** means that the application can access the API without a user context (without a user login into the app), and without needing Entra ID roles to allow it. Therefore, it's very common to find **high privileged applications in every Entra ID tenant**.
103
+
**As explained in [this post](https://dirkjanm.io/azure-ad-privilege-escalation-application-admin/)** it was very common to find default applications that have **API permissions** of type **`Application`** assigned to them. An API Permission (as called in the Entra ID console) of type **`Application`** means that the application can access the API and perform actions without a user context (without a user login into the app), and without needing Entra ID roles to allow it. Therefore, it's very common to find **high privileged applications in every Entra ID tenant**.
104
104
105
105
Then, if an attacker has any permission/role that allows to **update the credentials (secret o certificate) of the application**, the attacker can generate a new credential and then use it to **authenticate as the application**, gaining all the permissions that the application has.
106
106
@@ -138,6 +138,83 @@ az ad sp show --id <ResourceAppId> --query "appRoles[?id=='<id>'].value" -o tsv
138
138
az ad sp show --id 00000003-0000-0000-c000-000000000000 --query "appRoles[?id=='d07a8cc0-3d51-4b77-b3b0-32704d1f69fa'].value" -o tsv
139
139
```
140
140
141
+
<details>
142
+
<summary>Find all applications with API permissions to non-Microsoft APIs (az cli)</summary>
143
+
144
+
```bash
145
+
#!/usr/bin/env bash
146
+
set -euo pipefail
147
+
148
+
# Known Microsoft first-party owner organization IDs.
149
+
MICROSOFT_OWNER_ORG_IDS=(
150
+
"f8cdef31-a31e-4b4a-93e4-5f571e91255a"
151
+
"72f988bf-86f1-41af-91ab-2d7cd011db47"
152
+
)
153
+
154
+
is_microsoft_owner() {
155
+
local owner="$1"
156
+
local id
157
+
foridin"${MICROSOFT_OWNER_ORG_IDS[@]}";do
158
+
if [ "$owner"="$id" ];then
159
+
return 0
160
+
fi
161
+
done
162
+
return 1
163
+
}
164
+
165
+
command -v az >/dev/null 2>&1|| { echo"az CLI not found">&2;exit 1; }
0 commit comments