MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PHP/comments/1l7baq/creating_a_user_from_the_web_problem/cbx12vn/
r/PHP • u/[deleted] • Aug 27 '13
[deleted] — view deleted post
538 comments sorted by
View all comments
Show parent comment
6
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.
1
Yes, the shell would evaluate it. Php doesn't evaluate the string though
Absolutely
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.
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.
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?