Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
affected source code file: /admin/delete_image.php
affected source code:
<?php
include ("includes/headerRefresh.php");
include ("includes/config.php");
include ("functions/functions.php");
require_once ("includes/session.php");
check_login();
$file = $_GET['file'];
$folder = '../uploads/';
$file_path = $folder . $file;
if (is_file($file_path)) {
unlink($file_path);
redirect_to("manage_uploads.php?deleted=1");
}
ob_end_flush();
?>
affected function: unlink($file_path);
affected executable:
First, we can create a test file "test.txt" in root directory.
Then, visit the Vulnerable URL: http://xx.xx.com/admin/delete_image.php?file=../test.txt
and the "test.txt" file in the root directory will be deleted.
That is, we can control the "delete_image.php?file=" parameter to delete any file through the relative path