Broken Authentication in Kubernetes

Broken Authentication in Kubernetes

A pod that never calls the API still carries a key to it.

What Is Broken Authentication in Kubernetes?

Kubernetes mounts a ServiceAccount token into every pod by default, so a compromised pod that never calls the API still hands an attacker a credential. You'll find a token in a web pod, use it to read Secrets because its ServiceAccount was bound to the edit role, then turn off the auto-mount on the ServiceAccount and pod, rebind to a scoped Role and move toward bound, short-lived tokens. Maps to OWASP Kubernetes Top Ten K09, Broken Authentication.

What You'll Learn in Broken Authentication in Kubernetes

Broken Authentication in Kubernetes — Training Steps

  1. A token in the pod

    Bob has a shell in a Skelderra tracking-web pod, through an SSRF bug in its map tile proxy. The web service never calls the Kubernetes API. He checks the one place Kubernetes puts something useful in every pod. Skelderra tracks parcels for retailers. Its clusters hold carrier API keys and customer address data.

  2. What can the token do

    Bob uses the token to ask the API server what its ServiceAccount is allowed, using the pod's own trusted CA.

  3. Read the namespace Secrets

    Edit includes reading Secrets. Bob lists them and reads the carrier API key.

  4. Check your understanding

  5. The web ServiceAccount read Secrets

    Skelderra's security team sees the tracking-web ServiceAccount, which should only read one ConfigMap, listing and reading Secrets.

  6. Open the ServiceAccount and its binding

    Alice opens the ServiceAccount, the deployment, the RoleBinding and the scoped Role that was written for it.

  7. Bound to edit for one ConfigMap

    The ServiceAccount only ever needed to read one ConfigMap. It was bound to the built-in edit role instead, which includes Secrets.

  8. What it actually needed

    A Role scoped to exactly that was written and never used.

  9. Turn off the auto-mount

    The web pods do not call the API, so the simplest fix is for the token not to be there. Alice sets the ServiceAccount to not auto-mount.

  10. Opt out at the pod too

    Alice also sets it on the pod template, so the decision is visible in the workload and holds even if the ServiceAccount default changes.

Security Framework Coverage

OWASP Kubernetes Top 10

  • K09:2025 Broken Authentication

CWE

  • CWE-522 Insufficiently Protected Credentials
  • CWE-250 Execution with Unnecessary Privileges

MITRE ATT&CK

  • T1528 Steal Application Access Token
  • T1552.007 Unsecured Credentials: Container API

CIS Controls

  • CIS 6 Access Control Management
  • CIS 4 Secure Configuration of Enterprise Assets and Software

NIST CSF

  • PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
  • PR.AA Identity Management, Authentication, and Access Control
  • PR.PS Platform Security

NICE Framework

  • IO-WRL-005 Systems Administration
  • DD-WRL-001 Cybersecurity Architecture