Attacks and Exploits

A PHP page runs include($_GET['page']) with allow_url_include disabled. The tester can upload avatar images and set any User-Agent header. Which two actions BEST lead to code execution? (Choose two.)

Choose 2 answers

Show the answer

Correct answersB. Include the access log after sending PHP code in the User-Agent headerC. Include an uploaded image that carries PHP code in its metadata

AWhy not this: A remote URL needs allow_url_include, which is disabled, so the server will not fetch it.

BWhy this is right: The injected PHP is stored in the log, and include runs it when the log is loaded.

CWhy this is right: include runs PHP found in any file it loads, including an uploaded image's metadata.

DWhy not this: The php://filter wrapper discloses source code but does not execute attacker code.

EWhy not this: The data:// wrapper also depends on allow_url_include, so it fails while that setting is off.

FWhy not this: Reading /etc/passwd through traversal only discloses a file; no PHP is run.

include executes PHP in any local file it loads, so a log poisoned through the User-Agent header or an uploaded image with embedded PHP runs as code. Remote URLs and data:// URIs need allow_url_include, which is disabled, while php://filter and traversal only read files.