Dreictory traversal
Table of Contents
- File path traversal, simple case
- File path traversal, traversal sequences blocked with absolute path bypass
- File path traversal, traversal sequences stripped non-recursively
- File path traversal, traversal sequences stripped with superfluous URL-decode
- File path traversal, validation of start of path
- File path traversal, validation of file extension with null byte bypass
File path traversal, simple case
Reference: https://portswigger.net/web-security/file-path-traversal/lab-simple
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value:
../../../etc/passwd
- Observe that the response contains the contents of the
/etc/passwdfile.
File path traversal, traversal sequences blocked with absolute path bypass
Reference: https://portswigger.net/web-security/file-path-traversal/lab-absolute-path-bypass
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value/etc/passwd. - Observe that the response contains the contents of the
/etc/passwdfile.
File path traversal, traversal sequences stripped non-recursively
Reference: https://portswigger.net/web-security/file-path-traversal/lab-sequences-stripped-non-recursively
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value:
....//....//....//etc/passwd
- Observe that the response contains the contents of the
/etc/passwdfile.
File path traversal, traversal sequences stripped with superfluous URL-decode
Reference: https://portswigger.net/web-security/file-path-traversal/lab-superfluous-url-decode
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value:
..%252f..%252f..%252fetc/passwd
- Observe that the response contains the contents of the
/etc/passwdfile.
File path traversal, validation of start of path
Reference: https://portswigger.net/web-security/file-path-traversal/lab-validate-start-of-path
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value:
/var/www/images/../../../etc/passwd
- Observe that the response contains the contents of the
/etc/passwdfile.
File path traversal, validation of file extension with null byte bypass
Reference
Solution
- Use Burp Suite to intercept and modify a request that fetches a product image.
- Modify the
filenameparameter, giving it the value:
../../../etc/passwd%00.png
- Observe that the response contains the contents of the
/etc/passwdfile.