hardMultiple ChoiceObjective-mapped
CAS-004 Practice Question: During a red team exercise, an attacker exploits…
During a red team exercise, an attacker exploits a vulnerability in a containerized web application to gain a shell. The container is running with a read-only root filesystem. What is the most likely persistence mechanism the attacker will use?
⚠ Common exam trap
Many exam-takers assume persistence requires modifying system files or the container image, but they overlook that writable directories like /tmp can be used for cron jobs or scripts, which is a common persistence technique in read-only container environments.
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
✓
Write a cron job to the container's writable /tmp directory.
With a read-only root filesystem, the attacker cannot modify system files like /etc/passwd or the container's entrypoint. However, writable directories such as /tmp can be used to place a cron job script. By writing a cron job to /tmp and ensuring the cron daemon is running, the attacker can achieve persistence by having the script executed at a scheduled interval, even after the container restarts.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Modify the container's entrypoint script in the image.
Why it's wrong here
The image is immutable; changes would not persist.
- ✓
Write a cron job to the container's writable /tmp directory.
Why this is correct
/tmp is often writable and can be used for persistence.
- ✗
Create a new user account in /etc/passwd.
Why it's wrong here
/etc is typically read-only in the container.
- ✗
Install a kernel module on the host.
Why it's wrong here
The attacker does not have host access.
Go deeper
Related to this question
About these practice questions
One of 968 original CAS-005 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CAS-005 practice question is part of Courseiva's free CompTIA 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 CAS-005 exam.