Lesson 9 of 14 · 16m
Azure Storage: The Account Key Is a Master Key and SAS Is a URL That Leaks
key1/key2 bypass the RBAC data-plane split entirely, and Microsoft's own 38TB SAS leak is the case study.
The two master keys
Every Azure storage account is created with two symmetric keys, key1 and key2. Each grants every data operation on every blob container, queue, table, and file share in the account — master keys, no per-container scoping, used via the Authorization: SharedKey account:signature scheme. Two keys exist for rotation overlap, nothing more.
Now the RBAC trap, weaponized: Microsoft.Storage/storageAccounts/listKeys/action is a control-plane action included in Contributor. Anyone with Contributor on the account pulls the master keys and owns the data plane completely — the dataActions split never applies to key-based auth. "They can't read blobs, they only have Contributor" is a true sentence that doesn't mean what you think it means.
SAS: a bearer token in a query string
Shared Access Signatures sign a URL with the account key — or Entra credentials, for user delegation SAS. The query parameters are the whole policy: sp= permissions (r, w, l, d, a, c, u, p), st=/se= start and end time, sv= signature version, ss=/srt= service and resource scope, sip= allowed IP range, spr= required protocol. Three tiers: account SAS covers the entire account across services; service SAS covers one container/blob/queue/table; user delegation SAS is signed by a delegation key minted from the caller's Entra identity (Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey), auditable per user and revocable without rotating the account key — which makes it the right default. A stored access policy on the container is the other revocation handle: SAS minted under it die when you delete the policy.
The failure modes all live in scope and lifetime: account-scoped SAS, se set a decade out, sp=rwld when sp=r sufficed — and the physical fact that the SAS travels in a URL. URLs land in access logs, proxy logs, browser history, Referer headers, support tickets, and README files committed to public repos. The least-protected string in your stack carries the token.
The mint commands show where scope slips: az storage blob generate-sas --account-name x --container-name c --name b --permissions r --expiry <iso> --auth-mode login --as-user produces a user delegation SAS; drop --as-user/--auth-mode login and you get an account-key-signed service SAS instead. sip= and spr=https are worth typing — an IP-scoped, HTTPS-only SAS still leaks, but it leaks to fewer places.
The evidence is Microsoft's own repo
September 18, 2023: Wiz disclosed that Microsoft's AI research GitHub repos — robust-models-transfer among them — linked to a storage account behind an account-level SAS granting read, write, and list, effectively without expiry. The URL sat in public documentation. Result: 38 TB of internal Microsoft data exposed, including private keys and tens of thousands of Teams messages from 359 employees. Microsoft's own researchers shipped the mistake the SAS design invites. The fix was scoping the link and rotating the keys — the lesson is that account SAS is the footgun, not the edge case. And SAS never appears in RBAC assignment lists: auditing who can mint SAS means auditing listKeys and generateUserDelegationKey holders, not looking for the tokens themselves.
The switches that close it
allowBlobPublicAccess: falseat the account — container anonymous access levels (Private/Blobanonymous reads /Containeranonymous reads plus listing) stop being honored regardless of how they're set.allowSharedKeyAccess: false— kills every Shared Key-authorized request: account-key auth plus account and service SAS signed with the account key. User delegation SAS survives — it's Entra-authorized, not key-authorized — which is exactly why it's the right default for sharing. The big hammer: enable it and you'll immediately discover which legacy callers still use keys, which is also the point.- Firewall:
defaultAction: Denyplus selected VNets/IPs or private endpoints. Audit theAzureServices"trusted Azure services" bypass — it reopens a path through the firewall that auditors routinely miss. - For sharing: user delegation SAS, minimal
sp,semeasured in days,sip/sprwhere defensible — or a stored access policy so the issued SAS stays revocable.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
AWS Emulator Puts AWS on Your Laptop. Keep Your IAM Tests Off It.
AWS released AWS Emulator on November 11, a free local server that answers AWS API calls on 127.0.0.1 with per-run keys and fresh certificates.
Big Tech Plans to Work with the Public Sector for Cybersecurity
Both Microsoft, Inc. and Alphabet, Inc. will put a combined $30 billion dollars into cybersecurity over the next five years and work with the public sector on several initiatives to help improve cybersecurity.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.
What is SSRF? Server-Side Request Forgery and the Attack That Breached Capital One
SSRF tricks your server into making requests to internal systems — cloud metadata services, internal APIs, AWS credentials endpoints. It turned a WAF misconfiguration into 100 million stolen Capital One records