If I have a script which on some conditions just do
echo "rm -rf *"
Can it be exploited in some way?
EDIT: the goal is to write an enumeration script which will eventually suggests a command to execute to privilege escalate. So rm -rf is not the most appropriate example. A better example: imagine that the script finds "find" command in sudo -l list then the script will output
"find . -exec /bin/sh \; -quit"
rm -rf *
in a script is generally a bad idea, as the results could potentially be calamitous, if you forget one day and change the access permissions of the file for some reason and open it up to all users, then anyone could run that. – Ian May 31 '19 at 10:59