php - What does exec("chmod +x $path; $path") do?
Get the solution ↓↓↓I have a php code like this:
if(move_uploaded_file($file['tmp_name'], $path))
{
echo "Upload succeed !!!<br>";
exec("chmod +x $path; $path");
echo "Executed file !!!<br>";
die();
}
That code is part of a CTF source code. My question is: how does theexec("chmod +x $path; $path");
work? I barely can find any manual aboutexec( p1 ; p2 )
, however my guess is it executep1
thenp2
. Is it true? I can't make it work on my local sever using XAMPP.
Answer
Solution:
Yes, that's what that means.
exec("chmod +x $path; $path");
Is basically 2 commands in oneexec
:
chmod +x $path
Change the file permissions on whatever$path
is pointing to and add thex
flag, which makes it executable.
$path
Now execute that file.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: mark bundle as not supporting multiuse
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.