Re:Detecting the use of “curl – bash” server side (2016)
by VBprogrammer on Wednesday December 09, 2020 @07:16AM
(#25357778)
This argument has been done to death. For the record yes, I agree with all of that and secretly I use it all the time.
I only invoked the "useless use of cat" demon because in this case it makes an interesting difference. Less doesn't evaluate the escape sequences which make this attack work by default.
Re:Detecting the use of “curl – bash” server side (2016)
by Ambroisie on Wednesday December 09, 2020 @07:01AM
(#25357716)
You can put the redirection before the command name, which keeps the same left to right flow.
Re:Detecting the use of “curl – bash” server side (2016)
by dspillett on Wednesday December 09, 2020 @07:37AM
(#25357877)
Though the arrow still points the wrong way, if I'm being fussy.
I was also about to suggest that was shell specific so not available everywhere, but a quick test says it is supported by /bin/sh at least so might be POSIX and therefore widely available.
Yes it wastes a bit of processing time and memory, but if what you are doing is going to significantly benefit from that small saving is the shell the right place to be doing it anyway?