A tester reviews findings against a PHP application whose process runs as the web server user. Which four findings could each be used to achieve arbitrary code execution on the server? (Choose four.)
Choose 4 answers
Show the answer
Correct answersA. Unsafe deserialization of an attacker-controlled session cookieC. Remote file inclusion with allow_url_include enabledD. Server-side template injection in a greeting fieldE. Command injection in a network ping feature
AWhy this is right: A crafted serialized object can trigger attacker-chosen code when the server rebuilds it, such as through a gadget chain.
BWhy not this: Reflected XSS runs script in the victim's browser, not on the server, so it gives no server code execution.
CWhy this is right: With allow_url_include enabled, an included remote script is executed by the server as PHP code.
DWhy this is right: Template engines evaluate expressions on the server, so injected template syntax can run code or commands.
EWhy this is right: Unsanitized input passed to an OS command runs attacker-chosen commands as the web server user.
FWhy not this: Read-only traversal discloses file contents but executes nothing, so it does not give code execution by itself.
Deserialization, server-side template injection, command injection and remote file inclusion each let attacker input be executed as code on the server. Directory traversal in a read-only download endpoint only discloses files and runs nothing on its own. Reflected XSS runs script in the victim's browser, not on the server.