Az - Enumeration Tools
Tip
Μάθετε & εξασκηθείτε στο AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Δείτε τα subscription plans!
- Εγγραφείτε στο 💬 Discord group ή την telegram group ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
Εγκατάσταση PowerShell σε linux
Tip
Σε linux θα χρειαστεί να εγκαταστήσετε το PowerShell Core:
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 σε MacOS
Οδηγίες από την documentation:
- Εγκαταστήστε
brewαν δεν είναι ήδη εγκατεστημένο:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Εγκαταστήστε την τελευταία σταθερή έκδοση του PowerShell:
brew install powershell/tap/powershell
- Εκτέλεσε το PowerShell:
pwsh
- Ενημέρωση:
brew update
brew upgrade powershell
Κύρια εργαλεία αναγνώρισης
az cli
Azure Command-Line Interface (CLI) είναι ένα πολυπλατφορμικό εργαλείο γραμμένο σε Python για τη διαχείριση και τη διοίκηση (των περισσότερων) πόρων του Azure και του Entra ID. Συνδέεται στο Azure και εκτελεί διοικητικές εντολές μέσω της γραμμής εντολών ή σεναρίων.
Follow this link for the installation instructions¡.
Commands in Azure CLI are structured using a pattern of: az <service> <action> <parameters>
Debug | MitM az cli
Χρησιμοποιώντας την παράμετρο --debug είναι δυνατό να δείτε όλες τις αιτήσεις που το εργαλείο az στέλνει:
az account management-group list --output table --debug
Για να κάνετε ένα MitM στο εργαλείο και να ελέγξετε χειροκίνητα όλα τα αιτήματα που στέλνει, μπορείτε να κάνετε:
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
Fixing “CA cert does not include key usage extension”
Γιατί συμβαίνει το σφάλμα
Όταν το Azure CLI κάνει έλεγχο ταυτότητας, πραγματοποιεί αιτήσεις HTTPS (μέσω MSAL → Requests → OpenSSL). Αν υποκλέπτετε TLS με Burp, το Burp δημιουργεί «επί τόπου» πιστοποιητικά για ιστότοπους όπως login.microsoftonline.com και τα υπογράφει με το CA του Burp.
Σε νεότερες στοίβες (Python 3.13 + OpenSSL 3), η επικύρωση των CA είναι πιο αυστηρή:
- Ένα πιστοποιητικό CA πρέπει να περιλαμβάνει Basic Constraints:
CA:TRUEκαι μια επέκταση Key Usage που επιτρέπει την υπογραφή πιστοποιητικών (keyCertSign, και συνήθωςcRLSign).
Το προεπιλεγμένο CA του Burp (PortSwigger CA) είναι παλιό και συνήθως δεν περιέχει την επέκταση Key Usage, οπότε το OpenSSL το απορρίπτει ακόμα κι αν το «εμπιστεύεστε».
Αυτό προκαλεί σφάλματα όπως:
CA cert does not include key usage extensionCERTIFICATE_VERIFY_FAILEDself-signed certificate in certificate chain
Άρα πρέπει να:
- Δημιουργήσετε ένα σύγχρονο CA (με σωστή Key Usage).
- Κάνετε το Burp να το χρησιμοποιεί για την υπογραφή των υποκλεμμένων πιστοποιητικών.
- Εμπιστευτείτε αυτό το CA στο macOS.
- Κατευθύνετε το Azure CLI / Requests στο εν λόγω CA bundle.
Βήμα-βήμα: λειτουργική διαμόρφωση
0) Προαπαιτούμενα
- Burp τρέχον τοπικά (proxy στο
127.0.0.1:8080) - Azure CLI εγκατεστημένο (Homebrew)
- Έχετε πρόσβαση σε
sudo(για να εμπιστευτείτε το CA στο keychain του συστήματος)
1) Create a standards-compliant Burp CA (PEM + KEY)
Create an OpenSSL config file that explicitly sets CA extensions:
mkdir -p ~/burp-ca && cd ~/burp-ca
cat > burp-ca.cnf <<'EOF'
[ req ]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
x509_extensions = v3_ca
[ dn ]
C = US
O = Burp Custom CA
CN = Burp Custom Root CA
[ v3_ca ]
basicConstraints = critical,CA:TRUE
keyUsage = critical,keyCertSign,cRLSign
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
EOF
Δημιουργήστε το πιστοποιητικό CA + το ιδιωτικό κλειδί:
openssl req -x509 -new -nodes \
-days 3650 \
-keyout burp-ca.key \
-out burp-ca.pem \
-config burp-ca.cnf
Έλεγχος ορθότητας (ΠΡΕΠΕΙ ΟΠΩΣΔΗΠΟΤΕ να δείτε Key Usage):
openssl x509 -in burp-ca.pem -noout -text | egrep -A3 "Basic Constraints|Key Usage"
Αναμένεται να περιλαμβάνει κάτι σαν:
CA:TRUEKey Usage: ... Certificate Sign, CRL Sign
2) Μετατροπή σε PKCS#12 (μορφή εισαγωγής Burp)
Το Burp χρειάζεται certificate + private key, πιο εύκολα ως PKCS#12:
openssl pkcs12 -export \
-out burp-ca.p12 \
-inkey burp-ca.key \
-in burp-ca.pem \
-name "Burp Custom Root CA"
Θα σας ζητηθεί κωδικός εξαγωγής (ορίστε έναν· ο Burp θα τον ζητήσει).
3) Εισαγωγή της CA στο Burp και επανεκκίνηση του Burp
Στον Burp:
- Proxy → Options
- Find Import / export CA certificate
- Click Import CA certificate
- Choose PKCS#12
- Select
burp-ca.p12 - Εισάγετε τον κωδικό
- Επανεκκινήστε πλήρως τον Burp (σημαντικό)
Γιατί επανεκκίνηση; Ο Burp μπορεί να συνεχίσει να χρησιμοποιεί την παλιά CA μέχρι να επανεκκινηθεί.
4) Εμπιστευτείτε τη νέα CA στο macOS system keychain
Αυτό επιτρέπει στις εφαρμογές συστήματος και σε πολλές στοίβες TLS να εμπιστεύονται την CA.
sudo security add-trusted-cert \
-d -r trustRoot \
-k /Library/Keychains/System.keychain \
~/burp-ca/burp-ca.pem
(Εάν προτιμάτε GUI: Keychain Access → System → Certificates → import → set “Always Trust”.)
5) Διαμόρφωση μεταβλητών περιβάλλοντος proxy
export HTTPS_PROXY="http://127.0.0.1:8080"
export HTTP_PROXY="http://127.0.0.1:8080"
6) Ρυθμίστε τα Requests/Azure CLI ώστε να εμπιστεύονται το Burp CA
Azure CLI uses Python Requests internally; ορίστε και τα δύο παρακάτω:
export REQUESTS_CA_BUNDLE="$HOME/burp-ca/burp-ca.pem"
export SSL_CERT_FILE="$HOME/burp-ca/burp-ca.pem"
Σημειώσεις:
REQUESTS_CA_BUNDLEχρησιμοποιείται από Requests.SSL_CERT_FILEβοηθάει άλλους καταναλωτές TLS και σε ειδικές περιπτώσεις.- Συνήθως δεν χρειάζεστε πλέον το παλιό
ADAL_PYTHON_SSL_NO_VERIFY/AZURE_CLI_DISABLE_CONNECTION_VERIFICATIONόταν το CA είναι σωστό.
7) Επαληθεύστε ότι το Burp υπογράφει πραγματικά με το νέο σας CA (κρίσιμος έλεγχος)
Αυτό επιβεβαιώνει ότι η αλυσίδα υποκλοπής σας είναι σωστή:
openssl s_client -connect login.microsoftonline.com:443 \
-proxy 127.0.0.1:8080 </dev/null 2>/dev/null \
| openssl x509 -noout -issuer
Ο αναμενόμενος εκδότης περιέχει το όνομα της CA σας, π.χ.:
O=Burp Custom CA, CN=Burp Custom Root CA
Αν εξακολουθείτε να βλέπετε PortSwigger CA, το Burp δεν χρησιμοποιεί την εισαγόμενη CA σας → ελέγξτε ξανά την εισαγωγή και επανεκκινήστε.
8) Επαληθεύστε ότι Python Requests λειτουργεί μέσω Burp
python3 - <<'EOF'
import requests
requests.get("https://login.microsoftonline.com")
print("OK")
EOF
Αναμενόμενο: OK
9) Δοκιμή Azure CLI
az account get-access-token --resource=https://management.azure.com/
Αν είστε ήδη συνδεδεμένοι, θα πρέπει να επιστρέφει JSON με ένα accessToken.
Az PowerShell
Azure PowerShell είναι ένα module με cmdlets για τη διαχείριση των Azure resources απευθείας από τη γραμμή εντολών του PowerShell.
Follow this link for the installation instructions.
Οι εντολές στο Azure PowerShell AZ Module δομούνται ως εξής: <Action>-Az<Service> <parameters>
Debug | MitM Az PowerShell
Χρησιμοποιώντας την παράμετρο -Debug είναι δυνατό να δείτε όλα τα αιτήματα που στέλνει το εργαλείο:
Get-AzResourceGroup -Debug
Για να πραγματοποιήσετε ένα MitM στο εργαλείο και να ελέγξετε χειροκίνητα όλα τα αιτήματα που αποστέλλει, μπορείτε να ορίσετε τις μεταβλητές περιβάλλοντος HTTPS_PROXY και HTTP_PROXY σύμφωνα με τα docs.
Microsoft Graph PowerShell
Το Microsoft Graph PowerShell είναι ένα cross-platform SDK που επιτρέπει την πρόσβαση σε όλα τα Microsoft Graph APIs, συμπεριλαμβανομένων υπηρεσιών όπως SharePoint, Exchange και Outlook, χρησιμοποιώντας ένα ενιαίο endpoint. Υποστηρίζει PowerShell 7+, σύγχρονη αυθεντικοποίηση μέσω MSAL, εξωτερικές ταυτότητες και προηγμένα ερωτήματα. Με έμφαση στην αρχή των ελάχιστων προνομίων, διασφαλίζει ασφαλείς λειτουργίες και λαμβάνει τακτικές ενημερώσεις ώστε να ευθυγραμμίζεται με τις τελευταίες δυνατότητες του Microsoft Graph API.
Follow this link for the installation instructions.
Commands in Microsoft Graph PowerShell are structured like: <Action>-Mg<Service> <parameters>
Αποσφαλμάτωση Microsoft Graph PowerShell
Χρησιμοποιώντας την παράμετρο -Debug είναι δυνατό να δείτε όλα τα αιτήματα που στέλνει το εργαλείο:
Get-MgUser -Debug
AzureAD Powershell
Το Azure Active Directory (AD) module, πλέον αποσυρμένο, αποτελεί μέρος του Azure PowerShell για τη διαχείριση των Azure AD resources. Παρέχει cmdlets για εργασίες όπως η διαχείριση χρηστών, ομάδων και εγγραφών εφαρμογών στο Entra ID.
Tip
Αυτό έχει αντικατασταθεί από το Microsoft Graph PowerShell
Ακολουθήστε αυτόν τον σύνδεσμο για τις οδηγίες εγκατάστασης.
Αυτοματοποιημένα εργαλεία Recon & Compliance
turbot azure plugins
Turbot με steampipe και powerpipe επιτρέπει τη συλλογή πληροφοριών από Azure και Entra ID και την εκτέλεση ελέγχων συμμόρφωσης καθώς και την εύρεση κακοδιαμορφώσεων. Τα προς το παρόν πιο συνιστώμενα Azure modules για εκτέλεση είναι:
- 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 είναι ένα Open Source εργαλείο ασφάλειας για την εκτέλεση αξιολογήσεων best practices ασφάλειας, audits, incident response, continuous monitoring, hardening και forensics readiness για AWS, Azure, Google Cloud και Kubernetes.
Βασικά μας επιτρέπει να τρέξουμε εκατοντάδες checks σε ένα περιβάλλον Azure για να εντοπίσουμε security misconfigurations και να συλλέξουμε τα αποτελέσματα σε json (και άλλες μορφές κειμένου) ή να τα ελέγξουμε μέσω web.
# 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
Επιτρέπει την αυτόματη εκτέλεση ελέγχων/ανασκοπήσεων ασφαλείας και ρυθμίσεων για συνδρομές Azure και Microsoft Entra ID.
Οι αναφορές HTML αποθηκεύονται στον κατάλογο ./monkey-reports μέσα στο github repository folder.
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 συγκεντρώνει δεδομένα διαμόρφωσης για χειρωνακτική επιθεώρηση και επισημαίνει περιοχές κινδύνου. Είναι ένα multi-cloud security-auditing εργαλείο, που επιτρέπει την αξιολόγηση της security posture των cloud περιβαλλόντων.
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
Είναι ένα powershell script που σε βοηθά να απεικονίσεις όλους τους πόρους και τα δικαιώματα μέσα σε ένα Management Group και στον tenant του Entra ID και να εντοπίσεις λανθασμένες ρυθμίσεις ασφαλείας.
Λειτουργεί με το Az PowerShell module, οπότε οποιαδήποτε μέθοδος πιστοποίησης που υποστηρίζεται από αυτό το module υποστηρίζεται και από το εργαλείο.
import-module Az
.\AzGovVizParallel.ps1 -ManagementGroupId <management-group-id> [-SubscriptionIdWhitelist <subscription-id>]
Αυτοματοποιημένα Post-Exploitation εργαλεία
ROADRecon
Η enumeration του ROADRecon παρέχει πληροφορίες για τη διαμόρφωση του Entra ID, όπως χρήστες, ομάδες, ρόλοι και πολιτικές Conditional Access…
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 είναι ο συλλέκτης του BloodHound για το Microsoft Entra ID και το Azure. Είναι ένα ενιαίο στατικό Go binary για Windows/Linux/macOS που επικοινωνεί απευθείας με:
- Microsoft Graph (Entra ID directory, M365) και
- Azure Resource Manager (ARM) control plane (subscriptions, resource groups, compute, storage, key vault, app services, AKS, etc.)
Κύρια χαρακτηριστικά
- Τρέχει από οπουδήποτε στο δημόσιο Διαδίκτυο απέναντι σε tenant APIs (δεν απαιτείται πρόσβαση στο εσωτερικό δίκτυο)
- Εξάγει JSON για εισαγωγή στο BloodHound CE προκειμένου να οπτικοποιηθούν attack paths μεταξύ identities και cloud resources
- Παρατηρούμενο προεπιλεγμένο User-Agent: azurehound/v2.x.x
Επιλογές πιστοποίησης
- Όνομα χρήστη + κωδικός: -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 ]
Παραδείγματα
# 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
Τι αναζητείται
- Graph endpoints (παραδείγματα):
- /v1.0/organization, /v1.0/users, /v1.0/groups, /v1.0/roleManagement/directory/roleDefinitions, directoryRoles, owners/members
- ARM endpoints (παραδείγματα):
- management.azure.com/subscriptions/…/providers/Microsoft.Storage/storageAccounts
- …/Microsoft.KeyVault/vaults, …/Microsoft.Compute/virtualMachines, …/Microsoft.Web/sites, …/Microsoft.ContainerService/managedClusters
Συμπεριφορά preflight και endpoints
- Κάθε 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=…
- Οι βασικές URLs των cloud environments διαφέρουν για Government/China/Germany. Δείτε constants/environments.go στο repo.
ARM-heavy objects (λιγότερο ορατά στα Activity/Resource logs)
- Η παρακάτω λίστα στόχων χρησιμοποιεί κυρίως ARM control plane reads: 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.
- Αυτές οι GET/list λειτουργίες συνήθως δεν καταγράφονται στα Activity Logs· οι data-plane αναγνώσεις (π.χ., *.blob.core.windows.net, *.vault.azure.net) καλύπτονται από Diagnostic Settings στο επίπεδο πόρου.
Σημειώσεις OPSEC και καταγραφής
- Microsoft Graph Activity Logs δεν είναι ενεργοποιημένα από προεπιλογή· ενεργοποιήστε και εξάγετε σε SIEM για να αποκτήσετε ορατότητα στις κλήσεις Graph. Αναμένετε το Graph preflight GET /v1.0/organization με UA azurehound/v2.x.x.
- Τα Entra ID non-interactive sign-in logs καταγράφουν το identity platform auth (login.microsoftonline.com) που χρησιμοποιείται από AzureHound.
- Οι ARM control-plane read/list λειτουργίες δεν καταγράφονται στα Activity Logs· πολλές azurehound list ενέργειες εναντίον πόρων δεν θα εμφανιστούν εκεί. Μόνο η data-plane logging (μέσω Diagnostic Settings) θα καταγράψει αναγνώσεις σε service endpoints.
- Defender XDR GraphApiAuditEvents (preview) μπορεί να αποκαλύψει κλήσεις Graph και αναγνωριστικά token αλλά ίσως δεν περιέχει UserAgent και έχει περιορισμένη διάρκεια διατήρησης.
Συμβουλή: Όταν κάνετε enumeration για privilege paths, εξάγετε users, groups, roles και role assignments, εισάγετε στο BloodHound και χρησιμοποιήστε τις prebuilt cypher queries για να εντοπίσετε Global Administrator/Privileged Role Administrator και transitive escalation μέσω nested groups και RBAC assignments.
Εκκινήστε το BloodHound web με curl -L https://ghst.ly/getbhce | docker compose -f - up και εισάγετε το αρχείο output.json. Στη συνέχεια, στην καρτέλα EXPLORE, στην ενότητα CYPHER θα δείτε ένα εικονίδιο φακέλου που περιέχει pre-built queries.
MicroBurst
Το MicroBurst περιλαμβάνει functions και scripts που υποστηρίζουν Azure Services discovery, weak configuration auditing, και post exploitation ενέργειες όπως credential dumping. Προορίζεται για χρήση κατά τη διάρκεια penetration tests όπου χρησιμοποιείται Azure.
Import-Module .\MicroBurst.psm1
Import-Module .\Get-AzureDomainInfo.ps1
Get-AzureDomainInfo -folder MicroBurst -Verbose
PowerZure
PowerZure δημιουργήθηκε από την ανάγκη για ένα framework που μπορεί να πραγματοποιήσει τόσο reconnaissance όσο και exploitation του Azure, EntraID και των σχετικών πόρων.
Χρησιμοποιεί το Az PowerShell module, επομένως οποιαδήποτε authentication υποστηρίζεται από αυτό υποστηρίζεται και από το εργαλείο.
# 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 είναι ένα post-exploitation σύνολο εργαλείων για την αλληλεπίδραση με το Microsoft Graph API. Παρέχει διάφορα εργαλεία για τη διεξαγωγή reconnaissance, persistence και απόσπασης δεδομένων από έναν λογαριασμό Microsoft Entra ID (Azure AD).
#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 δημιουργεί ένα “attack graph” των πόρων σε μια Azure subscription. Επιτρέπει σε red teams και pentesters να οπτικοποιήσουν το attack surface και τις pivot opportunities εντός ενός tenant, και ενισχύει τους defenders σας ώστε να προσανατολιστούν γρήγορα και να δώσουν προτεραιότητα στην incident response εργασία.
Δυστυχώς, φαίνεται να μην συντηρείται.
# 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)
Αναφορές
- Cloud Discovery With 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
Μάθετε & εξασκηθείτε στο AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Δείτε τα subscription plans!
- Εγγραφείτε στο 💬 Discord group ή την telegram group ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
HackTricks Cloud

