RBAC through the attacker's eyes
What an attacker does with a ServiceAccount token: other ServiceAccounts through create pods, bind, impersonate, and a Secret leak through the aggregated view role.
The second lesson of the hardening track. The attacker already runs commands in the web Pod, and every Pod holds the token of its ServiceAccount. The lesson shows what that token turns into when the role was granted "just in case", and how to find it before the attacker does.
Threat model
The attacker has the application's ServiceAccount token and the cluster API address. The token has no direct permission to read Secrets. The attacker looks for bypass paths: create an object that runs under a stronger ServiceAccount, grant themselves permissions, or act under someone else's name.
Attack paths
- A Pod under someone else's ServiceAccount in the same namespace, with the result read from the log.
- A RoleBinding to someone else's ClusterRole with the
bindverb. - Requests in the name of another ServiceAccount with the
impersonateverb. - Secrets through the built-in
viewrole, into which a third-party chart mixed its own role.
Checklist
- The application's ServiceAccount has only the verbs the application calls; if it doesn't need the API, the token isn't mounted.
- The
createverb on Pods and workloads,bind,escalateandimpersonateare granted from an explicit list and withresourceNames. - Roles labeled
aggregate-to-view,aggregate-to-editandaggregate-to-adminare reviewed: they contain no Secrets. - The permissions of every ServiceAccount are checked with a command, not by reading role YAML.
Practice
Two labs on the shared cluster of the track. In the first, the stolen web token creates a Pod under the backup ServiceAccount and reads every Secret in the cluster. In the second, the token has three bypass paths, and you need to close all of them without breaking the shop's status page.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Practice
Fix a local lab. The agent checks your work and gives hints if you get stuck.
Full access to all labs
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress