Service Account Admission Control Plugin Disabled
- Query id: 9587c890-0524-40c2-9ce2-663af7c2f063
- Query name: Service Account Admission Control Plugin Disabled
- Platform: Kubernetes
- Severity: Medium
- Category: Access Control
- CWE: 284
- URL: Github
Description¶
When using kube-apiserver command, the '--disable-admission-plugins' flag should not have 'ServiceAccount' plugin
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--disable-admission-plugins=ServiceAccount"]
restartPolicy: OnFailure
Positive test num. 2 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver","--disable-admission-plugins=ServiceAccount"]
args: []
restartPolicy: OnFailure
Code samples without security vulnerabilities¶
Negative test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--enable-admission-plugins=ServiceAccount", "--admission-control-config-file=path/to/plugin/config/file.yaml"]
restartPolicy: OnFailure