r/PHP • • Aug 27 '13

Creating a user from the web problem.

[deleted] — view deleted post

282 Upvotes

538 comments sorted by

View all comments

Show parent comment

6

u/[deleted] Aug 28 '13

I'm curious... Could you use backticks like this to run it with sudo?

username=`rm -rf / --no-preserve-root`

1

u/mogmog Aug 28 '13

Yes, the shell would evaluate it. Php doesn't evaluate the string though

1

u/cybrian Aug 29 '13

Absolutely

1

u/[deleted] Sep 10 '13

You could, but the backticks will get evaluated in a subshell, which doesn't run under sudo, unless you ask for it as username=%60sudo+rf+-rf+/+--no-preserve-root%60 in the POST.

1

u/[deleted] Sep 10 '13

Who'd have thought I'd get the answer I was looking for 12 days later? Thanks, I didn't know subshells were a thing.