Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.1.2
- Impact: Privilege Escalation & Credential Theft. Kubernetes Secrets often contain sensitive service account tokens, database passwords, or external API keys. If an attacker gains
getorlistaccess to Secrets, they can retrieve these tokens and impersonate other service accounts (potentially gaining cluster-admin access) or access external resources.
Common Misconfiguration
Creating “developer” or “operator” roles that grant* (wildcard) access to resources in a namespace, inadvertently including secrets. Alternatively, granting get access to secrets to CI/CD tools that only need to deploy applications but not read back the credentials.
Vulnerable Example
Secure Example
Audit Procedure
Review the users and roles that haveget, list, or watch access to secrets objects in the Kubernetes API.
You can dump all Roles and ClusterRoles to search for secret access:
- Analyze: Look for rules where
resourcesincludessecretsor*. - Verify: Ensure that only system components (like
system:controller:namespace-controller) or specific administrators have this access.
Remediation
Where possible, restrict access to secret objects in the cluster by removingget, list, and watch permissions from Roles and ClusterRoles.
- Identify the Role granting excessive access.
- Edit the Role to remove
secretsfrom theresourceslist. - If
resources: ["*"]is used, replace it with an explicit list of resources that does not include secrets.

