I have simple PHP code like this:
<?php
print_r(shell_exec($_GET['c']));
now I want to run commands with root privileges through URL.
I have added www-data
as sudoers and I try this
curl -vv "http://localhost/index.php?c=echo mypass|sudo -S -s 'whoami'"
but I can't see anything in output
This code is just for fun, also I don't want to write my commands in bash script and run them with PHP, I want to know whats wrong with this code