在扫描中应用 Kubernetes 上下文以抑制漏洞
Suppress vulnerabilities applying Kubernetes context to scans

原始链接: https://github.com/alegrey91/vex8s

**Vex8s** 是一款实验性工具,旨在通过确定容器漏洞(CVE)在特定的 Kubernetes 环境中是否真正可被利用,从而生成 VEX(漏洞可利用性交换)文档。 该工具通过将漏洞数据(CVE/CWE)与容器的 `securityContext` 进行关联来发挥作用。Vex8s 使用内置的机器学习模型或 Google Gemini 大语言模型来分析漏洞描述,将 CVE 映射到特定的可利用性类别。随后,它会将这些分析结果与 Kubernetes 的清单(manifest)配置进行对比,以查看现有的安全配置是否有效降低了风险。如果某个 CVE 因这些配置而被判定为不可利用,Vex8s 将在最终的 VEX 文档中过滤掉该漏洞。 Vex8s 支持两种工作模式: * **被动模式**:处理来自 Trivy 或 Grype 等工具的现有漏洞报告。 * **主动模式**:在生成 VEX 文件前,自动使用 Trivy 或 Grype 引擎执行扫描。 本项目受 *vexllm* 启发,通过聚焦于基于实际工作负载配置的可操作安全威胁,帮助减少告警疲劳。有关详细用法(包括如何配置 Gemini 分类器或标准 CLI 命令),请参阅官方文档。

开发者 alegrey91 发布了 **vex8s**,这是一个开源工具,旨在通过考虑特定的安全配置来优化 Kubernetes 漏洞扫描。 传统的扫描程序经常会标记出在特定部署中实际上无法利用的漏洞。为了减少这种噪音,vex8s 会分析工作负载的 `SecurityContext`(例如 `readOnlyRootFilesystem`、丢弃的 capabilities 以及非 root 用户设置),以确定这些配置是否能有效缓解现有漏洞。 该工具利用一个基于 CVE 数据训练的集成机器学习模型对漏洞进行分类,并将其与工作负载的 Kubernetes 安全设置进行交叉比对。最终输出的是一份 VEX(漏洞可利用性交换)文档,其中仅突出显示在给定环境中真正具有可操作性的威胁。作者目前正在征求社区对决策逻辑以及该工具与现有漏洞扫描流程集成潜力的反馈。 你可以在 GitHub 上找到该项目:https://github.com/alegrey91/vex8s
相关文章

原文

vex8s (this logo is not AI generated)

Vex8s generates VEX documents by correlating container vulnerabilities with Kubernetes settings to determine which CVEs are actually exploitable in your cluster.

Please note, this is an experimental project. Things might change quickly.

The project aims to assess the exploitability of known CVEs within Kubernetes workloads by combining vulnerability classification and securityContext analysis.

vex8s-logic

It is based on the following concept:

  • Each CVE is categorized into one or more vulnerability classes (CWE)
  • CVE description is processed by an embedded ML model to predict its exploitation category.
  • Both the CWEs and the predicted exploitation categories are combined to determine if the CVE is mitigable.
  • Each exploitation category, maps to a set of Kubernetes settings that can block or reduce the impact.
  • By parsing a Kubernetes manifest, we can inspect the container settings to evaluate whether the relevant settings are in place.
  • Combining both analyses allows the system to determine if a CVE is exploitable in a given workload configuration.
  • If it results in a CVE mitigation, we add this to the final VEX document.

For a more in-depth reading you can consult this paper: Environment-Aware Vulnerability Suppression Using Kubernetes Security Contexts and VEX

You can download the latest binary from the release page.

Or you can build it manually:

vex8s currently supports 2 ways to generate VEX documents:

  • passive-mode: passing an already generated vulnerability report created by trivy or grype.

  • active-mode: actively scanning the images using trivy or grype engines and then gereating the document based on the results.

Passive mode (recommended)

Using trivy:

# generate vulnerability report.
trivy image --format json --output nginx.trivy.json nginx:1.21.0

# generate VEX document by processing vulnerability report.
vex8s generate --manifest examples/nginx.yaml --report nginx.trivy.json --output nginx.vex.json

# scan again with VEX document to suppress vulnerabilities.
trivy image --vex nginx.vex.json --show-suppressed nginx:1.21.0

The same can be applied using grype:

# generate sbom report.
grype --output cyclonedx-json --file nginx.grype.json nginx:1.21.0

# generate vulnerability report.
grype sbom:./nginx.grype.json --output json --file nginx.grype-vr.json

# generate VEX document by processing vulnerability report.
vex8s generate --manifest examples/nginx.yaml --report nginx.grype-vr.json --output nginx.vex.json

# scan sbom with VEX document to suppress vulnerabilities.
grype sbom:./nginx.grype.json --output table --vex nginx.vex.json --show-suppressed

Using trivy:

# scan the image and automatically generate VEX document.
vex8s generate --manifest examples/nginx.yaml --scan.engine trivy --output nginx.vex.json

# scan again with VEX document to suppress vulnerabilities.
trivy image --vex nginx.vex.json --show-suppressed nginx:1.21.0

The same can be applied using grype:

# generate sbom report.
grype --output cyclonedx-json --file nginx.grype.json nginx:1.21.0

# scan the image and automatically generate VEX document.
vex8s generate --manifest examples/nginx.yaml --scan.engine grype --output nginx.vex.json

# scan sbom with VEX document to suppress vulnerabilities.
grype sbom:./nginx.grype.json --output table --vex nginx.vex.json --show-suppressed

Each CVE is classified into one or more exploitation classes, which drive the mitigation decision. vex8s supports two classifier engines via --classifier:

  • embedded (default): an offline ONNX ML model bundled in the binary. No network access required.
  • gemini: uses Google's Gemini LLM to classify the CVE description. Requires the GEMINI_API_KEY environment variable (optionally GEMINI_MODEL).
export GEMINI_API_KEY="your-api-key"

vex8s generate --manifest examples/nginx.yaml --report nginx.trivy.json \
  --output nginx.vex.json --classifier gemini

See the documentation — in particular the User Guide — for a full walkthrough, the Gemini classifier setup, and a complete flag reference.

This project was inspired by Akihiro Suda's project vexllm.

联系我们 contact @ memedata.com