mediumMultiple ChoiceObjective-mapped
CAS-004 Practice Question: A security analyst discovers that a web…
A security analyst discovers that a web application is vulnerable to directory traversal. Which of the following is the MOST effective mitigation?
⚠ Common exam trap
CompTIA often tests the misconception that input validation (e.g., blocking '..') is sufficient, but the trap here is that attackers can bypass such filters with encoding or alternative traversal techniques, making a whitelist the only truly effective mitigation.
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
✓
Whitelist of allowed file paths
A whitelist of allowed file paths is the most effective mitigation because it defines an explicit set of permissible paths, preventing any unauthorized file access regardless of traversal attempts. Unlike input validation, which can be bypassed with encoding or alternative traversal sequences, a whitelist enforces a positive security model that blocks all unspecified paths, including those using '..' or symbolic links. This approach directly addresses the root cause of directory traversal by restricting the application to only known-safe resources.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Whitelist of allowed file paths
Why this is correct
A whitelist ensures only explicitly permitted files are served, regardless of traversal attempts.
- ✗
Encrypting all files on the server
Why it's wrong here
Encryption does not prevent access to files; it only protects data at rest.
- ✗
Chroot jail
Why it's wrong here
Chroot restricts the file system view but may be escaped or miss other application layers.
- ✗
Input validation that rejects paths containing '..'
Why it's wrong here
Attackers can use encoding (e.g., URL encoding) to bypass simple pattern matching.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CAS-005 question from scratch — 968 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.