A path traversal attack (also known as directory traversal) aims to access files and directories that are stored outside the web root folder. By manipulating variables that reference files with “dot-dot-slash (…/)” sequences and its variations or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system including application source code or configuration and critical system files.
A classic example of path traversal attack to retrieve system files is : https://insecure-website.com/loadImage?filename=../../../etc/passwd
.
In your application, path traversal occurs in the extension
GET parameter of the ajax/putfile.php
file.
> The base64 content of PD9waHAgc3lzdGVtKCRfUkVRVUVTVFsnY21kJ10pOyA/Pg==
is equals to <?php system($_REQUEST['cmd']); ?>
.
In PHP, you can use the basename function to extracts the last element of a path.
Add a whitelist to the extension parameter to disable PHP file upload.