Identity in the Cloud
There is no firewall to breach anymore, just a key that says yes.
What you will learn
- -Explain why IAM is the real perimeter in cloud
- -Tell a user apart from a role and know when each is used
- -Read a policy well enough to spot a dangerous grant
In an on-prem you break in by getting past the . In the cloud there is no wall to past. Every call to AWS, Azure, or GCP hits the same public whether it comes from the CEO's laptop or a script in Belarus. The only thing standing between an attacker and your data is whether the request is signed with a that will honor. That is it. is the perimeter.
This flips how you think about attack and defense. A leaked is not "a step toward" compromise. In many tenants it is compromise, full stop. The 2019 Capital One breach ran on a single over-privileged role that a was allowed to assume. No , no zero-day. Just a permission that said yes when it should have said no.
Users versus roles, and why the difference matters
An IAM user is a permanent identity with long-lived credentials: a for the console, or an access key ID and for the API. It represents a person or, worse, a service that someone hardcoded a key into. Those keys sit in files, in environment variables, in Git history. They do not rotate on their own. When you find AKIA... in a repo, that is a user's key, and it works until someone notices.
An IAM role has no permanent credentials. You assume it, and you get back that expire in an hour or so. An EC2 instance assumes a role through its instance profile. A function runs as a role. A user in one account assumes a role in another to cross the boundary. Because the credentials are short-lived, a stolen role is a smaller fire than a stolen user key, but only if the role is not absurdly over-permissioned.
The move you want is roles over users everywhere. Users with static keys are the thing that leaks. Roles hand out credentials that die on their own.
Roles issue credentials through STS, the Security Token Service. When an EC2 box assumes its role, it fetches those keys from the instance metadata endpoint at 169.254.169.254. That address matters more than it looks, and it comes up again the moment you learn about against cloud workloads.
Reading a policy without falling asleep
IAM policies are . Three fields carry the weight: Effect (Allow or Deny), Action (what API calls), and Resource (on what). The one that should make you sit up is a wildcard in both:
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
That is access. Attached to a role that a can assume, it means an SSRF bug on that server is game over for the whole account. Real policies are rarely this blatant, but the pattern to hunt for is the same: broad Action, broad Resource, attached to something reachable.
Two actions deserve special fear because they let an identity grant itself more power. iam:PassRole lets a principal hand a role to a service. iam:CreatePolicyVersion and friends let it rewrite its own permissions. in cloud is usually not an . It is a chain of "this identity is allowed to modify identity."
Tools like pacu, enumerate-iam, and aws iam simulate-principal-policy will map every permission a set of keys holds. Run them against your own lab account, CloudGoat, or a tenant you are contracted for. Enumerating permissions on someone else's account with keys you found is unauthorized access, and cloud it all.
Start any assessment by asking one question of every credential: who can this become, and what can they touch? Answer that and you have the tenant's whole attack surface.
You find hardcoded AWS credentials starting with AKIA in a public GitHub repo. What kind of identity do they belong to, and why is that worse than a role's credentials?