On this page
File Path Traversal: Simple Case
Lab
File path traversal, simple case · Apprentice
Solution
Given
This lab contains a path traversal vulnerability in the display of product images.
To solve the lab, retrieve the contents of the /etc/passwd file.
Analysis
Somewhere on the site there's a path traversal vulnerability in product image display. We need to read the /etc/passwd file using it.
Recon
We look at the site, paying attention to image-loading requests. We set up a filter to show such requests. We see the request:
GET /image?filename=60.jpg
We send it to Repeater and try path traversal.
First we try ../../etc/passwd — "No such file".
Final payload
GET /image?filename=../../../etc/passwd HTTP/2
Lab solved!
More in this category
Arbitrary Object Injection in PHP (PortSwigger Lab)
Recovering leaked source code and injecting a serialized CustomTemplate object whose __destruct deletes an arbitrary file.
Using Application Functionality to Exploit Insecure Deserialization (PortSwigger Lab)
Tampering with the `avatar_link` field in the session object to delete an arbitrary file via the account-delete feature.
Modifying Serialized Data Types (PortSwigger Lab)
Abusing PHP loose comparison by changing the `access_token` type to integer `0` to bypass authentication.