A web application uses a parameter 'file' to include server-side files. The following request is intercepted: GET /page.php?file=../../../etc/passwd HTTP/1.1. The response contains the contents of /etc/passwd. This vulnerability is most likely which of the following?
Trap 1: Directory Traversal
Directory Traversal, also known as path traversal, is a specific attack technique where an attacker manipulates file paths in an application's input to access files and directories stored outside the intended root directory. By injecting sequences like ../ (dot-dot-slash), an attacker can move up the directory hierarchy and read sensitive server files, such as configuration files or password files, which the application then attempts to "include" or process, fitting the scenario of "a parameter file to include server" resources.
Trap 2: Command Injection
Command Injection is a distinct vulnerability that allows an attacker to execute arbitrary operating system commands on the host server through a vulnerable application. This occurs when an application passes unsanitized user input directly to a system shell or a function that executes commands, such as system() or exec(). The scenario described involves accessing and including files by manipulating paths, which is fundamentally different from directly executing system-level commands.
Trap 3: Remote File Inclusion (RFI)
Remote File Inclusion (RFI) is a vulnerability where a web application is tricked into including a remote file, typically hosted on an attacker-controlled server, via a URL provided in user input. This often leads to remote code execution as the server fetches and executes the malicious script from an external source. The question describes accessing "server" files, implying local resources, and the mechanism of path manipulation, which is distinct from fetching files from a remote URL.
- A
Local File Inclusion (LFI)
Local File Inclusion (LFI) is a vulnerability where a web application includes local files on the server based on user-supplied input, often leading to information disclosure or remote code execution. While LFI attacks frequently employ path traversal sequences like ../ to specify arbitrary file paths, the vulnerability itself is the act of including the file via functions such as include() or require(). The question's description specifically points to the *method* of navigating directories to access files, rather than the broader inclusion vulnerability.
- B
Directory Traversal
Why wrong: Directory Traversal, also known as path traversal, is a specific attack technique where an attacker manipulates file paths in an application's input to access files and directories stored outside the intended root directory. By injecting sequences like ../ (dot-dot-slash), an attacker can move up the directory hierarchy and read sensitive server files, such as configuration files or password files, which the application then attempts to "include" or process, fitting the scenario of "a parameter file to include server" resources.
- C
Command Injection
Why wrong: Command Injection is a distinct vulnerability that allows an attacker to execute arbitrary operating system commands on the host server through a vulnerable application. This occurs when an application passes unsanitized user input directly to a system shell or a function that executes commands, such as system() or exec(). The scenario described involves accessing and including files by manipulating paths, which is fundamentally different from directly executing system-level commands.
- D
Remote File Inclusion (RFI)
Why wrong: Remote File Inclusion (RFI) is a vulnerability where a web application is tricked into including a remote file, typically hosted on an attacker-controlled server, via a URL provided in user input. This often leads to remote code execution as the server fetches and executes the malicious script from an external source. The question describes accessing "server" files, implying local resources, and the mechanism of path manipulation, which is distinct from fetching files from a remote URL.