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/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ For more information check https://github.com/padok-team/cognito-scanner
88
88
The only thing an attacker need to know to **get AWS credentials** in a Cognito app as unauthenticated user is the **Identity Pool ID**, and this **ID must be hardcoded** in the web/mobile **application** for it to use it. An ID looks like this: `eu-west-1:098e5341-8364-038d-16de-1865e435da3b` (it's not bruteforceable).
89
89
90
90
> [!TIP]
91
-
> The **IAM Cognito unathenticated role created via is called** by default `Cognito_<Identity Pool name>Unauth_Role`
91
+
> The **IAM Cognito unauthenticated role created via is called** by default `Cognito_<Identity Pool name>Unauth_Role`
92
92
93
93
If you find an Identity Pools ID hardcoded and it allows unauthenticated users, you can get AWS credentials with:
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/az-basic-information/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@
32
32
33
33
All the **resources** must be **inside a resource group** and can belong only to a group and if a resource group is deleted, all the resources inside it are also deleted.
-**appid**: Application ID used to generate the token
152
+
-**appidacr**: The Application Authentication Context Class Reference indicates how the client was authenticated, for a public client the value is 0, and if a client secret is used the value is 1
153
+
-**acr**: The Authentication Context Class Reference claim is "0" when the end-user authentication did not meet the requirements of ISO/IEC 29115.
154
+
-**amr**: The Authentication method indicates how the token was authenticated. A value of “pwd” indicates that a password was used.
155
+
-**groups**: Indicates the groups where the principal is a member.
156
+
-**iss**: The issues identifies the security token service (STS) that generated the token. e.g. https://sts.windows.net/fdd066e1-ee37-49bc-b08f-d0e152119b04/ (the uuid is the tenant ID)
157
+
-**oid**: The object ID of the principal
158
+
-**tid**: Tenant ID
159
+
-**iat, nbf, exp**: Issued at (when it was issued), Not before (cannot be used before this time, usually same value as iat), Expiration time.
160
+
161
+
149
162
## FOCI Tokens Privilege Escalation
150
163
151
164
Previously it was mentioned that refresh tokens should be tied to the **scopes** it was generated with, to the **application** and **tenant** it was generated to. If any of these boundaries is broken, it's possible to escalate privileges as it will be possible to generate access tokens to other resources and tenants the user has access to and with more scopes than it was originally intended.
Turbot with steampipe and powerpipe allows to gather information from Azure and Entra ID and perform compliance checks and find misconfigurations. The currently most recommended Azure modules to run are:
Prowler is an Open Source security tool to perform AWS, Azure, Google Cloud and Kubernetes security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness.
207
+
208
+
It basically would allow us to run hundreds of checks against an Azure environment to find security misconfigurations and gather the results in json (and other text format) or check them in the web.
209
+
210
+
```bash
211
+
# Create a application with Reader role and set the tenant ID, client ID and secret in prowler so it access the app
Scout Suite gathers configuration data for manual inspection and highlights risk areas. It's a multi-cloud security-auditing tool, which enables security posture assessment of cloud environments.
258
+
259
+
```bash
260
+
virtualenv -p python3 venv
261
+
source venv/bin/activate
262
+
pip install scoutsuite
263
+
scout --help
264
+
265
+
# Use --cli flag to use az cli credentials
266
+
# Use --user-account to have scout prompt for user credentials
267
+
# Use --user-account-browser to launch a browser to login
268
+
# Use --service-principal to have scout prompt for app credentials
It's a powershell script that helps you to **visualize all the resources and permissions inside a Management Group and the Entra ID** tenant and find security misconfigurations.
277
+
278
+
It works using the Az PowerShell module, so any authentication supported by this tool is supported by the tool.
MicroBurst includes functions and scripts that support Azure Services discovery, weak configuration auditing, and post exploitation actions such as credential dumping. It is intended to be used during penetration tests where Azure is in use.
PowerZure was created out of the need for a framework that can both perform reconnaissance and exploitation of Azure, EntraID, and the associated resources.
330
+
331
+
It uses the **Az PowerShell** module, so any authentication supported by this tool is supported by the tool.
332
+
333
+
```bash
334
+
# Login
335
+
Import-Module Az
336
+
Connect-AzAccount
337
+
338
+
# Clone and import PowerZure
339
+
git clone https://github.com/hausec/PowerZure
340
+
cd PowerZure
341
+
ipmo ./Powerzure.psd1
342
+
Invoke-Powerzure -h # Check all the options
343
+
344
+
# Info Gathering (read)
345
+
Get-AzureCurrentUser # Get current user
346
+
Get-AzureTarget # What can you access to
347
+
Get-AzureUser -All # Get all users
348
+
Get-AzureSQLDB -All # Get all SQL DBs
349
+
Get-AzureAppOwner # Owners of apps in Entra
350
+
Show-AzureStorageContent -All # List containers, shared and tables
351
+
Show-AzureKeyVaultContent -All # List all contents in key vaults
GraphRunner is a post-exploitation toolset for interacting with the Microsoft Graph API. It provides various tools for performing reconnaissance, persistence, and pillaging of data from a Microsoft Entra ID (Azure AD) account.
365
+
366
+
```bash
367
+
#A good place to start is to authenticate with the Get-GraphTokens module. This module will launch a device-code login, allowing you to authenticate the session from a browser session. Access and refresh tokens will be written to the global $tokens variable. To use them with other GraphRunner modules use the Tokens flag (Example. Invoke-DumpApps -Tokens $tokens)
368
+
Import-Module .\GraphRunner.ps1
369
+
Get-GraphTokens
370
+
371
+
#This module gathers information about the tenant including the primary contact info, directory sync settings, and user settings such as if users have the ability to create apps, create groups, or consent to apps.
372
+
Invoke-GraphRecon -Tokens $tokens -PermissionEnum
373
+
374
+
#A module to dump conditional access policies from a tenant.
375
+
Invoke-GraphRecon -Tokens $tokens -PermissionEnum
376
+
377
+
#A module to dump conditional access policies from a tenant.
378
+
Invoke-DumpCAPS -Tokens $tokens -ResolveGuids
379
+
380
+
#This module helps identify malicious app registrations. It will dump a list of Azure app registrations from the tenant including permission scopes and users that have consented to the apps. Additionally, it will list external apps that are not owned by the current tenant or by Microsoft's main app tenant. This is a good way to find third-party external apps that users may have consented to.
381
+
Invoke-DumpApps -Tokens $tokens
382
+
383
+
#Gather the full list of users from the directory.
#Gets groups that may be able to be modified by the current user
390
+
Get-UpdatableGroups -Tokens $tokens
391
+
392
+
#Finds dynamic groups and displays membership rules
393
+
Get-DynamicGroups -Tokens $tokens
394
+
395
+
#Gets a list of SharePoint site URLs visible to the current user
396
+
Get-SharePointSiteURLs -Tokens $tokens
397
+
398
+
#This module attempts to locate mailboxes in a tenant that have allowed other users to read them. By providing a userlist the module will attempt to access the inbox of each user and display if it was successful. The access token needs to be scoped to Mail.Read.Shared or Mail.ReadWrite.Shared for this to work.
#This module attempts to gather a tenant ID associated with a domain.
402
+
Get-TenantID -Domain
403
+
404
+
#Runs Invoke-GraphRecon, Get-AzureADUsers, Get-SecurityGroups, Invoke-DumpCAPS, Invoke-DumpApps, and then uses the default_detectors.json file to search with Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, and Invoke-SearchTeams.
Stormspotter creates an “attack graph” of the resources in an Azure subscription. It enables red teams and pentesters to visualize the attack surface and pivot opportunities within a tenant, and supercharges your defenders to quickly orient and prioritize incident response work.
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ When running this script, sys admins need to provide two main parameters: **Serv
15
15
16
16
An encrypted secret is generated in the AzureArcDeploy directory on the specified share using DPAPI-NG encryption. The encrypted secret is stored in a file named encryptedServicePrincipalSecret. Evidence of this can be found in the DeployGPO.ps1 script, where the encryption is performed by calling ProtectBase64 with $descriptor and $ServicePrincipalSecret as inputs. The descriptor consists of the Domain Computer and Domain Controller group SIDs, ensuring that the ServicePrincipalSecret can only be decrypted by the Domain Controllers and Domain Computers security groups, as noted in the script comments.
17
17
18
-
```powershell
18
+
```bash
19
19
# Encrypting the ServicePrincipalSecret to be decrypted only by the Domain Controllers and the Domain Computers security groups
@@ -34,24 +34,24 @@ We have the follow conditions:
34
34
35
35
There are several methods to obtain a machine account within an AD environment. One of the most common is exploiting the machine account quota. Another method involves compromising a machine account through vulnerable ACLs or various other misconfigurations.
Once a machine account is obtained, it is possible to authenticate using this account. We can either use the runas.exe command with the netonly flag or use pass-the-ticket with Rubeus.exe.
0 commit comments