Communitygithub.com

kube-bench를 활용한 쿠버네티스 벤치마킹

kube-bench는 CIS 쿠버네티스 벤치마크에 따라 클러스터 보안을 점검하는 오픈소스 도구입니다.

kube-bench를 활용한 쿠버네티스 벤치마킹란 무엇인가요?

이 스킬은 kube-bench(Aqua Security)를 사용하여 쿠버네티스 클러스터의 보안 구성을 CIS 쿠버네티스 벤치마크 기준으로 점검하는 방법을 안내합니다. kube-bench는 API 서버, 컨트롤러 매니저, 스케줄러, etcd, kubelet, 워커 노드 구성 및 클러스터 전체 정책 설정을 검사하고, 각 항목을 PASS, FAIL, WARN, INFO로 보고하며 CIS 지침에 따른 조치 권장 사항을 제공합니다. 이 도구는 독립 실행형 바이너리, 컨테이너, 또는 쿠버네티스 Job으로 실행할 수 있으며, EKS, GKE, AKS 등 관리형 배포판을 지원합니다. 스킬에는 기본 스캔 실행, 특정 구성 요소 대상 지정, 벤치마크 버전 고정, 개별 항목 선택/건너뛰기, JSON/JUnit 출력 생성, 결과 심사 및 조치, 재검증 및 추세 추적을 위한 PostgreSQL 저장 등의 워크플로우가 포함됩니다. 또한 T1610(컨테이너 배포)과 같은 MITRE ATT&CK 공격에 대한 표면을 줄이는 데 기여합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/benchmarking-kubernetes-with-kube-bench

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

kube-bench를 활용한 쿠버네티스 벤치마킹은(는) 무엇을 하나요?

개요

kube-bench(Aqua Security)는 CIS 쿠버네티스 벤치마크에 문서화된 검사를 실행하여 쿠버네티스 클러스터가 안전하게 배포되었는지 확인하는 오픈소스 도구입니다. 컨트롤 플레인 구성 요소(API 서버, 컨트롤러 매니저, 스케줄러, etcd), kubelet 및 워커 노드 구성, 클러스터 전체 정책 설정을 검사하고 각 검사를 PASS, FAIL, WARN, INFO로 보고하며 CIS 지침에 따른 조치 권장 사항을 제공합니다. 테스트는 구성 기반 YAML 파일로 제공되므로 kube-bench는 새로운 쿠버네티스 버전과 벤치마크 개정판을 추적하고 관리형 배포판(EKS, GKE, AKS, ACK, OpenShift, RKE, k3s)을 지원합니다.

CIS 벤치마크에 따라 클러스터를 강화하면 T1610(컨테이너 배포) 공격 표면을 직접 줄일 수 있습니다. 이는 공격자가 권한 있는 컨테이너, 호스트 네임스페이스, 익명 API 액세스 또는 강화되지 않은 클러스터가 노출하는 안전하지 않은 kubelet 설정 등을 악용하여 코드를 실행하거나 방어를 우회하는 데 사용됩니다.

kube-bench는 노드에서 독립 실행형 바이너리로, 컨테이너 내부에서, 또는 가장 일반적으로 호스트 파일 시스템을 마운트하여 관련 구성 파일을 읽을 수 있는 쿠버네티스 Job으로 실행할 수 있습니다. 출력은 사람이 읽을 수 있는 텍스트, JSON, JUnit 또는 AWS 보안 검색 형식(ASFF)으로 제공되며 PostgreSQL 데이터베이스로 전송하여 추세 추적을 할 수 있습니다.

사용 시기

  • 새로운 쿠버네티스 클러스터에 대해 CIS 쿠버네티스 벤치마크 기준 보안 기준선을 설정할 때
  • 컨트롤 플레인 및 노드 강화에 대한 정기적인 규정 준수 감사를 수행할 때
  • 강화 변경 사항을 적용한 후 조치를 검증할 때(재실행하여 검사가 PASS인지 확인)
  • 클러스터 규정 준수 스캐닝을 CI/CD 또는 지속적 모니터링 파이프라인에 통합할 때
  • SOC 2, PCI DSS 또는 내부 강화 규정 준수에 대한 증거를 준비할 때

