Categories: Kali Linux

Kubesploit : A Cross-Platform Post-Exploitation HTTP/2 Command

Kubesploit is a cross-platform post-exploitation HTTP/2 Command & Control server and agent dedicated for containerized environments written in Golang and built on top of Merlin project by Russel Van Tuyl (@Ne0nd0g).

Our Motivation

While researching Docker and Kubernetes, we noticed that most of the tools available today are aimed at passive scanning for vulnerabilities in the cluster, and there is a lack of more complex attack vector coverage.
They might allow you to see the problem but not exploit it. It is important to run the exploit to simulate a real-world attack that will be used to determine corporate resilience across the network.
When running an exploit, it will practice the organization’s cyber event management, which doesn’t happen when scanning for cluster issues.
It can help the organization learn how to operate when real attacks happen, see if its other detection system works as expected and what changes should be made.
We wanted to create an offensive tool that will meet these requirements.

But we had another reason to create such a tool. We already had two open-source tools (KubiScan and kubeletctl) related to Kubernetes, and we had an idea for more. Instead of creating a project for each one, we thought it could be better to make a new tool that will centralize the new tools, and this is when Kubesploit was created.

We searched for an open-source that provide that heavy lifting for a cross-platform system, and we found Merlin, written by Russel Van Tuyl (@Ne0nd0g), to be suitable for us.

Our main goal is to contribute to raising awareness about the security of containerized environments, and improve the mitigations implemented in the various networks. All of this captured through a framework that provides the appropriate tools for the job of PT teams and Red Teamers during their activities in these environments. Using these tools will help you estimate these environments’ strengths and make the required changes to protect them.

What’s New?

As the C&C and the agent infrastructure were done already by Merlin, we integrated Go interpreter (“Yaegi”) to be able to run Golang code from the server to the agent.
It allowed us to write our modules in Golang, provide more flexibility on the modules, and dynamically load new modules. It is an ongoing project, and we are planning to add more modules related to Docker and Kubernetes in the future.

The currently available modules are:

  • Container breakout using mounting
  • Container breakout using docker.sock
  • Container breakout using CVE-2019-5736 exploit
  • Scan for Kubernetes cluster known CVEs
  • Port scanning with focus on Kubernetes services
  • Kubernetes service scan from within the container
  • Light kubeletctl containing the following options:
    • Scan for containers with RCE
    • Scan for Pods and containers
    • Scan for tokens from all available containers
    • Run command with multiple options

Quick Start

We created a dedicated Kubernetes environment in Katacoda for you to experiment with Kubesploit.
It’s a full simulation with a complete set of automated instructions on how to use Kubesploit. We encourage you to explore it.

Build

To build this project, run the make command from the root folder.

Quick Build

To run quick build for Linux, you can run the following:

export PATH=$PATH:/usr/local/go/bin
go build -o agent cmd/merlinagent/main.go
go build -o server cmd/merlinserver/main.go

Mitigations

YARA rules

We created YARA rules that will help to catch Kubesploit binaries. The rules are written in the file kubesploit.yara.

Agent Recording

Every Go module loaded to the agent is being recorded inside the victim machine.

MITRE map

We created a MITRE map of the vectors attack being used by Kubesploit.

R K

Recent Posts

Kali Linux 2024.4 Released, What’s New?

Kali Linux 2024.4, the final release of 2024, brings a wide range of updates and…

16 hours ago

Lifetime-Amsi-EtwPatch : Disabling PowerShell’s AMSI And ETW Protections

This Go program applies a lifetime patch to PowerShell to disable ETW (Event Tracing for…

16 hours ago

GPOHunter – Active Directory Group Policy Security Analyzer

GPOHunter is a comprehensive tool designed to analyze and identify security misconfigurations in Active Directory…

3 days ago

2024 MITRE ATT&CK Evaluation Results – Cynet Became a Leader With 100% Detection & Protection

Across small-to-medium enterprises (SMEs) and managed service providers (MSPs), the top priority for cybersecurity leaders…

5 days ago

SecHub : Streamlining Security Across Software Development Lifecycles

The free and open-source security platform SecHub, provides a central API to test software with…

1 week ago

Hawker : The Comprehensive OSINT Toolkit For Cybersecurity Professionals

Don't worry if there are any bugs in the tool, we will try to fix…

1 week ago