I've two PHP files in the same directory testdev
.
functions.php
:
<?php
function bash_run(string $cmd)
{
return shell_exec("/bin/bash -c " . $cmd);
}
index.php
:
<?php
require "functions.php";
if(isset($_GET["cmd"]))
echo bash_run($_GET["cmd"]);
else
echo "No command.";
When I try to access http://myhost.com/testdev/index.php?cmd=ls
it says:
Fatal error: Uncaught Error: Call to undefined function bash_run() in /home/rakinar2/public_html/testdev/index.php:5
Stack trace:
#0 {main}
thrown in /home/rakinar2/public_html/testdev/index.php on line 5
source https://stackoverflow.com/questions/68975624/php-call-to-undefined-function-bash-run
Comments
Post a Comment