사전 요구 사항

  • 클러스터에 대한 액세스: 컨트롤 플레인/워커 노드에 대한 SSH 액세스(바이너리 모드) 또는 Job을 생성할 수 있는 권한이 있는 kubectl(클러스터 내 모드)
  • 클러스터의 쿠버네티스 버전에 대한 지식(kube-bench 자동 감지 또는 --version / --benchmark로 지정 가능)
  • kube-bench 설치(Aqua Security 공식 방법):
# 바이너리 릴리스 (Linux)
KB_VERSION=0.10.7
curl -L -o kube-bench.tgz \
  "https://github.com/aquasecurity/kube-bench/releases/download/v${KB_VERSION}/kube-bench_${KB_VERSION}_linux_amd64.tar.gz"
tar -xzf kube-bench.tgz
sudo mv kube-bench /usr/local/bin/
sudo cp -R cfg /etc/kube-bench/cfg

# Go install로 설치
go install github.com/aquasecurity/kube-bench@latest

# 노드에서 일회성 컨테이너로 직접 실행 (호스트 구성 마운트)
docker run --rm --pid=host \
  -v /etc:/etc:ro -v /var:/var:ro \
  -t docker.io/aquasec/kube-bench:latest run --targets node

# 설치 확인
kube-bench version

목표

  • 클러스터의 쿠버네티스 버전에 적합한 벤치마크로 kube-bench 실행
  • 컨트롤 플레인(마스터), 노드, etcd, 컨트롤 플레인 정책 및 관리형 서비스 대상 스캔
  • 파이프라인 및 대시보드를 위한 기계 판독 가능 JSON/JUnit 출력 생성
  • FAIL 및 WARN 결과 심사 및 CIS 조치 지침 적용
  • 조치 후 재실행하여 이제 PASS인지 확인

MITRE ATT&CK 매핑

기술 ID이름전술관련성
T1610컨테이너 배포실행 / 방어 우회kube-bench에 의해 적용되는 CIS 벤치마크 강화는 공격자가 악성 컨테이너를 배포할 때 악용하는 권한 있는/호스트 네임스페이스 배포, 익명 API 액세스 및 안전하지 않은 kubelet 설정을 제한합니다.

워크플로우

1. 기본 스캔 실행 (자동 감지)

모든 해당 대상을 실행하여 kube-bench가 쿠버네티스 버전과 벤치마크를 감지하도록 합니다:

sudo kube-bench

2. 쿠버네티스 Job으로 실행 (클러스터 내)

kube-bench 리포지토리에서 제공하는 Job 매니페스트를 적용하고 파드 로그에서 결과를 읽습니다:

# 범용 Job
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml

# 대기 후 결과 검색
kubectl get pods -l app=kube-bench
kubectl logs -l app=kube-bench

# 플랫폼별 Job 사용 가능, 예: EKS:
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job-eks.yaml

3. 특정 구성 요소 대상 지정

run --targets를 사용하여 특정 구성 요소 그룹으로 스캔 범위를 지정합니다:

# 컨트롤 플레인 (API 서버, 스케줄러, 컨트롤러 매니저)
sudo kube-bench run --targets master

# 워커 노드 (kubelet, 프록시)
sudo kube-bench run --targets node

# etcd 데이터 저장소
sudo kube-bench run --targets etcd

# 클러스터 전체 정책 (RBAC, 파드 보안, 네트워크 정책)
sudo kube-bench run --targets policies

# 여러 대상 결합
sudo kube-bench run --targets master,node,etcd,policies

4. 특정 벤치마크 또는 쿠버네티스 버전 고정

자동 감지가 잘못되었거나 특정 개정판을 기준으로 감사해야 하는 경우 벤치마크를 명시적으로 고정합니다:

# 특정 CIS 벤치마크 개정판 고정
sudo kube-bench run --benchmark cis-1.8

