T3chnocr4t:~#

Looking 🔭 For Something Hidden....

View on GitHub

Path Traversal

Hola 👋 welcome back, guys! Here is my write-up on all the labs in Path Traversal on Web Sec Academy, curated in one place. I will go through how I solved each lab. Let’s get started!

directory-traversal

What is Path Traversal 🤔

Path traversal is also known as directory traversal. These vulnerabilities enable an attacker to read arbitrary files on the server that is running an application. This might include: Application code and data, Credentials for back-end systems, Sensitive operating system files.


Lab #1: File Path traversal, Simple Case

End Goal:

1

3

4

5


Lab #2: File path traversal, traversal sequences blocked with absolute path bypass

End Goal:

1a

1c


Lab #3: File path traversal, traversal sequences stripped non-recursively

End Goal:

2a

2b


Lab #4: File path traversal, traversal sequences stripped with superfluous URL-decode

End Goal:

3a

3b


Lab #5: File path traversal, validation of start of path

End Goal:
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.

4a

4b


Lab #6: File path traversal, validation of file extension with null byte bypass

End Goal:
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.

5a

5c

giphy

5d


How to prevent a path traversal attack

1) Validate all user inputs to filter out any unexpected characters or patterns.

2) Employ allowlists to restrict file access exclusively to known, safe paths.

3) Use allowlists or whitelists to restrict file access to known, safe paths. and so on.

That’s all, friends. Thank you for reading up to this point. I would like to hear your feedback on anything not clear here. Here is my Twitter account @T3chnocr4t. Feel free to DM me if you have any issues with my write-up. Thanks!

Go Back Home