PEN-200 Web Application Attacks Practice Question
You are performing a penetration test against a web application that uses a Linux backend. You discover a file inclusion vulnerability in the 'page' parameter: 'index.php?page=home.php'. You attempt to include '/etc/passwd' using path traversal, but the application appends '.php' to the input. You try 'page=../../../../etc/passwd%00' but the null byte is blocked. Which of the following techniques is most likely to allow you to read the '/etc/passwd' file?
⚠ Common exam trap
The trap here is assuming that path traversal alone can bypass extension appending, or using wrappers meant for code execution rather than file reading.
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
✓
Use a PHP filter wrapper: 'page=php://filter/convert.base64-encode/resource=/etc/passwd'
The php://filter wrapper allows reading files by applying filters. Using convert.base64-encode encodes the file content, which is then returned in the response. This bypasses the .php extension append because the wrapper is specified as the resource, and the server includes the filtered stream. This technique is effective for reading sensitive files like /etc/passwd when file inclusion is present.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Use a PHP filter wrapper: 'page=php://filter/convert.base64-encode/resource=/etc/passwd'
Why this is correct
The php://filter wrapper can be used to read files without executing them. By specifying convert.base64-encode, the contents of /etc/passwd are base64-encoded and returned, bypassing the .php extension append because the wrapper is used as the resource. This is a common technique to read source code or sensitive files when file inclusion is present.
- ✗
Use a zip wrapper: 'page=zip:///tmp/shell.jpg%23shell.php'
Why it's wrong here
The zip wrapper is used to execute code from a zip archive, often for bypassing file upload restrictions. It does not help read /etc/passwd. This technique is for achieving remote code execution, not for reading arbitrary files. It is irrelevant to the goal of reading /etc/passwd and would not work as described.
- ✗
Use a data wrapper: 'page=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7Pz4='
Why it's wrong here
The data wrapper allows execution of arbitrary code, but it does not help read /etc/passwd. It would execute the provided base64-encoded PHP code, which could be used for command execution, but the scenario specifically aims to read the /etc/passwd file. The data wrapper is not suitable for file reading, and it may be disabled.
- ✗
Use a path traversal with a trailing slash: 'page=../../../../etc/passwd/'
Why it's wrong here
Appending a trailing slash does not bypass the .php extension appended by the application. The server would attempt to include '/etc/passwd/.php', which is not a valid file. Path traversal alone does not solve the extension append issue. This technique is ineffective for reading /etc/passwd in this scenario.
About these practice questions
One of 285 original PEN-200 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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official OffSec exam blueprint
This PEN-200 practice question is part of Courseiva's free OffSec 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 PEN-200 exam.