Files
hacktricks-cloud/pentesting-cloud/azure-security/az-persistence/az-storage-persistence.md
2024-12-12 19:35:48 +01:00

3.8 KiB

Az - Storage Persistence

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}

Storage Privesc

For more information about storage check:

{% content-ref url="../az-services/az-storage.md" %} az-storage.md {% endcontent-ref %}

Common tricks

  • Keep the access keys
  • Generate SAS
    • User delegated are 7 days max

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.

{% code overflow="wrap" %}

az storage account blob-service-properties update \
  --account-name <STORAGE_ACCOUNT_NAME> \
  --enable-container-delete-retention true \
  --container-delete-retention-days 100

{% endcode %}

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.

{% code overflow="wrap" %}

az storage blob service-properties delete-policy update \
  --account-name <STORAGE_ACCOUNT_NAME> \
  --enable true \
  --days-retained 100

{% endcode %}

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}