Kubernetes RBAC: privilege path from Pod to Secret
During a cluster security audit, a remote code execution (RCE) vulnerability was discovered in the web-gateway Pod in the web-dmz namespace exposed to the public internet. You are given cluster_rbac_dump.yaml, a kubectl get ... -A -o yaml-style export of all ServiceAccount, Pod, Role, ClusterRole, RoleBinding, ClusterRoleBinding, and Secret objects across the cluster.
There are many Secrets in the cluster, and each of them has a base64-encoded data.vault_token field. Starting from the web-gateway Pod, determine which single Secret the attacker can reach through the following valid Kubernetes RBAC transitions:
pods/exec(createor*): executing a command inside a Pod in an authorized namespace to obtain its mounted ServiceAccount token — only if a token is mounted in the Pod (ifautomountServiceAccountToken: falseis set on the Pod spec or ServiceAccount, no token is mounted);serviceaccounts/token(createor*): creating a token for a ServiceAccount in an authorized namespace (and with that exact name ifresourceNamesis specified);serviceaccounts(impersonateor*): sending a request on behalf of another ServiceAccount;- Goal: the reached ServiceAccount has
get,list, or*permission on thesecretsresource (the core""or"*"must be inapiGroups;resourceNamesonly grants access to the specified names and is not suitable forlist).
Remember: even if a RoleBinding references a ClusterRole, it grants permissions only within its own namespace; a ClusterRoleBinding is required for cluster-wide scope. Decode the vault_token value of the single reachable Secret from base64. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).