diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md index 32cff6c78..6d4185bed 100644 --- a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md @@ -51,13 +51,25 @@ az postgres flexible-server identity update \ --system-assigned Enabled ``` ```sql - +-- Make sure the extension is installed CREATE EXTENSION IF NOT EXISTS azure_storage; -CREATE EXTERNAL DATA SOURCE ManagedIdentity - +-- Login using storage keys SELECT azure_storage.account_add('', ''); +-- Login using managed identity +SELECT azure_storage.account_add(azure_storage.account_options_managed_identity('', 'blob')); +-- List configured accounts +SELECT * FROM azure_storage.account_list(); + +-- List all the files in the storage account +SELECT * +FROM azure_storage.blob_list( + '', + '' +); + +-- Access one file inside the storage account SELECT * FROM azure_storage.blob_get( '', @@ -66,7 +78,6 @@ FROM azure_storage.blob_get( decoder := 'text' ) AS t(content text) LIMIT 1; - ``` Additionally it is necesary to have the public access enabled if you want to access from a non private endpoint, to enable it: