Zend
200-530 · Question #416
Consider the PHP program (which includes a file specified by request): <?php $color = 'blue'; if (isset( $_GET['COLOR'] ) ) $color = $_GET['COLOR']; require( $color . '.php' ); ?> <form…
The correct answer is B. Remove the .php suffix, allowing access to files other than .php. See the full explanation below for the reasoning.
Question
Consider the PHP program (which includes a file specified by request): <?php $color = 'blue'; if (isset( $_GET['COLOR'] ) ) $color = $_GET['COLOR']; require( $color . '.php' ); ?> <form method="get"> <select name="COLOR"> <option value="red">red</option> <option value="blue">blue</option> </select> <input type="submit"> </form> A malicious user injects the following command: /vulnerable.php?COLOR=C:\notes.txt%00 where vulnerable.php is a remotely hosted file containing an exploit. What does the malicious user want to do?
Options
- AExecute the malicious code that exists in the file vulnerable.php.
- BRemove the .php suffix, allowing access to files other than .php.
- CInject a remotely hosted file containing an exploit.
- DPerform a cross-site scripting attack.
How the community answered
(41 responses)- A15% (6)
- B73% (30)
- C7% (3)
- D5% (2)
Community Discussion
No community discussion yet for this question.