Translated ['src/pentesting-cloud/azure-security/az-persistence/az-queue

This commit is contained in:
Translator
2025-02-20 00:55:57 +00:00
parent 45d08a7c55
commit 40b5f8bf29
10 changed files with 72 additions and 40 deletions

View File

@@ -0,0 +1,91 @@
# Az - Queue Storage
{{#include ../../../banners/hacktricks-training.md}}
## Основна інформація
Azure Queue Storage - це сервіс у хмарній платформі Microsoft Azure, призначений для чергування повідомлень між компонентами додатка, **що дозволяє асинхронну комунікацію та розділення**. Він дозволяє зберігати необмежену кількість повідомлень, кожне з яких має розмір до 64 КБ, і підтримує операції, такі як створення та видалення черг, додавання, отримання, оновлення та видалення повідомлень, а також управління метаданими та політиками доступу. Хоча зазвичай він обробляє повідомлення в порядку "перший прийшов - перший вийшов" (FIFO), строгий FIFO не гарантується.
### Перерахування
{{#tabs }}
{{#tab name="Az Cli" }}
```bash
# You need to know the --account-name of the storage (az storage account list)
az storage queue list --account-name <storage_account> # --auth-mode login
# Queue Metadata
az storage queue metadata show --name <queue_name> --account-name <storage_account> # --auth-mode login
#Get ACL
az storage queue policy list --queue-name <queue_name> --account-name <storage_account> # --auth-mode login
# Get Messages (getting a message deletes it)
az storage message get --queue-name <queue_name> --account-name <storage_account> # --auth-mode login
# Peek Messages
az storage message peek --queue-name <queue_name> --account-name <storage_account> # --auth-mode login
```
{{#endtab }}
{{#tab name="Az PS" }}
```bash
# Get the Storage Context
$storageAccount = Get-AzStorageAccount -ResourceGroupName QueueResourceGroup -Name queuestorageaccount1994
$ctx = $storageAccount.Context
# Set Variables for Storage Account
$storageAccountName = "queuestorageaccount"
# List Queues
Get-AzStorageQueue -Context $context
$queueName = "myqueue"
# Retrieve a specific queue
$queue = Get-AzStorageQueue -Name $queueName -Context $context
$queue # Show the properties of the queue
# Retrieve the access policies for the queue
$accessPolicies = Get-AzStorageQueueStoredAccessPolicy -Context $context -QueueName $queueName
$accessPolicies
# Peek Messages
$queueMessage = $queue.QueueClient.PeekMessage()
$queueMessage.Value
# Set the amount of time you want to entry to be invisible after read from the queue
# If it is not deleted by the end of this time, it will show up in the queue again
$visibilityTimeout = [System.TimeSpan]::FromSeconds(10)
# Read the messages from the queue, then show the contents of the messages.
$queueMessage = $queue.QueueClient.ReceiveMessages(1,$visibilityTimeout)
$queueMessage.Value
```
{{#endtab }}
{{#endtabs }}
### Підвищення Привілеїв
{{#ref}}
../az-privilege-escalation/az-queue-privesc.md
{{#endref}}
### Постексплуатація
{{#ref}}
../az-post-exploitation/az-queue-post-exploitation.md
{{#endref}}
### Постійність
{{#ref}}
../az-persistence/az-queue-persistance.md
{{#endref}}
## Посилання
- [https://learn.microsoft.com/en-us/azure/storage/queues/storage-powershell-how-to-use-queues](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/rest/api/storageservices/queue-service-rest-api)
- [https://learn.microsoft.com/en-us/azure/storage/queues/queues-auth-abac-attributes](https://learn.microsoft.com/en-us/azure/storage/queues/queues-auth-abac-attributes)
{{#include ../../../banners/hacktricks-training.md}}