This lab provides isolated shell sessions under gVisor for practicing command injection vulnerabilities.
Install required tools:
./install_requirements.shEnsure gVisor is installed:
curl -fsSL https://gvisor.dev/install | sh
which runscEdit /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl to include:
{{ template "base" . }}
[plugins."io.containerd.runtime.v1.linux"]
shim_debug = true
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runsc]
runtime_type = "io.containerd.runsc.v1"Then:
sudo systemctl restart k3sGenerate a service account token:
kubectl create token lab-controller -n hackersir-lab --duration=8760hUpdate docker-compose.yml with the new token in LAB_TOKEN environment variable.
Export in shell if needed:
export LAB_TOKEN="<token>"Build the session image:
docker build -t hackersir/session:latest .Import to k3s:
docker save hackersir/session:latest | sudo k3s ctr images import -Start the lab:
./start.shRestart components:
docker compose restart controllerStop:
./stop_all.shRegenerate token and update docker-compose.yml:
kubectl create token lab-controller -n hackersir-lab --duration=8760h
# Update LAB_TOKEN in docker-compose.yml
docker compose restart controllerLabel the node for gVisor support:
kubectl get nodes --show-labels
kubectl label node <node-name> runtime.gvisor.dev/support=trueIf ImagePullBackOff, rebuild and reimport image:
docker build -t hackersir/session:latest .
docker save hackersir/session:latest | sudo k3s ctr images import -Check controller logs:
docker compose logs controllerVerify Kubernetes connectivity:
docker compose exec metrics-proxy kubectl get nsView pods:
kubectl get pods -n hackersir-labView nodes:
kubectl get nodes --show-labelsCheck pod details:
kubectl describe pod <pod-name> -n hackersir-labView logs:
kubectl logs <pod-name> -n hackersir-lab