Skip to content

[Security Issue] πŸ“’ Metricbeat Multi-Manifest Security Risk ReportΒ #44199

@im-soohyun

Description

@im-soohyun

πŸ“’ 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 access
  • runAsUser: 0 β†’ container runs with root privileges
  • hostPath mounts 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, watch on:
      • nodes, pods, namespaces, deployments, daemonsets, statefulsets, cronjobs, persistentvolumes, etc.
      • Non-resource endpoints like /metrics.
  • Role (metricbeat in kube-system)

    • Grants access to leases (for leader election).
  • Role (metricbeat-kubeadm-config)

    • Grants access to the kubeadm-config ConfigMap, which may contain sensitive bootstrap details.

βœ… 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: 0 with runAsNonRoot: true and assign a non-root UID.
  • Apply readOnlyRootFilesystem: true.

βœ… Restrict Host Access

  • Remove hostNetwork: true unless strictly necessary.
  • Limit hostPath mounts to only essential paths.

βœ… Tighten RBAC Permissions

  • Review the metricbeat ClusterRole:
    • Remove access to unnecessary resources like jobs, cronjobs, persistentvolumes.
  • 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 latest tags; use pinned and signed images.
  • Regularly scan images for known vulnerabilities.

πŸ“‚ References


❗ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs_teamIndicates that the issue/PR needs a Team:* label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions