-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
π’ Metricbeat Multi-Manifest Security Risk Report
π Relevant File
dev-tools/kubernetes/metricbeat/manifest.debug.multi.yaml
π Issue Summary
This manifest defines:
β
Metricbeat DaemonSet (metricbeat-runner)
β
Metricbeat debug Deployment (metricbeat-debugger)
β
Linked ServiceAccount and RBAC (ClusterRole, Role, RoleBinding, ClusterRoleBinding)
Key risk factors identified:
hostNetwork: trueβ direct host network accessrunAsUser: 0β container runs with root privilegeshostPathmounts like/proc,/sys/fs/cgroup- ServiceAccount with cluster-wide read permissions (
ClusterRole)
β‘ Combined, these elements create a high-risk attack surface where a single compromised container can escalate to node or even cluster-wide impact.
π Detailed Analysis
1οΈβ£ DaemonSet and Debug Deployment
-
hostNetwork: true
- Shares the containerβs network namespace with the host β can bind to host ports, sniff network traffic.
-
runAsUser: 0
- Runs the container as root β increases risk of container escape and kernel exploitation.
-
HostPath mounts
/proc,/sys/fs/cgroup,/var/lib/metricbeat-dataβ expose sensitive host system and kernel data to the container.
2οΈβ£ RBAC (ClusterRole + Role + Binding)
-
ClusterRole:
metricbeat- Grants
get,list,watchon:nodes,pods,namespaces,deployments,daemonsets,statefulsets,cronjobs,persistentvolumes, etc.- Non-resource endpoints like
/metrics.
- Grants
-
Role (
metricbeatin kube-system)- Grants access to
leases(for leader election).
- Grants access to
-
Role (
metricbeat-kubeadm-config)- Grants access to the
kubeadm-configConfigMap, which may contain sensitive bootstrap details.
- Grants access to the
β
RBAC-Linked Risk
If the ServiceAccount token is stolen inside the container:
- The attacker can enumerate and query sensitive cluster-wide resources.
- Combined with the node-level privileges (hostNetwork, root), this magnifies the blast radius beyond a single pod or node.
β οΈ Security Risk Summary
| Risk Item | Description |
|---|---|
| hostNetwork | Enables host-level network access β risk of sniffing, port hijacking, lateral movement. |
| runAsUser: 0 (root) | Runs as root β increases risk of container escape, kernel-level attacks. |
HostPath mounts (/proc, /sys) |
Exposes detailed host kernel and process information. |
| ServiceAccount + ClusterRole | Broad cluster-wide read permissions; if compromised, allows cluster reconnaissance. |
π οΈ Recommended Actions
β Minimize Container Privileges
- Replace
runAsUser: 0withrunAsNonRoot: trueand assign a non-root UID. - Apply
readOnlyRootFilesystem: true.
β Restrict Host Access
- Remove
hostNetwork: trueunless strictly necessary. - Limit
hostPathmounts to only essential paths.
β Tighten RBAC Permissions
- Review the
metricbeatClusterRole:- Remove access to unnecessary resources like
jobs,cronjobs,persistentvolumes.
- Remove access to unnecessary resources like
- Use namespace-scoped Roles where possible; avoid cluster-wide bindings unless needed.
- Refer to Kubernetes RBAC Best Practices.
β Harden Pod Security
- Apply seccomp, AppArmor, or SELinux profiles.
- Follow Kubernetes Pod Security Standards (baseline or restricted level).
β Strengthen Image Security
- Avoid
latesttags; use pinned and signed images. - Regularly scan images for known vulnerabilities.
π References
- Metricbeat Kubernetes Setup Guide
- Kubernetes Pod Security Standards
- RBAC Best Practices
- HostPath Volume Risks
β Summary
This Metricbeat multi-manifest provides powerful observability but combines container-level privileges (host access, root execution) with RBAC that grants broad cluster-wide read permissions, creating serious security risks.
To reduce the attack surface, it is critical to review RBAC permissions and apply the principle of least privilege.
:kubernetes