Jumpstart your quest by listing all the secrets in the cluster. Can you spot the flag among them?
Challenge Value: 10 pts
Permissions complements of Wiz: (You're too kind guys)
Solving the Challenge
Lets get started in the terminal below by first confirming what the kubeconfig profile settings were are connected with has the ability to do. In short lets run the `whoami` of kubernetes.
Here we can see that we have permissions that are consistent with the permission hint provided from Wiz.
Let's break down the permissions of user connected to the kubeconfig file allowing us to run the kubectl commands in the first place in order to interact with the Kubernetes cluster.
Resource
Verb
Description
secrets
get
Allows the user/role/SA to get information about a specific secret object that was made in the kubernetes cluster. Please note however this doesn't allow us to see all the secrets so the member seeking information on the secret will need to know the secrets name. In order to list available secrets, the k8s member would need the list permission as well.
secrets
list
This allows the k8s member to list the available secrets that it has access to per namespace without knowing any of the secrets resource names prior.
Enumerating the available resources
Only one secret is available and is returned, but this isn't enough information to get a potential secret hash.
Now we know the secret itself is a 52 byte base64 character string. (See the link below for more information on Kubernetes secrets or the References section above).
Instead of describing the secret lets run a get action verb with the json output and use jq tooling to extract the key's value (I just prefer jq to the builtin jsonpath).
Now that we have the secret we can decode it.
Boom we got it, now we can finally submit and see if that is the flag.
Challenge 1 completed, time for the next challenge.