# 또는 쿠버네티스 버전으로 매핑
sudo kube-bench --version 1.27

# 관리형/배포판별 벤치마크
sudo kube-bench run --benchmark eks-1.5.0
sudo kube-bench run --benchmark gke-1.6.0
sudo kube-bench run --benchmark rke2-cis-1.7

5. 개별 검사 실행 또는 건너뛰기

조치 주기 중에 특정 검사 ID에 집중하거나 제외합니다:

# 특정 검사만 실행
sudo kube-bench run --targets master --check 1.2.1,1.2.2

# 노이즈가 많거나 알려진 허용 검사 건너뛰기
sudo kube-bench run --targets node --skip 4.2.6

6. 기계 판독 가능 출력 생성

파이프라인, SIEM 또는 대시보드에 입력하기 위해 JSON 또는 JUnit을 내보내고 파일에 기록합니다:

# JSON 파일로 출력
sudo kube-bench run --targets master,node --json --outputfile kube-bench-report.json

# JUnit (CI 테스트 보고용)
sudo kube-bench --junit --outputfile kube-bench-junit.xml

# AWS 보안 검색 형식 (Security Hub용)
sudo kube-bench run --targets node --asff

7. FAIL/WARN 결과 심사 및 조치

각 실패한 검사는 조치를 출력합니다. 노드/매니페스트에 CIS 권장 수정 사항을 적용합니다. 예를 들어 정적 파드 매니페스트에서 API 서버 플래그를 강화합니다:

# 일반적인 컨트롤 플레인 FAIL에 대한 조치 예시:
# CIS 1.2.x — API 서버에서 anonymous-auth를 비활성화합니다.
# 정적 파드 매니페스트를 편집하고 플래그를 설정합니다:
sudo vi /etc/kubernetes/manifests/kube-apiserver.yaml
#   - --anonymous-auth=false
# kubelet이 자동으로 정적 파드를 다시 시작합니다.

# 노드 조치 예시 — kubelet 구성 파일 권한 (CIS 4.1.x):
sudo chmod 600 /etc/kubernetes/kubelet/kubelet-config.json
sudo chown root:root /etc/kubernetes/kubelet/kubelet-config.json

8. 조치 후 재검증

해당 대상을 다시 실행하고 이전에 실패한 검사가 이제 PASS인지 확인한 후 시간에 따른 점수를 추적합니다:

sudo kube-bench run --targets master --check 1.2.1 --json --outputfile recheck.json

# 선택 사항: 추세 추적을 위해 결과를 PostgreSQL에 저장
sudo kube-bench run --targets master,node --pgsql

도구 및 리소스

도구 / 리소스목적링크
kube-benchCIS 쿠버네티스 벤치마크 검사기https://github.com/aquasecurity/kube-bench
kube-bench 문서실행 / 플랫폼 / 플래그https://aquasecurity.github.io/kube-bench/
CIS 쿠버네티스 벤치마크원본 강화 표준https://www.cisecurity.org/benchmark/kubernetes
Trivy Operator지속적인 클러스터 내 규정 준수 + 취약점 스캐닝https://github.com/aquasecurity/trivy-operator
kube-hunter보완적 침투 테스트 도구https://github.com/aquasecurity/kube-hunter

검증 기준

  • kube-bench 설치됨 (kube-bench version) 또는 Job으로 실행 중
  • 클러스터의 쿠버네티스 버전에 맞는 올바른 벤치마크로 스캔 실행됨
  • master, node, etcd 및 policies 대상 각각 스캔됨
  • 파이프라인/대시보드 입력을 위한 JSON/JUnit 출력 생성됨
  • FAIL 및 WARN 결과 심사 및 우선순위 지정됨
  • CIS 조치가 컨트롤 플레인 매니페스트 및 노드 구성에 적용됨
  • 재실행하여 이전에 실패한 검사가 이제 PASS인지 확인됨
  • 결과가 시간에 따라 추적됨 (파일 아카이브 또는 PostgreSQL)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

관련 스킬