Metarget is a framework providing automatic constructions of vulnerable infrastructures.
Metarget is a framework providing automatic constructions of vulnerable infrastructures.
Metarget = meta- + target, a framework providing automatic constructions of vulnerable infrastructures, used to deploy simple or complicated vulnerable cloud native targets swiftly and automatically.
During security researches, we might find that the deployment of vulnerable environment often takes much time, while the time spent on testing PoC or ExP is comparatively short. In the field of cloud native security, thanks to the complexity of cloud native systems, this issue is more terrible.
There are already some excellent security projects like Vulhub, VulApps in the open-source community, which pack vulnerable scenes into container images, so that researchers could utilize them and deploy scenes quickly.
However, these projects mainly focus on vulnerabilities in applications. What if we need to study the vulnerabilities in the infrastructures like Docker, Kubernetes and even Linux kernel?
Hence, we develop Metarget and hope to solve the deployment issue above to some extent. Furthermore, we also expect that Metarget could help to construct multilayer vulnerable cloud native scenes automatically.
In this project, we come up with concepts like installing vulnerabilities and installing vulnerable scenes. Why not install vulnerabilities just like installing softwares? We can do that, because our goals are security research and offensive security.
To be exact, we expect that:
metarget cnv install cve-2019-5736 will install Docker with CVE-2019-5736 onto the server.metarget cnv install cve-2018-1002105 will install Kubernetes with CVE-2018-1002105 onto the server.metarget cnv install kata-escape-2020 will install Kata-containers with CVE-2020-2023/2025/2026 onto the server.metarget cnv install cve-2016-5195 will install a kernel with DirtyCoW into the server.It's cool, right? No more steps. No RTFM. Execute one command and enjoy your coffee.
Furthermore, we expect that:
metarget appv install dvwa will install a DVWA target onto our vulnerable infrastructure.metarget appv install thinkphp-5-0-23-rce --external will install a ThinkPHP RCE vulnerability with NodePort service onto our vulnerable infrastructure.You can just run 5 commands below after installing a new Ubuntu and obtain a multi-layer vulnerable scene:
./metarget cnv install cve-2016-5195 # container escape with dirtyCoW
./metarget cnv install cve-2019-5736 # container escape with docker
./metarget cnv install cve-2018-1002105 # kubernetes single-node cluster with cve-2018-1002105
./metarget cnv install privileged-container # deploy a privileged container
./metarget appv install dvwa --external # deploy dvwa targetRCE, container escape, lateral movement, persistence, they are yours now.
More awesome functions are coming! Stay tuned :)
Note:
This project aims to provide vulnerable scenes for security research. The security of scenes generated is not guaranteed. It is NOT recommended to deploy components or scenes with Metarget on the Internet.
Clone the repository and install requirements:
git clone https://github.com/Metarget/metarget.git
cd metarget/
pip3 install -r requirements.txtBegin to use Metarget and construct vulnerable scenes. For example:
./metarget cnv install cve-2019-5736Currently unsupported.
Metarget needs to be run as root.
It is recommended to add --verbose option when debugging.
usage: metarget [-h] [-v] subcommand ...
automatic constructions of vulnerable infrastructures
positional arguments:
subcommand description
gadget cloud native gadgets (docker/k8s/...) management
cnv cloud native vulnerabilities management
appv application vulnerabilities management
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exitRun ./metarget gadget list to see cloud native components supported currently.
usage: metarget gadget [-h] subcommand ...
positional arguments:
subcommand description
list list supported gadgets
install install gadgets
remove uninstall gadgets
optional arguments:
-h, --help show this help message and exitRun
./metarget gadget list docker/k8s/containerd/runc/kernelto see cloud native components' supported versions currently.
Run:
./metarget gadget install docker --version 18.03.1If the command above completes successfully, 18.03.1 Docker will be installed.
Run:
./metarget gadget install k8s --version 1.28.4If the command above completes successfully, a 1.28.4 Kubernetes single-node cluster will be installed.
Supported Kubernetes version range: 1.9 – 1.33.
Note:
Metarget provides the following options for Kubernetes installation:
…Container runtime selection:
metarget gadget install docker). Use --runtime containerd to force containerd.--runtime auto default). No manual Docker installation needed.--runtime docker: Automatically installs cri-dockerd as the CRI shim (Docker must be pre-installed). Use --runtime-version to pin a specific cri-dockerd version.Examples:
# Install k8s 1.28 with containerd (auto-selected)
./metarget gadget install k8s --version 1.28.4
# Install k8s 1.28 with a specific containerd version
./metarget gadget install k8s --version 1.28.4 --runtime containerd --runtime-version 1.6.28
# Install k8s 1.28 with Docker + cri-dockerd (Docker must be pre-installed)
./metarget gadget install k8s --version 1.28.4 --runtime docker
# Install k8s 1.20 with containerd (forced on an older version)
./metarget gadget install k8s --version 1.20.15 --runtime containerdMetarget supports deployment of multi-node cluster. If you want to add more nodes into the cluster, you can copy tools/install_k8s_worker.sh script and run it on each worker nodes after the successful installation of single-node cluster.
Run:
./metarget gadget install kata --version 1.10.0If the command above completes successfully, 1.10.0 Kata-containers will be installed.
Note:
You can also specify the type of kata runtime (qemu/clh/fc/...) with --kata-runtime-type option, which is qemu by default.
Run:
./metarget gadget install kernel --version 5.7.5If the command above completes successfully, 5.7.5 kernel will be installed.
Note:
Currently, Metarget installs kernels in 2 ways:
After successful installation of kernel, reboot of system is needed. Metarget will prompt to reboot automatically.
Run:
./metarget gadget install containerd --version 1.7.14If the command above completes successfully, 1.7.14 containerd will be installed and automatically configured as a Kubernetes CRI runtime (SystemdCgroup = true), ready to use with metarget gadget install k8s.
Run:
./metarget gadget install runc --version 1.1.6If the command above completes successfully, 1.1.6 runc will be installed.
usage: metarget cnv [-h] subcommand ...
positional arguments:
subcommand description
list list supported cloud native vulnerabilities
install install cloud native vulnerabilities
remove uninstall cloud native vulnerabilities
optional arguments:
-h, --help show this help message and exitRun ./metarget cnv list to see vulnerable scenes related to cloud native components supported currently.
Run:
./metarget cnv install cve-2019-5736If the command above completes successfully, Docker with CVE-2019-5736 will be installed。
Run:
./metarget cnv install cve-2018-1002105If the command above completes successfully, Kubernetes with CVE-2018-1002105 will be installed。
Run:
./metarget cnv install kata-escape-2020If the command above completes successfully, Kata-containers with CVE-2020-2023/2025/2026 will be installed。
Run:
./metarget cnv install cve-2016-5195If the command above completes successfully, kernel with CVE-2016-5195 will be installed。
usage: metarget appv [-h] subcommand ...
positional arguments:
subcommand description
list list supported application vulnerabilities
install install application vulnerabilities
remove uninstall application vulnerabilities
optional arguments:
-h, --help show this help message and exitRun ./metarget appv list to see vulnerable scenes related to cloud native applications supported currently.
Note:
Before deploying application vulnerable scenes, you should install Docker and Kubernetes firstly. You can use Metarget to install Docker and Kubernetes.
Run:
./metarget appv install dvwaIf the command above completes successfully, DVWA will be deployed as Deployment and Service resources in current Kubernetes.
Note:
--external option, then the service will be exposed as NodePort, so that you can visit it by IP of the host node (By default, the type of service is ClusterIP).--host-net option, then the appv will share the host network namespace.--host-pid option, then the appv will share the host pid namespace.Depending on the user's network environment, ubuntu version, and Docker version, one-click installation of the vulnerability environment through automated scripts still occasionally fails, so we provide the vulnerability environment image for the first time.
Run the following command to build the target vulnerability environment image:
sudo docker build -t vuln-docker-24.0.7 -f vuln-docker-24.0.7 .Run the following command to run the target vulnerability environment image:
docker run vuln-XXXDeveloping, currently not supported.
If there is an asterisk (*) following the name of one vulnerable scene, you need to read the note related to it below the whole table for further details.
|Name|Class|Type|CVSS 3.x|Writeup|ATT&C
No open issues yet, or sync has not completed.