-
Notifications
You must be signed in to change notification settings - Fork 553
Home
English | 简体中文
Usage of CDK for attacking targets without prior mutual consent is illegal. CDK is for security testing purposes only.
CDK is an open-sourced container penetration toolkit, designed for offering stable exploitation in different slimmed containers without any OS dependency. It comes with useful net-tools and many powerful PoCs/EXPs helps you to escape container and takeover K8s cluster easily.
Currently still under development, submit issues or mail [email protected] if you need any help.
Download latest release in: https://github.com/cdk-team/CDK/releases/
Drop executable files into target container and start testing.
Usage:
cdk evaluate [--full]
cdk run (--list | <exploit> [<args>...])
cdk auto-escape <cmd>
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
Auto Escape:
cdk auto-escape <cmd> Escape container in different ways then let target execute <cmd>.
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.
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.
CDK have three modules:
- Evaluate: gather information inside container to find potential weakness.
- Exploit: for container escaping, persistance and lateral movement
- Tool: network-tools and APIs for TCP/HTTP requests, tunnels and K8s cluster management.
Usage
cdk evaluate [--full]
This command will run the scripts below without local file scanning, using --full
to enable all.
Tactics | Script | Supported | Usage/Example |
---|---|---|---|
Information Gathering | OS Basic Info | ✔ | link |
Information Gathering | Available Capabilities | ✔ | link |
Information Gathering | Available Linux Commands | ✔ | link |
Information Gathering | Mounts | ✔ | link |
Information Gathering | Net Namespace | ✔ | link |
Information Gathering | Sensitive ENV | ✔ | link |
Information Gathering | Sensitive Process | ✔ | link |
Information Gathering | Sensitive Local Files | ✔ | link |
Information Gathering | Kube-proxy Route Localnet(CVE-2020-8558) | ✔ | link |
Discovery | K8s Api-server Info | ✔ | link |
Discovery | K8s Service-account Info | ✔ | link |
Discovery | Cloud Provider Metadata API | ✔ | link |
List all available exploits:
cdk run --list
Run targeted exploit:
cdk run <script-name> [options]
Tactic | Technique | CDK Exploit Name | Supported | Doc |
---|---|---|---|---|
Escaping | docker-runc CVE-2019-5736 | runc-pwn | ✔ | |
Escaping | containerd-shim CVE-2020-15257 | shim-pwn | ✔ | link |
Escaping | docker.sock PoC (DIND attack) | docker-sock-check | ✔ | link |
Escaping | docker.sock RCE | docker-sock-pwn | ✔ | link |
Escaping | Docker API(2375) RCE | docker-api-pwn | ✔ | link |
Escaping | Device Mount Escaping | mount-disk | ✔ | link |
Escaping | Cgroups Escaping | mount-cgroup | ✔ | link |
Escaping | Procfs Escaping | mount-procfs | ✔ | link |
Escaping | Ptrace Escaping PoC | check-ptrace | ✔ | link |
Escaping | Exploit lxcfs | lxcfs-rw | ✔ | link |
Escaping | Rewrite Cgroup(devices.allow) | rewrite-cgroup-devices | ✔ | link |
Discovery | K8s Component Probe | service-probe | ✔ | link |
Discovery | Dump Istio Sidecar Meta | istio-check | ✔ | link |
Remote Control | Reverse Shell | reverse-shell | ✔ | link |
Credential Access | Access Key Scanning | ak-leakage | ✔ | link |
Credential Access | Dump K8s Secrets | k8s-secret-dump | ✔ | link |
Credential Access | Dump K8s Config | k8s-configmap-dump | ✔ | link |
Persistence | Deploy WebShell | webshell-deploy | ✔ | link |
Persistence | Deploy Backdoor Pod | k8s-backdoor-daemonset | ✔ | link |
Persistence | Deploy Shadow K8s api-server | k8s-shadow-apiserver | ✔ | link |
Persistence | K8s MITM Attack (CVE-2020-8554) | k8s-mitm-clusterip | ✔ | link |
Persistence | Deploy K8s CronJob | k8s-cronjob | ✔ | link |
Running commands like in Linux, little different in input-args, see the usage link.
cdk nc [options]
cdk ps
Command | Description | Supported | Usage/Example |
---|---|---|---|
nc | TCP Tunnel | ✔ | link |
ps | Process Information | ✔ | link |
ifconfig | Network Information | ✔ | link |
vi | Edit Files | ✔ | link |
kcurl | Request to K8s api-server | ✔ | link |
dcurl | Request to Docker HTTP API | ✔ | link |
ucurl | Request to Docker Unix Socket | ✔ | link |
rcurl | Request to Docker Registry API | ||
probe | IP/Port Scanning | ✔ | link |
First off, thanks for taking the time to contribute!
By reporting any issue, ideas or PRs, your GitHub ID will be listed here.
Bugs are tracked as GitHub Issues. Create an issue with the current CDK version, error msg and the environment. Describe the exact steps which reproduce the problem.
Enhancement suggestions are tracked as GitHub Discussions. You can publish any thoughts here to discuss with developers directly.
Fix problems or maintain CDK's quality:
- Describe the current CDK version, environment, problem and exact steps that reproduce the problem.
- Running screenshots or logs before and after you fix the problem.
New feature or exploits:
- Explain why this enhancement would be useful to other users.
- Please enable a sustainable environment for us to review contributions.
- Screenshots about how this new feature works.
- If you are committing a new evaluate/exploit scripts, please add a simple doc to your PR message, here is an example.
- Echo loader for delivering CDK into target container via Web RCE.
- EDR defense evasion.
- Compile optimization.
- Dev docs