mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-19 08:00:45 -08:00
Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/
This commit is contained in:
@@ -2,86 +2,85 @@
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
## Grundinformationen
|
||||
|
||||
{{#ref}}
|
||||
az-basic-information/
|
||||
{{#endref}}
|
||||
|
||||
## Azure Pentester/Red Team Methodology
|
||||
## Azure Pentester/Red Team Methodik
|
||||
|
||||
In order to audit an AZURE environment it's very important to know: which **services are being used**, what is **being exposed**, who has **access** to what, and how are internal Azure services and **external services** connected.
|
||||
Um eine AZURE-Umgebung zu auditieren, ist es sehr wichtig zu wissen: welche **Dienste verwendet werden**, was **exponiert** ist, wer **Zugriff** auf was hat und wie interne Azure-Dienste und **externe Dienste** verbunden sind.
|
||||
|
||||
From a Red Team point of view, the **first step to compromise an Azure environment** is to manage to obtain some **credentials** for Azure AD. Here you have some ideas on how to do that:
|
||||
Aus der Sicht des Red Teams ist der **erste Schritt zur Kompromittierung einer Azure-Umgebung**, einige **Anmeldeinformationen** für Azure AD zu erhalten. Hier sind einige Ideen, wie man das machen kann:
|
||||
|
||||
- **Leaks** in github (or similar) - OSINT
|
||||
- **Social** Engineering
|
||||
- **Password** reuse (password leaks)
|
||||
- Vulnerabilities in Azure-Hosted Applications
|
||||
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) with access to metadata endpoint
|
||||
- **Local File Read**
|
||||
- `/home/USERNAME/.azure`
|
||||
- `C:\Users\USERNAME\.azure`
|
||||
- The file **`accessTokens.json`** in `az cli` before 2.30 - Jan2022 - stored **access tokens in clear text**
|
||||
- The file **`azureProfile.json`** contains **info** about logged user.
|
||||
- **`az logout`** removes the token.
|
||||
- Older versions of **`Az PowerShell`** stored **access tokens** in **clear** text in **`TokenCache.dat`**. It also stores **ServicePrincipalSecret** in **clear**-text in **`AzureRmContext.json`**. The cmdlet **`Save-AzContext`** can be used to **store** **tokens**.\
|
||||
Use `Disconnect-AzAccount` to remove them.
|
||||
- 3rd parties **breached**
|
||||
- **Internal** Employee
|
||||
- [**Common Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (credentials or Oauth App)
|
||||
- [Device Code Authentication Phishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md)
|
||||
- **Leaks** in github (oder ähnlichem) - OSINT
|
||||
- **Soziale** Ingenieurkunst
|
||||
- **Passwort**-Wiederverwendung (Passwort-Leaks)
|
||||
- Schwachstellen in Azure-gehosteten Anwendungen
|
||||
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) mit Zugriff auf den Metadaten-Endpunkt
|
||||
- **Lokales Datei Lesen**
|
||||
- `/home/USERNAME/.azure`
|
||||
- `C:\Users\USERNAME\.azure`
|
||||
- Die Datei **`accessTokens.json`** in `az cli` vor 2.30 - Jan2022 - speicherte **Zugriffstoken im Klartext**
|
||||
- Die Datei **`azureProfile.json`** enthält **Informationen** über den angemeldeten Benutzer.
|
||||
- **`az logout`** entfernt das Token.
|
||||
- Ältere Versionen von **`Az PowerShell`** speicherten **Zugriffstoken** im **Klartext** in **`TokenCache.dat`**. Es speichert auch **ServicePrincipalSecret** im **Klartext** in **`AzureRmContext.json`**. Das Cmdlet **`Save-AzContext`** kann verwendet werden, um **Token** zu **speichern**.\
|
||||
Verwenden Sie `Disconnect-AzAccount`, um sie zu entfernen.
|
||||
- 3rd Party **gehackt**
|
||||
- **Interner** Mitarbeiter
|
||||
- [**Häufiges Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (Anmeldeinformationen oder Oauth-App)
|
||||
- [Gerätekodenauthentifizierungsphishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md)
|
||||
- [Azure **Password Spraying**](az-unauthenticated-enum-and-initial-entry/az-password-spraying.md)
|
||||
|
||||
Even if you **haven't compromised any user** inside the Azure tenant you are attacking, you can **gather some information** from it:
|
||||
Selbst wenn Sie **keinen Benutzer** innerhalb des Azure-Mieters, den Sie angreifen, kompromittiert haben, können Sie **einige Informationen** daraus sammeln:
|
||||
|
||||
{{#ref}}
|
||||
az-unauthenticated-enum-and-initial-entry/
|
||||
{{#endref}}
|
||||
|
||||
> [!NOTE]
|
||||
> After you have managed to obtain credentials, you need to know **to who do those creds belong**, and **what they have access to**, so you need to perform some basic enumeration:
|
||||
> Nachdem Sie es geschafft haben, Anmeldeinformationen zu erhalten, müssen Sie wissen, **wem diese Anmeldeinformationen gehören** und **auf was sie Zugriff haben**, daher müssen Sie einige grundlegende Aufzählungen durchführen:
|
||||
|
||||
## Basic Enumeration
|
||||
## Grundlegende Aufzählung
|
||||
|
||||
> [!NOTE]
|
||||
> Remember that the **noisiest** part of the enumeration is the **login**, not the enumeration itself.
|
||||
> Denken Sie daran, dass der **lauteste** Teil der Aufzählung das **Login** ist, nicht die Aufzählung selbst.
|
||||
|
||||
### SSRF
|
||||
|
||||
If you found a SSRF in a machine inside Azure check this page for tricks:
|
||||
Wenn Sie ein SSRF auf einer Maschine innerhalb von Azure gefunden haben, überprüfen Sie diese Seite auf Tricks:
|
||||
|
||||
{{#ref}}
|
||||
https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf
|
||||
{{#endref}}
|
||||
|
||||
### Bypass Login Conditions
|
||||
### Umgehung von Anmeldebedingungen
|
||||
|
||||
<figure><img src="../../images/image (268).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
In cases where you have some valid credentials but you cannot login, these are some common protections that could be in place:
|
||||
In Fällen, in denen Sie einige gültige Anmeldeinformationen haben, aber sich nicht anmelden können, sind dies einige gängige Schutzmaßnahmen, die vorhanden sein könnten:
|
||||
|
||||
- **IP whitelisting** -- You need to compromise a valid IP
|
||||
- **Geo restrictions** -- Find where the user lives or where are the offices of the company and get a IP from the same city (or contry at least)
|
||||
- **Browser** -- Maybe only a browser from certain OS (Windows, Linux, Mac, Android, iOS) is allowed. Find out which OS the victim/company uses.
|
||||
- You can also try to **compromise Service Principal credentials** as they usually are less limited and its login is less reviewed
|
||||
- **IP-Whitelist** -- Sie müssen eine gültige IP kompromittieren
|
||||
- **Geo-Beschränkungen** -- Finden Sie heraus, wo der Benutzer lebt oder wo die Büros des Unternehmens sind, und erhalten Sie eine IP aus derselben Stadt (oder zumindest demselben Land)
|
||||
- **Browser** -- Vielleicht ist nur ein Browser von einem bestimmten OS (Windows, Linux, Mac, Android, iOS) erlaubt. Finden Sie heraus, welches OS das Opfer/das Unternehmen verwendet.
|
||||
- Sie können auch versuchen, **Service Principal-Anmeldeinformationen** zu kompromittieren, da diese normalerweise weniger eingeschränkt sind und ihr Login weniger überprüft wird.
|
||||
|
||||
After bypassing it, you might be able to get back to your initial setup and you will still have access.
|
||||
Nachdem Sie dies umgangen haben, sollten Sie in der Lage sein, zu Ihrem ursprünglichen Setup zurückzukehren und weiterhin Zugriff zu haben.
|
||||
|
||||
### Subdomain Takeover
|
||||
### Subdomain-Übernahme
|
||||
|
||||
- [https://godiego.co/posts/STO-Azure/](https://godiego.co/posts/STO-Azure/)
|
||||
|
||||
### Whoami
|
||||
|
||||
> [!CAUTION]
|
||||
> Learn **how to install** az cli, AzureAD and Az PowerShell in the [**Az - Entra ID**](az-services/az-azuread.md) section.
|
||||
> Lernen Sie, **wie man** az cli, AzureAD und Az PowerShell im Abschnitt [**Az - Entra ID**](az-services/az-azuread.md) installiert.
|
||||
|
||||
One of the first things you need to know is **who you are** (in which environment you are):
|
||||
Eine der ersten Dinge, die Sie wissen müssen, ist **wer Sie sind** (in welcher Umgebung Sie sich befinden):
|
||||
|
||||
{{#tabs }}
|
||||
{{#tab name="az cli" }}
|
||||
|
||||
```bash
|
||||
az account list
|
||||
az account tenant list # Current tenant info
|
||||
@@ -90,22 +89,18 @@ az ad signed-in-user show # Current signed-in user
|
||||
az ad signed-in-user list-owned-objects # Get owned objects by current user
|
||||
az account management-group list #Not allowed by default
|
||||
```
|
||||
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="AzureAD" }}
|
||||
|
||||
```powershell
|
||||
#Get the current session state
|
||||
Get-AzureADCurrentSessionInfo
|
||||
#Get details of the current tenant
|
||||
Get-AzureADTenantDetail
|
||||
```
|
||||
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
|
||||
```powershell
|
||||
# Get the information about the current context (Account, Tenant, Subscription etc.)
|
||||
Get-AzContext
|
||||
@@ -121,53 +116,49 @@ Get-AzResource
|
||||
Get-AzRoleAssignment # For all users
|
||||
Get-AzRoleAssignment -SignInName test@corp.onmicrosoft.com # For current user
|
||||
```
|
||||
|
||||
{{#endtab }}
|
||||
{{#endtabs }}
|
||||
|
||||
> [!CAUTION]
|
||||
> Oone of the most important commands to enumerate Azure is **`Get-AzResource`** from Az PowerShell as it lets you **know the resources your current user has visibility over**.
|
||||
> Eines der wichtigsten Befehle zur Auflistung von Azure ist **`Get-AzResource`** von Az PowerShell, da er Ihnen **zeigt, über welche Ressourcen Ihr aktueller Benutzer Sichtbarkeit hat**.
|
||||
>
|
||||
> 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"
|
||||
> Sie können die gleichen Informationen in der **Webkonsole** erhalten, indem Sie zu [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) gehen oder nach "Alle Ressourcen" suchen.
|
||||
|
||||
### ENtra ID Enumeration
|
||||
### ENtra ID Auflistung
|
||||
|
||||
By default, any user should have **enough permissions to enumerate** things such us, users, groups, roles, service principals... (check [default AzureAD permissions](az-basic-information/#default-user-permissions)).\
|
||||
You can find here a guide:
|
||||
Standardmäßig sollte jeder Benutzer **ausreichende Berechtigungen haben, um** Dinge wie Benutzer, Gruppen, Rollen, Dienstprinzipale... aufzulisten (siehe [Standard AzureAD-Berechtigungen](az-basic-information/#default-user-permissions)).\
|
||||
Hier finden Sie einen Leitfaden:
|
||||
|
||||
{{#ref}}
|
||||
az-services/az-azuread.md
|
||||
{{#endref}}
|
||||
|
||||
> [!NOTE]
|
||||
> Now that you **have some information about your credentials** (and if you are a red team hopefully you **haven't been detected**). It's time to figure out which services are being used in the environment.\
|
||||
> In the following section you can check some ways to **enumerate some common services.**
|
||||
> Jetzt, da Sie **einige Informationen über Ihre Anmeldeinformationen haben** (und wenn Sie ein Rote-Team sind, hoffen wir, dass Sie **nicht entdeckt wurden**). Es ist an der Zeit herauszufinden, welche Dienste in der Umgebung verwendet werden.\
|
||||
> Im folgenden Abschnitt können Sie einige Möglichkeiten überprüfen, um **einige gängige Dienste aufzulisten.**
|
||||
|
||||
## App Service SCM
|
||||
|
||||
Kudu console to log in to the App Service 'container'.
|
||||
Kudu-Konsole, um sich im App Service 'Container' anzumelden.
|
||||
|
||||
## Webshell
|
||||
|
||||
Use portal.azure.com and select the shell, or use shell.azure.com, for a bash or powershell. The 'disk' of this shell are stored as an image file in a storage-account.
|
||||
Verwenden Sie portal.azure.com und wählen Sie die Shell aus, oder verwenden Sie shell.azure.com für eine Bash- oder PowerShell. Der 'Disk' dieser Shell wird als Bilddatei in einem Speicherkonto gespeichert.
|
||||
|
||||
## Azure DevOps
|
||||
|
||||
Azure DevOps is separate from Azure. It has repositories, pipelines (yaml or release), boards, wiki, and more. Variable Groups are used to store variable values and secrets.
|
||||
Azure DevOps ist von Azure getrennt. Es hat Repositories, Pipelines (yaml oder Release), Boards, Wiki und mehr. Variablengruppen werden verwendet, um Variablenwerte und Geheimnisse zu speichern.
|
||||
|
||||
## Debug | MitM az cli
|
||||
|
||||
Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending:
|
||||
|
||||
Mit dem Parameter **`--debug`** ist es möglich, alle Anfragen zu sehen, die das Tool **`az`** sendet:
|
||||
```bash
|
||||
az account management-group list --output table --debug
|
||||
```
|
||||
|
||||
In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do:
|
||||
Um einen **MitM** auf das Tool durchzuführen und **alle Anfragen**, die es manuell sendet, zu überprüfen, kannst du Folgendes tun:
|
||||
|
||||
{{#tabs }}
|
||||
{{#tab name="Bash" }}
|
||||
|
||||
```bash
|
||||
export ADAL_PYTHON_SSL_NO_VERIFY=1
|
||||
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
|
||||
@@ -180,25 +171,21 @@ export HTTP_PROXY="http://127.0.0.1:8080"
|
||||
openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM
|
||||
export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem
|
||||
```
|
||||
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="PS" }}
|
||||
|
||||
```bash
|
||||
$env:ADAL_PYTHON_SSL_NO_VERIFY=1
|
||||
$env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
|
||||
$env:HTTPS_PROXY="http://127.0.0.1:8080"
|
||||
$env:HTTP_PROXY="http://127.0.0.1:8080"
|
||||
```
|
||||
|
||||
{{#endtab }}
|
||||
{{#endtabs }}
|
||||
|
||||
## Automated Recon Tools
|
||||
## Automatisierte Recon-Tools
|
||||
|
||||
### [**ROADRecon**](https://github.com/dirkjanm/ROADtools)
|
||||
|
||||
```powershell
|
||||
cd ROADTools
|
||||
pipenv shell
|
||||
@@ -206,9 +193,7 @@ roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
|
||||
roadrecon gather
|
||||
roadrecon gui
|
||||
```
|
||||
|
||||
### [Monkey365](https://github.com/silverhack/monkey365)
|
||||
|
||||
```powershell
|
||||
Import-Module monkey365
|
||||
Get-Help Invoke-Monkey365
|
||||
@@ -216,9 +201,7 @@ Get-Help Invoke-Monkey365 -Detailed
|
||||
Invoke-Monkey365 -IncludeEntraID -ExportTo HTML -Verbose -Debug -InformationAction Continue
|
||||
Invoke-Monkey365 - Instance Azure -Analysis All -ExportTo HTML
|
||||
```
|
||||
|
||||
### [**Stormspotter**](https://github.com/Azure/Stormspotter)
|
||||
|
||||
```powershell
|
||||
# Start Backend
|
||||
cd stormspotter\backend\
|
||||
@@ -236,9 +219,7 @@ 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)
|
||||
```
|
||||
|
||||
### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound)
|
||||
|
||||
```powershell
|
||||
# You need to use the Az PowerShell and Azure AD modules:
|
||||
$passwd = ConvertTo-SecureString "Welcome2022!" -AsPlainText -Force
|
||||
@@ -294,9 +275,7 @@ MATCH p=(m:User)-[r:AZResetPassword|AZOwns|AZUserAccessAdministrator|AZContribu
|
||||
## All Azure AD Groups that are synchronized with On-Premise AD
|
||||
MATCH (n:Group) WHERE n.objectid CONTAINS 'S-1-5' AND n.azsyncid IS NOT NULL RETURN n
|
||||
```
|
||||
|
||||
### [Azucar](https://github.com/nccgroup/azucar)
|
||||
|
||||
```bash
|
||||
# You should use an account with at least read-permission on the assets you want to access
|
||||
git clone https://github.com/nccgroup/azucar.git
|
||||
@@ -309,17 +288,13 @@ PS> .\Azucar.ps1 -ExportTo CSV,JSON,XML,EXCEL -AuthMode Certificate_Credentials
|
||||
# resolve the TenantID for an specific username
|
||||
PS> .\Azucar.ps1 -ResolveTenantUserName user@company.com
|
||||
```
|
||||
|
||||
### [**MicroBurst**](https://github.com/NetSPI/MicroBurst)
|
||||
|
||||
```
|
||||
Import-Module .\MicroBurst.psm1
|
||||
Import-Module .\Get-AzureDomainInfo.ps1
|
||||
Get-AzureDomainInfo -folder MicroBurst -Verbose
|
||||
```
|
||||
|
||||
### [**PowerZure**](https://github.com/hausec/PowerZure)
|
||||
|
||||
```powershell
|
||||
Connect-AzAccount
|
||||
ipmo C:\Path\To\Powerzure.psd1
|
||||
@@ -340,9 +315,7 @@ $ Set-Role -Role Contributor -User test@contoso.com -Resource Win10VMTest
|
||||
# Administrator
|
||||
$ Create-Backdoor, Execute-Backdoor
|
||||
```
|
||||
|
||||
### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner)
|
||||
|
||||
```powershell
|
||||
|
||||
#Get-GraphTokens
|
||||
@@ -398,9 +371,4 @@ 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
|
||||
```
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user