CPENT Cloud And Hybrid Infrastructure Security Practice Question
A penetration tester is performing a container escape on a Kubernetes cluster. The tester gains remote code execution inside a pod and discovers that the container is running with privileged mode disabled, but the service account token mounted at /var/run/secrets/kubernetes.io/serviceaccount/token has permissions to create new Pods using the cluster-admin cluster role. Which kubectl command or API call pattern should the tester use to achieve a container escape to the underlying host?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a pod specification with 'hostNetwork: true' and a 'hostPath' volume mounting '/' from the node to the container, then execute 'chroot /host' inside the new pod.
Since the container can create pods, it can use the Kubernetes API to create a new pod with hostPath volumes (e.g., mounting / on the host to /host inside the container) and hostNetwork: true, then chrooting into /host to execute commands on the underlying node.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Execute 'kubectl exec -it' using the token to attach to the kube-apiserver directly and modify the container runtime socket.
Why it's wrong here
Incorrect. kubectl exec cannot attach to the API server itself in this manner.
- ✓
Create a pod specification with 'hostNetwork: true' and a 'hostPath' volume mounting '/' from the node to the container, then execute 'chroot /host' inside the new pod.
Why this is correct
Correct. Creating a privileged or hostPath-mounted pod via the API server using high-privilege service account tokens allows full node compromise (container escape).
- ✗
Modify the local /etc/shadow file inside the container to grant root access to the node kernel.
Why it's wrong here
Incorrect. Containers have isolated namespaces; modifying container files does not impact the host kernel or host files.
- ✗
Send a malicious payload to the container runtime socket at /var/run/docker.sock to trigger a runC vulnerability.
Why it's wrong here
Incorrect. The scenario states docker.sock is not mounted, but rather the service account token is abused.
About these practice questions
This CPENT question is part of Courseiva's 274-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official EC-Council exam blueprint
This CPENT practice question is part of Courseiva's free EC-Council certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CPENT exam.