Anonymous authentication allows unauthenticated users to make requests to the API server. This should be disabled.
apiVersion: rules.spotter.dev/v1alpha1
kind: SpotterRule
metadata:
name: spotter-access-002
labels:
severity: "critical"
category: "access"
annotations:
rules.spotter.dev/title: "Anonymous Auth Is Not Set To False"
rules.spotter.dev/version: "1.0.0"
rules.spotter.dev/cwe: "CWE-306"
rules.spotter.dev/description: "Anonymous authentication allows unauthenticated users to make requests to the API server. This should be disabled."
spec:
match:
resources:
kubernetes:
apiGroups: [""]
versions: ["v1"]
kinds: ["Pod"]
cel: |
(object.kind == "Pod" && has(object.spec.containers) && object.spec.containers.exists(c,
has(c.command) && (c.command.exists(cmd, cmd == "kube-apiserver") || c.command.exists(cmd, cmd == "kubelet")) &&
(
(has(c.args) && c.args.exists(arg, arg == "--anonymous-auth=true")) ||
(has(c.command) && c.command.exists(cmd, cmd == "--anonymous-auth=true")) ||
(has(c.command) && c.command.exists(cmd, cmd.contains("--anonymous-auth=true")))
)
))
remediation:
manual: "Edit the kube-apiserver pod specification file and set the --anonymous-auth flag to false."
references:
- title: "Controlling Access to the Kubernetes API"
url: "https://kubernetes.io/docs/concepts/security/controlling-access/"