File path traversal, validation of start of path

Description

This lab contains a file path traversal vulnerability in the display of product images. The application transmits the full file path via a request parameter, and validates that the supplied path starts with the expected folder.

Reproduction and proof of concept

  1. Use Burp Suite to intercept and modify a request that fetches a product image.

  2. Modify the filename parameter, giving it the value: /var/www/images/../../../etc/passwd

  3. The response contains the contents of the /etc/passwd file.

Traversal

Exploitability

An attacker will need to retrieve the contents of the /etc/passwd file.