Chapter 12. Escalating Privileges in Microsoft Azure
In the simulation of the preceding chapter, you leveraged a code injection vulnerability in a serverless function to obtain an access token associated with the function’s managed identity, which had Owner-level permissions. In practice, most managed identities associated with serverless functions and other cloud resources that enable the serverless operational model are granted far more limited access.
In this chapter, you’ll build on what you’ve learned and examine how an attacker can escalate privileges in Azure by abusing an overly permissive managed identity. You’ll begin by upgrading the vulnerable-by-design serverless function you previously set up, configuring its managed identity with a more restrictive set of roles. Next, you’ll perform a simulated attack and extract the function app’s managed identity tokens via code injection, escalate privileges by assigning elevated roles through the management plane, and then access secrets from Key Vault. Finally, you will secure the function by removing any unnecessary role assignments to enforce the principle of least privilege.
We will cover the following in this chapter:
-
“Escalating Privileges Through an Overly Permissive Managed Identity”
-
“Applying Least Privilege to the Function App Managed Identity”
By the end of this chapter, you should be able to recognize configuration mistakes that could allow an attacker to escalate privileges ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access