Az - Enumeration Tools
Tip
Lernen & üben Sie AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Lernen & üben Sie GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Lernen & üben Sie Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Unterstützen Sie HackTricks
- Überprüfen Sie die Abonnementpläne!
- Treten Sie der 💬 Discord-Gruppe oder der Telegram-Gruppe bei oder folgen Sie uns auf Twitter 🐦 @hacktricks_live.
- Teilen Sie Hacking-Tricks, indem Sie PRs an die HackTricks und HackTricks Cloud GitHub-Repos senden.
PowerShell unter Linux installieren
Tip
Unter Linux müssen Sie PowerShell Core installieren:
sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common
# Ubuntu 20.04
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# Update repos
sudo apt-get update
sudo add-apt-repository universe
# Install & start powershell
sudo apt-get install -y powershell
pwsh
# Az cli
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
PowerShell in MacOS installieren
Anleitung aus der documentation:
- Installiere
brew, falls noch nicht installiert:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Installieren Sie die neueste stabile Version von PowerShell:
brew install powershell/tap/powershell
- PowerShell ausführen:
pwsh
- Aktualisierung:
brew update
brew upgrade powershell
Haupt-Enumeration-Tools
az cli
Azure Command-Line Interface (CLI) ist ein plattformübergreifendes Tool, geschrieben in Python, zum Verwalten und Administrieren (der meisten) Azure- und Entra ID-Ressourcen. Es verbindet sich mit Azure und führt administrative Befehle über die Kommandozeile oder Skripte aus.
Folgen Sie diesem Link für die installation instructions¡.
Befehle in Azure CLI sind nach folgendem Muster aufgebaut: az <service> <action> <parameters>
Debug | MitM az cli
Mit dem Parameter --debug ist es möglich, alle Anfragen zu sehen, die das Tool az sendet:
az account management-group list --output table --debug
Um ein MitM gegen das Tool durchzuführen und alle Requests zu prüfen, die es manuell sendet, kannst du:
export ADAL_PYTHON_SSL_NO_VERIFY=1
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
export HTTPS_PROXY="http://127.0.0.1:8080"
export HTTP_PROXY="http://127.0.0.1:8080"
# If this is not enough
# Download the certificate from Burp and convert it into .pem format
# And export the following env variable
openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM
export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem
Az PowerShell
Azure PowerShell ist ein Modul mit Cmdlets zur Verwaltung von Azure-Ressourcen direkt über die PowerShell-Befehlszeile.
Folgen Sie diesem Link für die installation instructions.
Befehle im Azure PowerShell AZ Module sind aufgebaut wie: <Action>-Az<Service> <parameters>
Debug | MitM Az PowerShell
Mit dem Parameter -Debug ist es möglich, alle Anfragen zu sehen, die das Tool sendet:
Get-AzResourceGroup -Debug
Um ein MitM gegen das Tool durchzuführen und alle Anfragen manuell zu prüfen, können Sie die Umgebungsvariablen HTTPS_PROXY und HTTP_PROXY entsprechend den docs setzen.
Microsoft Graph PowerShell
Microsoft Graph PowerShell ist ein plattformübergreifendes SDK, das den Zugriff auf alle Microsoft Graph APIs ermöglicht, einschließlich Diensten wie SharePoint, Exchange und Outlook, über einen einzigen Endpunkt. Es unterstützt PowerShell 7+, moderne Authentifizierung via MSAL, externe Identitäten und erweiterte Abfragen. Mit Fokus auf Least-Privilege-Zugriff stellt es sichere Operationen sicher und erhält regelmäßige Updates, um mit den neuesten Microsoft Graph API-Funktionen Schritt zu halten.
Follow this link for the installation instructions.
Commands in Microsoft Graph PowerShell are structured like: <Action>-Mg<Service> <parameters>
Debug Microsoft Graph PowerShell
Mit dem Parameter -Debug ist es möglich, alle Anfragen zu sehen, die das Tool sendet:
Get-MgUser -Debug
AzureAD Powershell
Das Azure Active Directory (AD)-Modul, jetzt veraltet, ist Teil von Azure PowerShell zum Verwalten von Azure AD-Ressourcen. Es stellt Cmdlets für Aufgaben wie das Verwalten von Benutzern, Gruppen und Anwendungsregistrierungen in Entra ID bereit.
Tip
Dies wurde durch Microsoft Graph PowerShell ersetzt
Folge diesem Link zu den Installationsanweisungen.
Automatisierte Recon & Compliance-Tools
turbot azure plugins
Turbot zusammen mit steampipe und powerpipe ermöglicht das Sammeln von Informationen aus Azure und Entra ID sowie das Durchführen von Compliance-Prüfungen und das Aufspüren von Fehlkonfigurationen. Die derzeit am meisten empfohlenen Azure-Module zum Ausführen sind:
- https://github.com/turbot/steampipe-mod-azure-compliance
- https://github.com/turbot/steampipe-mod-azure-insights
- https://github.com/turbot/steampipe-mod-azuread-insights
# Install
brew install turbot/tap/powerpipe
brew install turbot/tap/steampipe
steampipe plugin install azure
steampipe plugin install azuread
# Config creds via env vars or az cli default creds will be used
export AZURE_ENVIRONMENT="AZUREPUBLICCLOUD"
export AZURE_TENANT_ID="<tenant-id>"
export AZURE_SUBSCRIPTION_ID="<subscription-id>"
export AZURE_CLIENT_ID="<client-id>"
export AZURE_CLIENT_SECRET="<secret>"
# Run steampipe-mod-azure-insights
cd /tmp
mkdir dashboards
cd dashboards
powerpipe mod init
powerpipe mod install github.com/turbot/steampipe-mod-azure-insights
steampipe service start
powerpipe server
# Go to http://localhost:9033 in a browser
Prowler
Prowler ist ein Open-Source-Sicherheitstool, um Sicherheits-Best-Practice-Bewertungen, Audits, incident response, kontinuierliche Überwachung, Härtung und Forensik-Bereitschaft für AWS, Azure, Google Cloud und Kubernetes durchzuführen.
Es ermöglicht uns im Wesentlichen, Hunderte von Checks gegen eine Azure-Umgebung auszuführen, um Sicherheitsfehlkonfigurationen zu finden und die Ergebnisse in json (und anderen Textformaten) zu sammeln oder sie im Web zu prüfen.
# Create a application with Reader role and set the tenant ID, client ID and secret in prowler so it access the app
# Launch web with docker-compose
export DOCKER_DEFAULT_PLATFORM=linux/amd64
curl -LO https://raw.githubusercontent.com/prowler-cloud/prowler/refs/heads/master/docker-compose.yml
curl -LO https://raw.githubusercontent.com/prowler-cloud/prowler/refs/heads/master/.env
## If using an old docker-compose version, change the "env_file" params to: env_file: ".env"
docker compose up -d
# Access the web and configure the access to run a scan from it
# Prowler cli
python3 -m pip install prowler --break-system-packages
docker run --rm toniblyx/prowler:v4-latest azure --list-checks
docker run --rm toniblyx/prowler:v4-latest azure --list-services
docker run --rm toniblyx/prowler:v4-latest azure --list-compliance
docker run --rm -e "AZURE_CLIENT_ID=<client-id>" -e "AZURE_TENANT_ID=<tenant-id>" -e "AZURE_CLIENT_SECRET=<secret>" toniblyx/prowler:v4-latest azure --sp-env-auth
## It also support other authentication types, check: prowler azure --help
Monkey365
Es ermöglicht, Sicherheitskonfigurationsprüfungen von Azure-Abonnements und Microsoft Entra ID automatisch durchzuführen.
Die HTML-Berichte werden im Verzeichnis ./monkey-reports im github repository folder gespeichert.
git clone https://github.com/silverhack/monkey365
Get-ChildItem -Recurse monkey365 | Unblock-File
cd monkey365
Import-Module ./monkey365
mkdir /tmp/monkey365-scan
cd /tmp/monkey365-scan
Get-Help Invoke-Monkey365
Get-Help Invoke-Monkey365 -Detailed
# Scan with user creds (browser will be run)
Invoke-Monkey365 -TenantId <tenant-id> -Instance Azure -Collect All -ExportTo HTML
# Scan with App creds
$SecureClientSecret = ConvertTo-SecureString "<secret>" -AsPlainText -Force
Invoke-Monkey365 -TenantId <tenant-id> -ClientId <client-id> -ClientSecret $SecureClientSecret -Instance Azure -Collect All -ExportTo HTML
ScoutSuite
Scout Suite sammelt Konfigurationsdaten zur manuellen Überprüfung und hebt Risikobereiche hervor. Es ist ein Multi-Cloud-Sicherheitsaudit-Tool, das die Bewertung der Sicherheitslage von Cloud-Umgebungen ermöglicht.
virtualenv -p python3 venv
source venv/bin/activate
pip install scoutsuite
scout --help
# Use --cli flag to use az cli credentials
# Use --user-account to have scout prompt for user credentials
# Use --user-account-browser to launch a browser to login
# Use --service-principal to have scout prompt for app credentials
python scout.py azure --cli
Azure-MG-Sub-Governance-Reporting
Es ist ein powershell script, das Ihnen hilft, alle Ressourcen und Berechtigungen innerhalb einer Management Group und der Entra ID Tenant zu visualisieren und Sicherheitsfehlkonfigurationen zu finden.
Es verwendet das Az PowerShell module, sodass jede Authentifizierung, die von diesem Tool unterstützt wird, funktioniert.
import-module Az
.\AzGovVizParallel.ps1 -ManagementGroupId <management-group-id> [-SubscriptionIdWhitelist <subscription-id>]
Automatisierte Post-Exploitation-Tools
ROADRecon
Die enumeration von ROADRecon liefert Informationen über die Konfiguration von Entra ID, wie Benutzer, Gruppen, Rollen, conditional access policies…
cd ROADTools
pipenv shell
# Login with user creds
roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
# Login with app creds
roadrecon auth --as-app --client "<client-id>" --password "<secret>" --tenant "<tenant-id>"
roadrecon gather
roadrecon gui
AzureHound
AzureHound ist der BloodHound-Collector für Microsoft Entra ID und Azure. Es ist ein einzelnes statisches Go-Binary für Windows/Linux/macOS, das direkt mit folgenden Diensten kommuniziert:
- Microsoft Graph (Entra ID directory, M365) und
- Azure Resource Manager (ARM) Control Plane (subscriptions, resource groups, compute, storage, key vault, app services, AKS, etc.)
Wesentliche Merkmale
- Läuft von überall im öffentlichen Internet gegen Tenant-APIs (kein Zugriff auf internes Netzwerk erforderlich)
- Gibt JSON für die Ingestion in BloodHound CE aus, um Angriffswege über Identitäten und Cloud-Ressourcen zu visualisieren
- Beobachteter Standard-User-Agent: azurehound/v2.x.x
Authentifizierungsoptionen
- Benutzername + Passwort: -u
-p - Refresh-Token: –refresh-token
- JSON Web Token (Access-Token): –jwt
- Service principal secret: -a
-s - Service principal certificate: -a
–cert <cert.pem> –key <key.pem> [–keypass ]
Beispiele
# Full tenant collection to file using different auth flows
## User creds
azurehound list -u "<user>@<tenant>" -p "<pass>" -t "<tenant-id|domain>" -o ./output.json
## Use an access token (JWT) from az cli for Graph
JWT=$(az account get-access-token --resource https://graph.microsoft.com -o tsv --query accessToken)
azurehound list --jwt "$JWT" -t "<tenant-id>" -o ./output.json
## Use a refresh token (e.g., from device code flow)
azurehound list --refresh-token "<refresh_token>" -t "<tenant-id>" -o ./output.json
## Service principal secret
azurehound list -a "<client-id>" -s "<secret>" -t "<tenant-id>" -o ./output.json
## Service principal certificate
azurehound list -a "<client-id>" --cert "/path/cert.pem" --key "/path/key.pem" -t "<tenant-id>" -o ./output.json
# Targeted discovery
azurehound list users -t "<tenant-id>" -o users.json
azurehound list groups -t "<tenant-id>" -o groups.json
azurehound list roles -t "<tenant-id>" -o roles.json
azurehound list role-assignments -t "<tenant-id>" -o role-assignments.json
# Azure resources via ARM
azurehound list subscriptions -t "<tenant-id>" -o subs.json
azurehound list resource-groups -t "<tenant-id>" -o rgs.json
azurehound list virtual-machines -t "<tenant-id>" -o vms.json
azurehound list key-vaults -t "<tenant-id>" -o kv.json
azurehound list storage-accounts -t "<tenant-id>" -o sa.json
azurehound list storage-containers -t "<tenant-id>" -o containers.json
azurehound list web-apps -t "<tenant-id>" -o webapps.json
azurehound list function-apps -t "<tenant-id>" -o funcapps.json
Was abgefragt wird
- Graph Endpunkte (Beispiele):
- /v1.0/organization, /v1.0/users, /v1.0/groups, /v1.0/roleManagement/directory/roleDefinitions, directoryRoles, owners/members
- ARM Endpunkte (Beispiele):
- management.azure.com/subscriptions/…/providers/Microsoft.Storage/storageAccounts
- …/Microsoft.KeyVault/vaults, …/Microsoft.Compute/virtualMachines, …/Microsoft.Web/sites, …/Microsoft.ContainerService/managedClusters
Preflight behavior and endpoints
- Jeder azurehound list
- Identity platform: login.microsoftonline.com
- Graph: GET https://graph.microsoft.com/v1.0/organization
- ARM: GET https://management.azure.com/subscriptions?api-version=…
- Die Basis-URLs der Cloud-Umgebungen unterscheiden sich für Government/China/Germany. Siehe constants/environments.go im Repo.
ARM-lastige Objekte (weniger sichtbar in Activity/Resource Logs)
- Die folgenden Zieltypen verwenden überwiegend ARM control-plane Leseoperationen: automation-accounts, container-registries, function-apps, key-vaults, logic-apps, managed-clusters, management-groups, resource-groups, storage-accounts, storage-containers, virtual-machines, vm-scale-sets, web-apps.
- Diese GET-/List-Operationen werden typischerweise nicht in Activity Logs geschrieben; data-plane reads (z. B. *.blob.core.windows.net, *.vault.azure.net) werden durch Diagnostic Settings auf Ressourcenniveau abgedeckt.
OPSEC und Logging-Hinweise
- Microsoft Graph Activity Logs sind nicht standardmäßig aktiviert; aktiviere und exportiere sie an ein SIEM, um Graph-Aufrufe sichtbar zu machen. Erwarte den Graph preflight GET /v1.0/organization mit UA azurehound/v2.x.x.
- Entra ID non-interactive sign-in logs zeichnen die Identity platform Authentifizierung (login.microsoftonline.com) auf, die von AzureHound verwendet wird.
- ARM control-plane read/list-Operationen werden nicht in Activity Logs protokolliert; viele azurehound list-Operationen gegen Ressourcen erscheinen dort nicht. Nur data-plane Logging (über Diagnostic Settings) erfasst Lesezugriffe auf Service-Endpunkte.
- Defender XDR GraphApiAuditEvents (preview) kann Graph-Aufrufe und Token-Identifikatoren offenlegen, fehlt aber möglicherweise der UserAgent und hat eine begrenzte Aufbewahrungsdauer.
Tipp: Beim Aufspüren von Privilegienpfaden zuerst Users, Groups, Roles und Role Assignments ausgeben, dann in BloodHound importieren und vorgefertigte cypher-Queries nutzen, um Global Administrator/Privileged Role Administrator und transitive Eskalationen über verschachtelte Gruppen und RBAC-Zuweisungen sichtbar zu machen.
Starte die BloodHound-Weboberfläche mit curl -L https://ghst.ly/getbhce | docker compose -f - up und importiere die Datei output.json. In der EXPLORE-Registerkarte findest du im CYPHER-Bereich ein Ordnersymbol mit vorgefertigten Queries.
MicroBurst
MicroBurst enthält Funktionen und Skripte, die Azure Services discovery, weak configuration auditing und post exploitation Aktionen wie credential dumping unterstützen. Es ist dafür gedacht, während penetration tests eingesetzt zu werden, bei denen Azure verwendet wird.
Import-Module .\MicroBurst.psm1
Import-Module .\Get-AzureDomainInfo.ps1
Get-AzureDomainInfo -folder MicroBurst -Verbose
PowerZure
PowerZure wurde aus dem Bedarf an einem Framework geschaffen, das sowohl reconnaissance als auch exploitation von Azure, EntraID und den zugehörigen Ressourcen durchführen kann.
Es verwendet das Az PowerShell-Modul, sodass jede Authentifizierung, die dieses Modul unterstützt, auch vom Tool unterstützt wird.
# Login
Import-Module Az
Connect-AzAccount
# Clone and import PowerZure
git clone https://github.com/hausec/PowerZure
cd PowerZure
ipmo ./Powerzure.psd1
Invoke-Powerzure -h # Check all the options
# Info Gathering (read)
Get-AzureCurrentUser # Get current user
Get-AzureTarget # What can you access to
Get-AzureUser -All # Get all users
Get-AzureSQLDB -All # Get all SQL DBs
Get-AzureAppOwner # Owners of apps in Entra
Show-AzureStorageContent -All # List containers, shared and tables
Show-AzureKeyVaultContent -All # List all contents in key vaults
# Operational (write)
Set-AzureUserPassword -Password <password> -Username <username> # Change password
Set-AzureElevatedPrivileges # Get permissions from Global Administrator in EntraID to User Access Administrator in Azure RBAC.
New-AzureBackdoor -Username <username> -Password <password>
Invoke-AzureRunCommand -Command <command> -VMName <vmname>
[...]
GraphRunner
GraphRunner ist ein post-exploitation-Toolset zur Interaktion mit der Microsoft Graph API. Es stellt verschiedene Werkzeuge bereit, um reconnaissance, persistence und pillaging von Daten aus einem Microsoft Entra ID (Azure AD) account durchzuführen.
#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)
Import-Module .\GraphRunner.ps1
Get-GraphTokens
#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.
Invoke-GraphRecon -Tokens $tokens -PermissionEnum
#A module to dump conditional access policies from a tenant.
Invoke-GraphRecon -Tokens $tokens -PermissionEnum
#A module to dump conditional access policies from a tenant.
Invoke-DumpCAPS -Tokens $tokens -ResolveGuids
#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.
Invoke-DumpApps -Tokens $tokens
#Gather the full list of users from the directory.
Get-AzureADUsers -Tokens $tokens -OutFile users.txt
#Create a list of security groups along with their members.
Get-SecurityGroups -AccessToken $tokens.access_token
#Gets groups that may be able to be modified by the current user
Get-UpdatableGroups -Tokens $tokens
#Finds dynamic groups and displays membership rules
Get-DynamicGroups -Tokens $tokens
#Gets a list of SharePoint site URLs visible to the current user
Get-SharePointSiteURLs -Tokens $tokens
#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.
Invoke-GraphOpenInboxFinder -Tokens $tokens -Userlist users.txt
#This module attempts to gather a tenant ID associated with a domain.
Get-TenantID -Domain
#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.
Invoke-GraphRunner -Tokens $tokens
Stormspotter
Stormspotter erstellt einen “attack graph” der Ressourcen in einer Azure subscription. Es ermöglicht red teams und pentesters, die attack surface und pivot opportunities innerhalb eines tenant zu visualisieren und unterstützt Ihre defenders dabei, sich schnell zu orientieren und incident response work zu priorisieren.
Leider scheint es nicht mehr gepflegt zu werden.
# Start Backend
cd stormspotter\backend\
pipenv shell
python ssbackend.pyz
# Start Front-end
cd stormspotter\frontend\dist\spa\
quasar.cmd serve -p 9091 --history
# Run Stormcollector
cd stormspotter\stormcollector\
pipenv shell
az login -u test@corp.onmicrosoft.com -p Welcome2022!
python stormspotter\stormcollector\sscollector.pyz cli
# This will generate a .zip file to upload in the frontend (127.0.0.1:9091)
Referenzen
- Cloud Discovery mit AzureHound (Unit 42)
- AzureHound-Repository
- BloodHound-Repository
- AzureHound Community Edition Flags
- AzureHound constants/environments.go
- AzureHound client/storage_accounts.go
- AzureHound client/roles.go
Tip
Lernen & üben Sie AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Lernen & üben Sie GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Lernen & üben Sie Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Unterstützen Sie HackTricks
- Überprüfen Sie die Abonnementpläne!
- Treten Sie der 💬 Discord-Gruppe oder der Telegram-Gruppe bei oder folgen Sie uns auf Twitter 🐦 @hacktricks_live.
- Teilen Sie Hacking-Tricks, indem Sie PRs an die HackTricks und HackTricks Cloud GitHub-Repos senden.
HackTricks Cloud

