Images and signatures
Distroless instead of an image with a shell and utilities, cosign image signing and Kyverno signature verification against a swap under the same tag.
The sixth lesson of the hardening track: defense on the image side. In an image with a shell and utilities, an attacker who runs commands through a hole in the code has everything they need. And an image tag can be overwritten: whoever gets push access to the registry runs their code on the next rollout.
Threat model
Two attackers. The first runs commands in a Pod through a vulnerable endpoint and uses whatever is in the image. The second got write access to the registry and replaces a service image under the same tag.
Attack path
- Shell commands through a vulnerable endpoint:
wget,nc, a package manager in the image. - Your own image under an existing tag,
imagePullPolicy: Always, an ordinary CI rollout. - The attacker's code in a Pod next to the database password in the environment variables.
Checklist
- Service images have no shell or package manager, and
USERis set as a number. - The SBOM shows what the images contain.
- Images are signed by digest, and ordinary builds can't reach the signing key.
- The cluster admits only signed images into working namespaces and pins the digest.
- The webhook policy engine runs in several replicas and leaves system namespaces alone.
Practice
Two labs on the shared cluster of the track. In the first you build web on a distroless image, and the /debug hole stops running commands. In the second the attack replaces the api image in the registry, and you sign the shop images with cosign and turn on signature verification in Kyverno.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Practice
Fix a local lab. The agent checks your work and gives hints if you get stuck.
Full access to all labs
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress