Question 47 of 968
mediumMultiple ChoiceObjective-mapped
Container Runtime Security: Least Privilege Best Practices for CompTIA SecurityX / CASP+
A company is deploying a web application in a containerized environment. The security team wants to ensure that the application runs with the least privilege necessary. Which of the following is the BEST approach to achieve this?
Quick Answer
The answer is to run the container with a non-root user and drop all capabilities, as this directly enforces the principle of least privilege in container runtime security. By default, even a non-root container process retains a set of Linux capabilities that can be abused for privilege escalation, so explicitly dropping all capabilities removes those risks entirely while the non-root user prevents direct root-level access to the host. On the CompTIA SecurityX CAS-004 exam, this concept tests your understanding of container runtime security best practices within the broader domain of secure software deployment and virtualization; a common trap is assuming that simply using a non-root user is sufficient, when in fact capabilities must also be stripped to achieve true least privilege. Remember the memory tip: “Drop caps, drop root—no privilege to loot.”
⚠ Common exam trap
The CAS-004 exam often tests the misconception that root in a container is safe because of namespace isolation, but the trap here is that root inside a container still has dangerous capabilities that can be exploited if the container is compromised, so the best approach is to avoid root entirely and drop all capabilities.
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
✓
Run the container with a non-root user and drop all capabilities
Running a container with a non-root user and dropping all capabilities enforces the principle of least privilege. By default, containers run with a limited set of capabilities, but explicitly dropping all capabilities and using a non-root user ensures that even if the application is compromised, an attacker cannot escalate privileges or perform privileged operations. This aligns with container security best practices, such as those outlined in the Docker security documentation and the CIS Docker Benchmark.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Run the container as root and use a restrictive seccomp profile
Why it's wrong here
Running as root still gives elevated privileges; seccomp alone does not enforce user-level least privilege.
- ✗
Run the container as root but use a read-only filesystem
Why it's wrong here
Read-only filesystem does not prevent root-level process attacks; the container still runs as root.
- ✗
Run the container with the --privileged flag and a custom AppArmor profile
Why it's wrong here
--privileged gives the container nearly all host capabilities, violating least privilege.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CAS-005 exam frequently reuses these exact scenarios with slightly different constraints.
✓Run the container with a non-root user and drop all capabilitiesCorrect answer▾
✗Run the container as root and use a restrictive seccomp profileWrong answer — click to see why▾
Why this is wrong here
Running as root still gives elevated privileges; seccomp alone does not enforce user-level least privilege.
✗Run the container as root but use a read-only filesystemWrong answer — click to see why▾
Why this is wrong here
Read-only filesystem does not prevent root-level process attacks; the container still runs as root.
✗Run the container with the --privileged flag and a custom AppArmor profileWrong answer — click to see why▾
Why this is wrong here
--privileged gives the container nearly all host capabilities, violating least privilege.
Analysis generated from the official CAS-005blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on CAS-005
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A security assessor is reviewing a containerized application. Which three of the following practices help secure the container runtime environment? (Select the three best options.)
hard- ✓ A.Run the container with a read-only root filesystem
- B.Use the latest base image from Docker Hub
- ✓ C.Drop all Linux capabilities and add only required ones
- ✓ D.Run the container process as a non-root user
Why A: Running a container with a read-only root filesystem (option A) prevents any writes to the container's filesystem layer, which blocks malware from dropping files, modifying binaries, or persisting changes. This is enforced by the container runtime (e.g., Docker, containerd) by mounting the root filesystem as read-only, typically using the `--read-only` flag. Even if an attacker gains code execution inside the container, they cannot alter system files or install tools, significantly reducing the blast radius of a compromise.
Variation 2. During a security review, a developer discovers that a containerized application runs with root privileges. Which of the following is the most secure approach to mitigate this risk while maintaining functionality?
hard- ✓ A.Set the container to run as a non-root user and drop all unnecessary capabilities
- B.Disable root login inside the container by modifying /etc/passwd
- C.Use a read-only root filesystem for the container
- D.Enable SELinux or AppArmor on the host
Why A: Running a container as a non-root user with dropped capabilities is the most secure approach because it follows the principle of least privilege. By default, containers run as root, which grants unnecessary kernel capabilities that could be exploited for privilege escalation. Setting a non-root user and using `--cap-drop=ALL` with selective `--cap-add` ensures the application retains only required permissions, reducing the attack surface without breaking functionality.
Last reviewed: Jun 11, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.