Free overview · hard · Lesson 3 of 8

Pod Security Admission in production

How to turn on Pod Security Admission on a working namespace: warn and audit, fixing templates, enforce with a pinned version, and the trap of a Deployment without Pods.

The third lesson of the hardening track. The CI token legitimately rolls out Deployments into the shop's namespace. If it leaks, the attacker rolls out a Pod running as root with the node disk, and RBAC won't stop that. The lesson shows how to turn on Pod Security Admission on a live namespace without taking the services down.

Threat model

The attacker has the ServiceAccount token that CI uses to roll out the application. It is allowed to create Deployments. Anything the attacker rolls out runs with whatever security fields they write into the Pod template.

Attack path

  1. A CI token with the create deployments permission.
  2. A Deployment with a privileged container running as root and a volume with the node's root filesystem.
  3. The Pod sends the administrator's kubeconfig to an external server.

Checklist

Practice

One lab on the shared cluster of the track. The attack rolls out a privileged Deployment with the CI token. You turn on restricted for shop, move web, api and PostgreSQL to running without root, and check that the attack runs into Pod Security while the shop still takes orders.

Done reading?

Mark the lesson as read to move your track progress forward.

Practice

Fix a local lab. The agent checks your work and gives hints if you get stuck.

Full access to all labs

$134 $67.00 for one year −50%

One payment, no auto-renewal · Terms

Buy for $67.00