Skip to content

KCSA · Domain 4: Kubernetes Threat Model · 16% of the exam

Task 4.7: Privilege Escalation

Paths from a Pod or a narrow role to cluster admin: privileged Pods, host mounts, escalate and bind verbs, and creating workloads.

Study it

  • Persistence, malicious code, attackers on the network, sensitive data and privilege escalation

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

Namespace owners hold permission to patch Namespace objects, because their tooling manages annotations on their namespaces. The platform team labels every namespace pod-security.kubernetes.io/enforce=restricted, and a review notes that an owner could relabel a namespace to privileged. The owners must keep managing their annotations. Which change closes the gap?

  1. AA validating admission rule rejecting changes to Pod Security labels by anyone but platform admins
  2. BAdd resourceNames to the owners' rule so that each owner can patch only their own Namespace
  3. CGrant update on the Namespace in place of patch, so that owners must send the whole object
  4. DBind the owners to the built-in admin ClusterRole in their namespace instead of patch rights
Show the answer and why
  • AA validating admission rule rejecting changes to Pod Security labels by anyone but platform admins

    Correct

    Validating admission sees both the old and the new object in an update request and the requesting user, so it can reject a changed Pod Security label while annotation changes pass; the application security checklist suggests such a policy where patch on a Namespace is allowed.

  • BAdd resourceNames to the owners' rule so that each owner can patch only their own Namespace

    Incorrect

    resourceNames limits which objects can be patched, not which fields; the owner can still change the labels of their own Namespace.

  • CGrant update on the Namespace in place of patch, so that owners must send the whole object

    Incorrect

    update (an HTTP PUT) writes the object as the owner sends it, labels included, so an owner could still submit the namespace with a privileged label.

  • DBind the owners to the built-in admin ClusterRole in their namespace instead of patch rights

    Incorrect

    The admin role gives write access to most resources in the namespace but not to the Namespace object itself, so the owners could no longer manage its annotations.

Pod Security admission reads its level from namespace labels, and the RBAC good practices warn that patch on a Namespace lets a user set a more permissive level. RBAC decides which objects and verbs a user may use, not which fields change, and the admin role does not cover the Namespace object itself. Validating admission can compare the old and new object and the requester, so it can keep annotation edits open while rejecting a relabelling.

Question 2 · choose 1

A support team's Role in namespace ops allows get and list on serviceaccounts and create on serviceaccounts/token, so that it can troubleshoot workloads. The namespace also holds a deployment-bot service account bound to a powerful ClusterRole. Why does the Kubernetes RBAC good practices guide treat this Role as risky?

  1. Aget on serviceaccounts lets the team change which Pods run as deployment-bot
  2. BNothing; a requested token carries no permissions of its own
  3. CAny rule that names serviceaccounts lets its holders impersonate those service accounts
  4. DIt lets the team issue tokens for deployment-bot and act with that account's rights
Show the answer and why
  • Aget on serviceaccounts lets the team change which Pods run as deployment-bot

    Incorrect

    get only reads the service account object; it cannot change any workload.

  • BNothing; a requested token carries no permissions of its own

    Incorrect

    A token authenticates as its service account, so whoever holds it gets that account's permissions, including deployment-bot's.

  • CAny rule that names serviceaccounts lets its holders impersonate those service accounts

    Incorrect

    Impersonation needs the impersonate verb; reading service accounts does not grant it.

  • DIt lets the team issue tokens for deployment-bot and act with that account's rights

    Correct

    The good practices list token requests among escalation risks: users with create rights on serviceaccounts/token can issue tokens for existing service accounts.

A requested token authenticates as its service account, so create on serviceaccounts/token in a namespace effectively grants the rights of every service account there. The RBAC good practices list it among the privilege escalation risks.

Question 3 · choose 1

A monitoring DaemonSet runs on every node with a service account that holds powerful cluster permissions. What do the Kubernetes RBAC good practices advise about such workloads?

  1. ARun them on every node so that their permissions are spread evenly
  2. BLimit the nodes running powerful Pods, away from untrusted ones
  3. CGive each copy a different service account with the same permissions
  4. DMount the service account token into every other Pod on the node as well
Show the answer and why
  • ARun them on every node so that their permissions are spread evenly

    Incorrect

    Each extra node with a powerful token is another place where a container escape exposes it.

  • BLimit the nodes running powerful Pods, away from untrusted ones

    Correct

    The good practices say to limit the number of nodes running powerful Pods, run DaemonSets with least privilege, and avoid running powerful Pods alongside untrusted or publicly exposed ones.

  • CGive each copy a different service account with the same permissions

    Incorrect

    More identities with the same powerful rights do not reduce what an escape on any node can reach.

  • DMount the service account token into every other Pod on the node as well

    Incorrect

    Spreading the token widens its exposure, the opposite of the advice.

A Pod's service account token is reachable by anyone who escapes from a container on its node. The RBAC good practices therefore advise keeping powerful workloads on few nodes, running DaemonSets with least privilege and separating them from untrusted Pods with taints, affinity or anti-affinity.

Question 4 · choose 1

Why do the Kubernetes RBAC good practices advise against wildcard permissions on all resources?

  1. AThey are rejected by the API server since Kubernetes v1.25 for safety
  2. BThey only work for read verbs, which confuses users
  3. CThey cover all current object types and those created in the future
  4. DThey slow down every API request considerably
Show the answer and why
  • AThey are rejected by the API server since Kubernetes v1.25 for safety

    Incorrect

    Wildcards are still accepted; the advice is about their reach.

  • BThey only work for read verbs, which confuses users

    Incorrect

    Wildcards can cover any verb, which is part of the danger.

  • CThey cover all current object types and those created in the future

    Correct

    The good practices explain that wildcard access covers not only all current object types but also all types created in the future.

  • DThey slow down every API request considerably

    Incorrect

    The concern is excessive access, not performance.

Kubernetes is extensible, so a wildcard on resources automatically includes custom resources added later. The good practices advise avoiding wildcards to keep permissions to what is explicitly needed.

Practice domain 4 →Practice all domains →