Back to controls

Ensure that Service Account Tokens are only mounted where necessary

Service accounts tokens should not be mounted in pods except where the workload running in the pod explicitly needs to communicate with the API server.

Category

Controls

Medium

Applies to

Kubernetes

Coverage

null controls, 6 queries

Asset types

6 covered

Overview

Service accounts tokens should not be mounted in pods except where the workload running in the pod explicitly needs to communicate with the API server.

Rationale

Mounting service account tokens inside pods can provide an avenue for privilege escalation attacks where an attacker is able to compromise a single pod in the cluster. Avoiding mounting these tokens removes this attack avenue.

Impact

Pods mounted without service account tokens will not be able to communicate with the API server, except where the resource is available to unauthenticated principals.

Default value

By default, all pods get a service account token mounted in them.

Remediation guidance

Modify the definition of pods and service accounts which do not need to mount service account tokens to disable it.

References

  1. https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/

Multiple Remediation Paths

SERVICE-WIDE (RECOMMENDED when many resources are affected): Apply organization/tenant-level guardrails and baseline policies for the entire platform.

ASSET-LEVEL: Fix only the affected resources identified by this control.

PREVENTIVE: Add preventive policy checks to CI/CD and periodic posture scans.

References for Service-Wide Patterns

  • Platform policy/governance and preventive control patterns should be applied tenant-wide where supported.

Query logic

These are the stored checks tied to this control.

Kubernetes CronJobs pod template which automounts service accounts

Connectors

Kubernetes

Covered asset types

CronJob

Expected check: eq []

{
  cronJobs(
    where: {
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Kubernetes Jobs pod templates which automounts service accounts

Connectors

Kubernetes

Covered asset types

Job

Expected check: eq []

{
  jobs(
    where: {
      cronJobName: ""
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Kubernetes DaemonSets pod templates which automounts service accounts

Connectors

Kubernetes

Covered asset types

DaemonSet

Expected check: eq []

{
  daemonSets(
    where: {
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Kubernetes Deployments pod templates which automounts service accounts

Connectors

Kubernetes

Covered asset types

Deployment

Expected check: eq []

{
  deployments(
    where: {
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Kubernetes ReplicaSets pod templates which automounts service accounts

Connectors

Kubernetes

Covered asset types

ReplicaSet

Expected check: eq []

{
  replicaSets(
    where: {
      deploymentName: ""
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Kubernetes StatefulSets pod templates which automounts service accounts

Connectors

Kubernetes

Covered asset types

StatefulSet

Expected check: eq []

{
  statefulSets(
    where: {
      podTemplate: {
        isAutomountServiceAccountTokenSet: true
        automountServiceAccountToken: true
      }
    }
  ) {
    ...AssetFragment
  }
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon