$device = $_GET['device']; $state = $_GET['state'];
exec( "sudo ./send " . $device . " " . $state );
EDIT: it is for home automation, but also appears to be a CS class group project.
61–70 of 131 posts
$device = $_GET['device']; $state = $_GET['state'];
exec( "sudo ./send " . $device . " " . $state );
EDIT: it is for home automation, but also appears to be a CS class group project.
My fav: $device = $_GET['device']; $state = $_GET['state']; exec( "sudo ./send " . $device . " " . $state ); EDIT: it is for home automation, but also appears to be a CS class group project.
Half the time these are just prototypes or throwaway projects or are behind password protected proxies. Relax people.
Earlier quoted context omitted.
What if a hacker would have access to a user of said personal intranet, or would find a way to bypass the password protected page. Then he'd be able to execute anything on the server, even stuff the user he hacked shouldn't be able to access. So no, this is always a vulnerability.
What about phpMyAdmin and others alike webapps? Are they inherently insecure?
This is awful. Shell commands are not guaranteed to be idempotent, people! These should all be of the form exec($_POST, not exec($_GET.
$cmdname = split(' ', $_GET['command']);
if(!in_array(IDEMPOTENT_COMMANDS, $cmdname))
echo 'Your request is not guaranteed to be idempotent. Please use a POST.';
else
exec($_GET['command'] ...Earlier quoted context omitted.
What if a hacker would have access to a user of said personal intranet, or would find a way to bypass the password protected page. Then he'd be able to execute anything on the server, even stuff the user he hacked shouldn't be able to access. So no, this is always a vulnerability.
What about phpMyAdmin and others alike webapps? Are they inherently insecure?
They don't give untintended full access to the web server.
That said, they are a little insecure.
Example from the Github search: How to abuse: $_GET['name'] = "/dev/null; rm -rf /; echo ";
"We've found 99,841 code results" Someone should write a script that automatically raises an issues for each line and each project, it's probably possible, but I'm chronically lazy.