用大模型分析日志和配置,自动优化K8s权限以减少安全风险。
KubeGuard: LLM-Assisted Kubernetes Hardening via Configuration Files and Runtime Logs Analysis
- 通过大模型解析配置文件和运行日志,生成最小权限配置。
- 在角色、网络策略等关键资源上实现高精度的配置推荐。
- 适合运维与开发人员提升云原生集群安全性。
Kubernetes(K8s)在云原生应用编排中的广泛应用带来了显著的安全挑战,如资源配置错误和权限过度开放。若不及时处理,可能导致未授权访问、权限提升及横向移动。现有K8s安全方案多聚焦于静态分析或异常检测来发现配置错误。本文提出KubeGuard,一种基于运行时日志的推荐框架,旨在通过解决权限过度开放问题来强化K8s环境。KubeGuard通过两个互补任务——资源创建与资源优化——实现硬防护:利用大语言模型(LLMs)分析配置清单(manifests)与反映实际行为的运行时日志,采用模块化提示链工作流,为新资源生成最小权限配置,并对现有清单进行精炼以缩小攻击面。其输出为可审核采纳的配置建议。评估表明,KubeGuard在角色(Roles)、网络策略(NetworkPolicies)和部署(Deployments)方面均能有效生成与优化配置,支持专有及开源大模型。高精确率、召回率与F1分数验证了其作为将运行时可观测性转化为可操作的最小权限指导框架的实际可行性。
原文摘要 · Abstract (English)
The widespread adoption of Kubernetes (K8s) for orchestrating cloud-native applications has introduced significant security challenges, such as misconfigured resources and overly permissive configurations. Failing to address these issues can result in unauthorized access, privilege escalation, and lateral movement within clusters. Most existing K8s security solutions focus on detecting misconfigurations, typically through static analysis or anomaly detection. In contrast, this paper presents KubeGuard, a novel runtime log-driven recommender framework aimed at mitigating risks by addressing overly permissive configurations. KubeGuard is designed to harden K8s environments through two complementary tasks: Resource Creation and Resource Refinement. It leverages large language models (LLMs) to analyze manifests and runtime logs reflecting actual system behavior, using modular prompt-chaining workflows. This approach enables KubeGuard to create least-privilege configurations for new resources and refine existing manifests to reduce the attack surface. KubeGuard's output manifests are presented as recommendations that users (e.g., developers and operators) can review and adopt to enhance cluster security. Our evaluation demonstrates that KubeGuard effectively generates and refines K8s manifests for Roles, NetworkPolicies, and Deployments, leveraging both proprietary and open-source LLMs. The high precision, recall, and F1-scores affirm KubeGuard's practicality as a framework that translates runtime observability into actionable, least-privilege configuration guidance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。