4 ms·
Confused by: VER=`echo $(uname -a)` Versus just: VER=$(uname -a) or VER=`uname -a`
by tyingq 7y ago
Confused by:
VER=`echo $(uname -a)`
Versus just:
VER=$(uname -a)
or
VER=`uname -a`
- saagarjha 7y agoPeople writing rootkits are not necessarily experts in shell scripting :)
- FullyFunctional 7y agoLook no further than the chain of xors that amount to ... ^ 0x22. These people really don't know much. ISTM, the only interesting thing is the "user-mode rootkit" mentioned in the beginning. Anything installed after that is moot and completely irrelevant. If anyone gets root on your machine, it's already game over. However, if your attack vector is getting me to execute a random .sh from you, then I'll roll my eyes and get on with life.
- jorangreef 7y agoIf your email firewall allows random .sh attachments, then you are vulnerable to at least two attacks: 1. Someone targets you specifically, knowing you are a software developer, by impersonating a trusted third-party contact and sending you a ZIP attachment with the contents of an open source project you are known to work on. ZIP attachments preserve the executable bit, and you wouldn't see any .sh extension because it would be an extension-less shell script. It would probably just look like a binary you are used to clicking. 2. Someone impersonates a trusted third-party contact, sending you a ZIP attachment with a symlink traversal to overwrite your .bashrc as soon as you unzip the attachment with a double-click, or as soon as unpatched middleware unzips it for you.
- neilv 7y ago1. They're mixing a Bourne-ism (backquotes) with a Bash-ism (dollar-parens). I don't know why. 2. This could be an attempt to normalize and reduce whitespace, including eliminating newlines (though you should prevent injection of arguments to `echo`): bash$ Temp=$(echo " a b c ") bash$ echo "[${Temp}]" [ a b c ] bash$ Temp=`echo $(echo " a b c ")` bash$ echo "[${Temp}]" [a b c] bash$ Temp=$(echo $(echo " a b c ")) bash$ echo "[${Temp}]" [a b c]
- nils-m-holm 7y agoThe Bourne shell had $() before it had backquote. It's not a Bash-ism.
- neilv 7y agoThank you, I was mistaken to call it a Bash-ism. Bash's documentation said it's a Posix-ism: > The POSIX $() form of command substitution is implemented (see Command Substitution), and preferred to the Bourne shell’s `` (which is also implemented for backwards compatibility). https://www.gnu.org/software/bash/manual/html_node/Major-Differences-From-The-Bourne-Shell.html https://www.gnu.org/software/bash/manual/html_node/Major-Dif...