arXiv:2608.26699cs.CRAug 2026

Manuscript Offprint

arXiv:2608.26699

KubeCap: A Framework for Capability Minimization in Kubernetes via Static Analysis and LLM-Assisted Rule Inference

Yuhao Liu, Yingnan Zhou, Weijie Liu, Yan Jia, Zheli Liu

Yuhao Liu, Yingnan Zhou, Weijie Liu ∗^{*}, Yan Jia ∗^{*}, and Zheli Liu

Key Laboratory of Data and Intelligent System Security, Ministry of Education, China (DISSec),

Tianjin Key Laboratory of Network and Data Security Technology (NDST),

College of Cryptology and Cyber Science, Nankai University, Tianjin 300350, China

{yuhao.liu, yingnan.zhou}@mail.nankai.edu.cn

{weijieliu, jiay, liuzheli}@nankai.edu.cn

Abstract—As the most widely used container orchestration platform, Kubernetes provides flexible privilege configuration by allowing developers to manage Linux capabilities via manifest files. However, developers rely on default settings or coarse-grained security contexts in practice, violating the principle of least privilege and enlarging the attack surface of containerized workloads. Existing studies either detect vulnerable patterns in Kubernetes manifests or infer required capabilities for standalone Linux programs, but they do not directly address capability minimization in Kubernetes.

To bridge this gap, we first conduct an empirical study on three open-source datasets, revealing that 74.67% of projects lack capability configurations. Motivated by our observations, we propose KubeCap, a framework for Kubernetes capability minimization. KubeCap translates deployment specifications into deterministic manifests, locates container entrypoints, performs reachability-guided system call analysis, and leverages LLM-assisted rule specification to derive syscall-parameter-capability relations from Linux kernel code. Based on these results, KubeCap infers the minimal capability set required by each workload and automatically generates repaired manifests. Evaluation on 10 representative Go-based Kubernetes projects shows an average capability reduction rate of 54.97%, outperforming rapid type analysis and class hierarchy analysis baselines while maintaining practical analysis cost. These results demonstrate KubeCap's effectiveness in enforcing least privilege in Kubernetes.

Index Terms—Kubernetes, least privilege, Linux capabilities, privilege minimization, static analysis.

I. INTRODUCTION

Kubernetes (K8s) is an open source container orchestration system governed by Cloud Native Computing Foundation (CNCF) [1]. It is used to automate the deployment, capacity expansion, load balancing, rolling update, fault recovery, and other tasks of container applications [2]. Kubernetes applications are typically deployed through declarative YAML manifests, which specify workload objects such as Pods, which are the basic execution units that encapsulate one or more containers. Among the configuration fields of the manifests, securityContext defines security-sensitive runtime settings for a container or Pod. The securityContext field

cloudify-kubernetes-plugin

Description:

1 apiVersion: v1 2 kind: Pod 3 spec: 4 containers: 5 - name: cloudify-manager 6 image: cloudifyplatform/premium 7 ... 8 securityContext: 9 capabilities: 10 add: ["SYS_ADMIN"] 11 volumeMounts: 12 - mountPath: /sys/fs/cgroup 13 ...

The manifest grants the container the SYS_ADMIN Linux capability through securityContext.capabilities.add.

Impact:

Granting SYS_ADMIN may weaken container isolation and increase the likelihood of container breakout or host-level abuse.

Fig. 1. An example of the privileged container in the pod manifest of cloudify-kubernetes-plugins.

in a Pod manifest controls permission-related parameters, such as capabilities, privileged, and runAsNonRoot, which directly determine how much authority a containerized process holds over the underlying host system.

Although Kubernetes has become the mainstream platform for container orchestration, its flexibility in configuring container privileges introduces severe security challenges [3], [4]. The mechanisms of securityContext are intended to support the principle of least privilege. Security guidelines and compliance controls recommend minimizing assigned capabilities whenever possible [5]. However, the least privilege is difficult to enforce in practice. In Kubernetes deployments, to avoid complex permission debugging, developers often grant containers excessive privileges in the securityContext of YAML manifests, such as directly assigning CAP_SYS_ADMIN or enabling privileged: true [6]. Even when developers do not explicitly enable fully privileged mode, containers still inherit a default set of Linux capabilities assigned by the container runtime, many of which are unnecessary for

  • Weijie Liu and Yan Jia are corresponding authors.

the application’s normal operation. This over-privileged configuration greatly expands the system’s attack surface. For example, as shown in Figure 1, the manifest grants the container cloudify-manager the broad CAP_SYS_ADMIN capability. Such a configuration weakens container isolation and exposes the workload to a larger set of kernel-level operations. This excessive privilege may further increase the risk of container escape or host-level abuse. In addition, He et al. [3] and Yang et al. [7] demonstrated that even a single misconfigured privileged container can compromise an entire cluster through eBPF-based privilege escalation.

To bridge the gap, we conducted an empirical study on three open-source Kubernetes datasets. Our results reveal that explicit capability configuration remains uncommon. Specifically, 74.67% of projects lack capability configurations, and only 19.33% adopt the least-privilege pattern. Based on these findings, we propose KubeCap, a Kubernetes capability minimization framework with five components. First, it translates raw K8s template files into deployable manifests and extracts workload-level capability configurations. Second, it performs entrypoint localization to recover the actual executables and source-level entry files of containers, including multi-container settings such as init containers. Third, it conducts reachability-guided system call analysis on the recovered entrypoints to identify the system calls that are relevant to the deployed workload. Fourth, it leverages the LLM-assisted rule specification and minimal capability inference to derive precise syscall-parameter-capability relations from Linux kernel code and infer the minimal capability set required by each workload. Finally, it performs deviation analysis between the originally declared capabilities and the inferred minimal set, and automatically generates repaired manifests that enforce least privilege.

We evaluate KubeCap on 10 representative Go-based projects of Kubernetes. The results show that KubeCap achieves an average capability reduction rate of 54.97%, removing redundant privileges from real-world workloads. Compared with rapid type analysis (RTA) and class hierarchy analysis (CHA), the reachability-based design achieves a higher average reduction rate (54.97%, 38.00% and 7.68%, respectively). Points-to analysis (PTA) is competitive when it completes but often times out on larger projects. Case studies further validate the practicality of KubeCap on real-world projects. In addition, KubeCap achieves practical performance that the analysis completes within a few minutes on the largest subjects and within tens of seconds on most others, while keeping memory usage in a similar range of about 1 to 3.5 GiB. These results demonstrate that KubeCap can effectively and efficiently precompute minimized capabilities for K8s workloads.

In summary, we make the main contributions as follows:

• Empirical study. We conducted an empirical study on three open-source Kubernetes datasets and show that 74.67% of projects do not explicitly configure capabilities, and only 19.33% explicitly remove default capabilities.

• Tool. We propose KubeCap, a framework for Kubernetes capability minimization. It can infer workload-specific minimal capability sets and generate repaired K8s manifests to prevent the over-privileged capability configurations in Kubernetes manifests. We make KubeCap publicly available at https://github.com/anabioticsoul/KubeCap/.

• Effectiveness. Evaluation on 10 Kubernetes projects shows that KubeCap removes redundant capabilities, achieving an average reduction rate of 54.97% with practical time and memory overhead.

References (45)