Skip to content

Block access to the ServiceAccount token that is available inside of each Pod #97

@flavio

Description

@flavio

Each Pod scheduled by Kubernetes has the following contents under /var/run/secrets/kubernetes.io:

bash-5.0# ls -l /var/run/secrets/kubernetes.io/serviceaccount/
total 0
lrwxrwxrwx    1 root     root            13 Nov 13 07:22 ca.crt -> ..data/ca.crt
lrwxrwxrwx    1 root     root            16 Nov 13 07:22 namespace -> ..data/namespace
lrwxrwxrwx    1 root     root            12 Nov 13 07:22 token -> ..data/token

The majority of the containerized workloads do not need to interact with the Kubernetes API server. Hence they don't need to read the token that is associated with the ServiceAccount used to create the Pod.

On the other hand, an attacker can use this token to perform nasty operations against the API server and potentially find a way to escape (for example: start a privileged Pod in the same Namespace).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions