Exploitation
Last updated
Was this helpful?
Last updated
Was this helpful?
Since we cannot write into these files, lets read the check_attack.php
Analyzing this script it checks for files that aren't suppose to be in the uploads directory and deletes them, but pay attention to how it deletes the files, it appends them to the rm command without any filtering which makes it vulnerable to command injection
$path is the value of the upload directory
$value is the suspicious file's name
by going into /var/www/html/uploads, we can create a file that holds the payload in its name. it we start the file with a ; semi colon it will en the rm command and execute whatever code we put.
since the script appends the name of the file, we create the above file with the name beggining with ; nc. the semi colon will end the command and execute all other code after it.