Exam PT0-002 All QuestionsBrowse all questions from this exam
Question 274

A penetration tester is validating whether input validation mechanisms have been implemented in a web application.

Which of the following should the tester use to determine whether the application is vulnerable to path traversal attacks?

    Correct Answer: A

    To check for path traversal vulnerabilities, the tester needs to manipulate the file path in a manner that attempts to navigate outside the intended directory structure. This is typically done using sequences of '../' (URL-encoded as %2f..%2f) to move up the directory tree. Option A illustrates this method by attempting to access the /etc/hosts file via a series of encoded dot-dot-slash sequences. Therefore, this is the correct approach to test for path traversal attacks.

Discussion
ACMaverickOption: A

To determine whether the application is vulnerable to path traversal attacks, the penetration tester should use the following GET request: A. GET /image?filename-…%2f…%2f…%2f…%2f…%2f…%2fetc%2fhosts Path traversal attacks aim to access files and directories that are stored outside the web root folder by manipulating variables that reference files with “dot-dot-slash (…/)” sequences and its variations or by using absolute file paths. In option A, the filename parameter is manipulated to include multiple “…/” sequences to traverse up the directory tree and access the /etc/hosts file. Option B (GET /image?filename=lefitfe;pwd) is not related to path traversal attacks. Option C (POST /image?filename -) and option D (POST /image?filename =yhtak;ncat --ssl 192.168.0.1 2222) do not involve GET requests and are not related to path traversal attacks.

Etc_Shadow28000Option: A

A. GET /image?filename=..%2f..%2f..%2f..%2f..%2f..%2fetc%2fhosts: This request includes a typical path traversal attack payload. The sequence of “../” (URL-encoded as “%2f”) attempts to navigate up the directory structure to access the /etc/hosts file. This is the correct method for testing path traversal vulnerabilities. B. GET /image?filename=lefitfe;pwd: This input attempts to inject a command (pwd) using a semicolon, which is more indicative of a command injection attempt rather than path traversal. C. POST /image?filename -: This input does not include any specific path traversal sequences and is incomplete, making it ineffective for testing path traversal. D. POST /image?filename=yhtak;ncat –ssl 192.168.0.1 2222: This input attempts to inject a command (ncat --ssl ...), which is more indicative of a command injection attempt rather than path traversal.

DRVisionOption: A

%2f = / .../.../.../.../ is direcory traversal