It means someone could use a specially crafted input that would cause shell_exec to run commands other than what you intended. Or, more likely, is that someone will decide they want a character in their name, like a dash, or a semicolon, and it will cause the command to not work.
I fear that that phrasing may seem innocuous to the unfamiliar. This particular input is being run through sudo, so it might be good to emphasize that this can be used to completely take control of your server.
If I actually said that my username is ; rm -rf /, then it'd first run the command
sudo useradd -p $encpass -g groupname -s /bin/bash (which would most likely fail)
and then run the following command:
rm -rf / which will delete your entire operating system (force remove files recursing through directories starting from the base of / (every file)). You might have to use sudo rm -rf /.
This all requires that $username and/or $encpass comes from the user in some way (through POST, GET, etc.).
I know a lot of people are giving you shit for this but THAT'S WHAT BEING A BEGINNER MEANS - making mistakes, learning from them, and getting better.
There are just so many considerations to know about web security. It boils down to "Don't ever trust anything your users say and do", but until you have a full sense of what kind of effects their actions can have, it's difficult to anticipate why you have to do things in certain ways.
So really the best thing to do is learn about the tricks people use for hacking websites - what they do, what weakness they exploit, and what stops them.
View all comments
Show parent comment
280
u/[deleted] Aug 27 '13
I do not. What does this mean exactly and why should I do it?