mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-16 23:01:43 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -4,52 +4,43 @@
|
||||
|
||||
### Illicit Consent Grant
|
||||
|
||||
By default, any user can register an application in Azure AD. So you can register an application (only for the target tenant) that needs high impact permissions with admin consent (an approve it if you are the admin) - like sending mail on a user's behalf, role management etc.T his will allow us to **execute phishing attacks** that would be very **fruitful** in case of success.
|
||||
Per impostazione predefinita, qualsiasi utente può registrare un'applicazione in Azure AD. Quindi puoi registrare un'applicazione (solo per il tenant target) che necessita di permessi ad alto impatto con consenso dell'amministratore (approvala se sei l'amministratore) - come inviare email per conto di un utente, gestione dei ruoli, ecc. Questo ci permetterà di **eseguire attacchi di phishing** che sarebbero molto **fruttuosi** in caso di successo.
|
||||
|
||||
Moreover, you could also accept that application with your user as a way to maintain access over it.
|
||||
Inoltre, potresti anche accettare quell'applicazione con il tuo utente come modo per mantenere l'accesso su di essa.
|
||||
|
||||
### Applications and Service Principals
|
||||
|
||||
With privileges of Application Administrator, GA or a custom role with microsoft.directory/applications/credentials/update permissions, we can add credentials (secret or certificate) to an existing application.
|
||||
Con i privilegi di Application Administrator, GA o un ruolo personalizzato con permessi microsoft.directory/applications/credentials/update, possiamo aggiungere credenziali (segreto o certificato) a un'applicazione esistente.
|
||||
|
||||
It's possible to **target an application with high permissions** or **add a new application** with high permissions.
|
||||
È possibile **prendere di mira un'applicazione con permessi elevati** o **aggiungere una nuova applicazione** con permessi elevati.
|
||||
|
||||
An interesting role to add to the application would be **Privileged authentication administrator role** as it allows to **reset password** of Global Administrators.
|
||||
|
||||
This technique also allows to **bypass MFA**.
|
||||
Un ruolo interessante da aggiungere all'applicazione sarebbe il **ruolo di amministratore dell'autenticazione privilegiata** poiché consente di **reimpostare la password** degli Amministratori Globali.
|
||||
|
||||
Questa tecnica consente anche di **bypassare MFA**.
|
||||
```powershell
|
||||
$passwd = ConvertTo-SecureString "J~Q~QMt_qe4uDzg53MDD_jrj_Q3P.changed" -AsPlainText -Force
|
||||
$creds = New-Object System.Management.Automation.PSCredential("311bf843-cc8b-459c-be24-6ed908458623", $passwd)
|
||||
Connect-AzAccount -ServicePrincipal -Credential $credentials -Tenant e12984235-1035-452e-bd32-ab4d72639a
|
||||
```
|
||||
|
||||
- For certificate based authentication
|
||||
|
||||
- Per l'autenticazione basata su certificati
|
||||
```powershell
|
||||
Connect-AzAccount -ServicePrincipal -Tenant <TenantId> -CertificateThumbprint <Thumbprint> -ApplicationId <ApplicationId>
|
||||
```
|
||||
|
||||
### Federation - Token Signing Certificate
|
||||
|
||||
With **DA privileges** on on-prem AD, it is possible to create and import **new Token signing** and **Token Decrypt certificates** that have a very long validity. This will allow us to **log-in as any user** whose ImuutableID we know.
|
||||
|
||||
**Run** the below command as **DA on the ADFS server(s)** to create new certs (default password 'AADInternals'), add them to ADFS, disable auto rollver and restart the service:
|
||||
Con **privilegi DA** su AD on-prem, è possibile creare e importare **nuovi certificati di firma del token** e **certificati di decrittazione del token** che hanno una validità molto lunga. Questo ci permetterà di **accedere come qualsiasi utente** il cui ImuutableID conosciamo.
|
||||
|
||||
**Esegui** il comando qui sotto come **DA sui server ADFS** per creare nuovi certificati (password predefinita 'AADInternals'), aggiungerli a ADFS, disabilitare il rollover automatico e riavviare il servizio:
|
||||
```powershell
|
||||
New-AADIntADFSSelfSignedCertificates
|
||||
```
|
||||
|
||||
Then, update the certificate information with Azure AD:
|
||||
|
||||
Poi, aggiorna le informazioni del certificato con Azure AD:
|
||||
```powershell
|
||||
Update-AADIntADFSFederationSettings -Domain cyberranges.io
|
||||
```
|
||||
|
||||
### Federation - Trusted Domain
|
||||
|
||||
With GA privileges on a tenant, it's possible to **add a new domain** (must be verified), configure its authentication type to Federated and configure the domain to **trust a specific certificate** (any.sts in the below command) and issuer:
|
||||
|
||||
Con privilegi GA su un tenant, è possibile **aggiungere un nuovo dominio** (deve essere verificato), configurare il suo tipo di autenticazione come Federato e configurare il dominio per **fidarsi di un certificato specifico** (any.sts nel comando qui sotto) e dell'emittente:
|
||||
```powershell
|
||||
# Using AADInternals
|
||||
ConvertTo-AADIntBackdoor -DomainName cyberranges.io
|
||||
@@ -60,13 +51,8 @@ Get-MsolUser | select userPrincipalName,ImmutableID
|
||||
# Access any cloud app as the user
|
||||
Open-AADIntOffice365Portal -ImmutableID qIMPTm2Q3kimHgg4KQyveA== -Issuer "http://any.sts/B231A11F" -UseBuiltInCertificate -ByPassMFA$true
|
||||
```
|
||||
|
||||
## References
|
||||
## Riferimenti
|
||||
|
||||
- [https://aadinternalsbackdoor.azurewebsites.net/](https://aadinternalsbackdoor.azurewebsites.net/)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
# Az - Queue Storage Persistence
|
||||
# Az - Persistenza dello Storage della Coda
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Queue
|
||||
## Coda
|
||||
|
||||
For more information check:
|
||||
Per ulteriori informazioni controlla:
|
||||
|
||||
{{#ref}}
|
||||
../az-services/az-queue-enum.md
|
||||
{{#endref}}
|
||||
|
||||
### Actions: `Microsoft.Storage/storageAccounts/queueServices/queues/write`
|
||||
|
||||
This permission allows an attacker to create or modify queues and their properties within the storage account. It can be used to create unauthorized queues, modify metadata, or change access control lists (ACLs) to grant or restrict access. This capability could disrupt workflows, inject malicious data, exfiltrate sensitive information, or manipulate queue settings to enable further attacks.
|
||||
### Azioni: `Microsoft.Storage/storageAccounts/queueServices/queues/write`
|
||||
|
||||
Questo permesso consente a un attaccante di creare o modificare code e le loro proprietà all'interno dell'account di archiviazione. Può essere utilizzato per creare code non autorizzate, modificare i metadati o cambiare le liste di controllo degli accessi (ACL) per concedere o limitare l'accesso. Questa capacità potrebbe interrompere i flussi di lavoro, iniettare dati dannosi, esfiltrare informazioni sensibili o manipolare le impostazioni della coda per abilitare ulteriori attacchi.
|
||||
```bash
|
||||
az storage queue create --name <new-queue-name> --account-name <storage-account>
|
||||
|
||||
@@ -21,15 +20,10 @@ az storage queue metadata update --name <queue-name> --metadata key1=value1 key2
|
||||
|
||||
az storage queue policy set --name <queue-name> --permissions rwd --expiry 2024-12-31T23:59:59Z --account-name <storage-account>
|
||||
```
|
||||
|
||||
## References
|
||||
## Riferimenti
|
||||
|
||||
- https://learn.microsoft.com/en-us/azure/storage/queues/storage-powershell-how-to-use-queues
|
||||
- https://learn.microsoft.com/en-us/rest/api/storageservices/queue-service-rest-api
|
||||
- https://learn.microsoft.com/en-us/azure/storage/queues/queues-auth-abac-attributes
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,42 +4,34 @@
|
||||
|
||||
## Storage Privesc
|
||||
|
||||
For more information about storage check:
|
||||
Per ulteriori informazioni sullo storage, controlla:
|
||||
|
||||
{{#ref}}
|
||||
../az-services/az-storage.md
|
||||
{{#endref}}
|
||||
|
||||
### Common tricks
|
||||
### Trucchi comuni
|
||||
|
||||
- Keep the access keys
|
||||
- Generate SAS
|
||||
- User delegated are 7 days max
|
||||
- Conserva le chiavi di accesso
|
||||
- Genera SAS
|
||||
- Gli utenti delegati hanno un massimo di 7 giorni
|
||||
|
||||
### Microsoft.Storage/storageAccounts/blobServices/containers/update && Microsoft.Storage/storageAccounts/blobServices/deletePolicy/write
|
||||
|
||||
These permissions allows the user to modify blob service properties for the container delete retention feature, which enables or configures the retention period for deleted containers. These permissions can be used for maintaining persistence to provide a window of opportunity for the attacker to recover or manipulate deleted containers that should have been permanently removed and accessing sensitive information.
|
||||
|
||||
Queste autorizzazioni consentono all'utente di modificare le proprietà del servizio blob per la funzionalità di retention della cancellazione dei contenitori, che abilita o configura il periodo di retention per i contenitori cancellati. Queste autorizzazioni possono essere utilizzate per mantenere la persistenza e fornire una finestra di opportunità per l'attaccante di recuperare o manipolare contenitori cancellati che avrebbero dovuto essere rimossi permanentemente e accedere a informazioni sensibili.
|
||||
```bash
|
||||
az storage account blob-service-properties update \
|
||||
--account-name <STORAGE_ACCOUNT_NAME> \
|
||||
--enable-container-delete-retention true \
|
||||
--container-delete-retention-days 100
|
||||
--account-name <STORAGE_ACCOUNT_NAME> \
|
||||
--enable-container-delete-retention true \
|
||||
--container-delete-retention-days 100
|
||||
```
|
||||
|
||||
### Microsoft.Storage/storageAccounts/read && Microsoft.Storage/storageAccounts/listKeys/action
|
||||
|
||||
These permissions can lead to the attacker to modify the retention policies, restoring deleted data, and accessing sensitive information.
|
||||
|
||||
Queste autorizzazioni possono consentire all'attaccante di modificare le politiche di conservazione, ripristinare dati eliminati e accedere a informazioni sensibili.
|
||||
```bash
|
||||
az storage blob service-properties delete-policy update \
|
||||
--account-name <STORAGE_ACCOUNT_NAME> \
|
||||
--enable true \
|
||||
--days-retained 100
|
||||
--account-name <STORAGE_ACCOUNT_NAME> \
|
||||
--enable true \
|
||||
--days-retained 100
|
||||
```
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,26 +4,22 @@
|
||||
|
||||
## VMs persistence
|
||||
|
||||
For more information about VMs check:
|
||||
Per ulteriori informazioni sulle VMs controlla:
|
||||
|
||||
{{#ref}}
|
||||
../az-services/vms/
|
||||
{{#endref}}
|
||||
|
||||
### Backdoor VM applications, VM Extensions & Images <a href="#backdoor-instances" id="backdoor-instances"></a>
|
||||
### Applicazioni VM backdoor, Estensioni VM & Immagini <a href="#backdoor-instances" id="backdoor-instances"></a>
|
||||
|
||||
An attacker identifies applications, extensions or images being frequently used in the Azure account, he could insert his code in VM applications and extensions so every time they get installed the backdoor is executed.
|
||||
Un attaccante identifica applicazioni, estensioni o immagini utilizzate frequentemente nell'account Azure, potrebbe inserire il suo codice nelle applicazioni e nelle estensioni VM in modo che ogni volta che vengono installate venga eseguita la backdoor.
|
||||
|
||||
### Backdoor Instances <a href="#backdoor-instances" id="backdoor-instances"></a>
|
||||
### Istanze Backdoor <a href="#backdoor-instances" id="backdoor-instances"></a>
|
||||
|
||||
An attacker could get access to the instances and backdoor them:
|
||||
Un attaccante potrebbe accedere alle istanze e backdoorarle:
|
||||
|
||||
- Using a traditional **rootkit** for example
|
||||
- Adding a new **public SSH key** (check [EC2 privesc options](https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc))
|
||||
- Backdooring the **User Data**
|
||||
- Utilizzando un **rootkit** tradizionale, ad esempio
|
||||
- Aggiungendo una nuova **chiave SSH pubblica** (controlla [opzioni di privesc EC2](https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc))
|
||||
- Backdooring i **Dati Utente**
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user