Anonymous Auth Is Not Set To False
- Query id: 1de5cc51-f376-4638-a940-20f2e85ae238
- Query name: Anonymous Auth Is Not Set To False
- Platform: Kubernetes
- Severity: Medium
- Category: Access Control
- CWE: 1390
- URL: Github
Description¶
When using the kubelet or kube-apiserver command, the 'anonymous-auth' flag should be set to false (--anonymous-auth=false)
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", "--anonymous-auth=true"]
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"]
args: ["--anonymous-auth=true"]
restartPolicy: OnFailure
Positive test num. 3 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: foo/bar
command: ["kubelet", "--anonymous-auth=true"]
restartPolicy: OnFailure
Positive test num. 4 - yaml file
Positive test num. 5 - yaml file
Positive test num. 6 - json file
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", "--anonymous-auth=false"]
restartPolicy: OnFailure
Negative 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"]
args: ["--anonymous-auth=false"]
restartPolicy: OnFailure
Negative test num. 3 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: foo/bar
command: ["kubelet"]
args: ["--anonymous-auth=false"]
restartPolicy: OnFailure