因為 Bash 太多人用,找到安全漏洞的成本效益太高,看起來最近會有大量的人力跳進去 code review,接下來應該是 CVE 滿天飛,跟當初 OpenSSL 的情況類似。
目前建議是直接看維基百科的說明:「Shellshock (software bug)」,裡面直接列出了目前發現的 CVE 以及 attack vector。
會讓管理者想要抱頭痛哭,無止盡的 patch...
幹壞事是進步最大的原動力
因為 Bash 太多人用,找到安全漏洞的成本效益太高,看起來最近會有大量的人力跳進去 code review,接下來應該是 CVE 滿天飛,跟當初 OpenSSL 的情況類似。
目前建議是直接看維基百科的說明:「Shellshock (software bug)」,裡面直接列出了目前發現的 CVE 以及 attack vector。
會讓管理者想要抱頭痛哭,無止盡的 patch...
這讓人無言了,Bash 的遠端執行安全漏洞,CVE-2014-6271:
GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.
可以在 oss-sec 上面看到說明「Re: CVE-2014-6271: remote code execution through bash」:
Debian and other GNU/Linux vendors plan to disclose a critical, remotely exploitable security vulnerability in bash this week, related to the processing of environment variables. Stephane Chazelas discovered it, and CVE-2014-6271 has been assigned to it.
透過環境變數打進去... Redhat 的「Bash specially-crafted environment variables code injection attack」這篇也給了不少例子。
Linux 下通常最常用的 shell 應該還是 Bash 吧?(雖然也看到不少人用 Zsh...)
然後 Twitter 上看到非常邪惡的 Google Hack:
google filetype:sh inurl:cgi-bin;
— dragosr (@dragosr) September 25, 2014
大家可以自己加上 site:
去掃...
「Don't Pipe to your Shell」這篇文章給了一些有趣的例子。
很多工具都提供 pipe to shell 的方式安裝,像是這樣的形式:
wget -O - http://example.com/install.sh | sudo sh
先不管「應該用 HTTPS 以確保內容不會被改」的問題,如果 wget 傳到一半斷掉會發生什麼事情呢?像是作者給的例子:
TMP=/tmp TMP_DIR=`mktemp` rm -rf $TMP_DIR
如果傳到最後一行的 rm -rf $TMP
就斷掉 (後面的 _DIR
斷掉) 會發生什麼事情呢?XDDD
如果 shell 是這樣寫呢:
rm -rf /tmp/$TMP_DIR
然後傳到 rm -rf /
就斷線... XD
所以還是先抓下來再執行吧,可以避免意外發生 :p
在 Ubuntu 下不小心拉到視窗大小 (拉動的時候不會顯示長寬),所以想要土法煉鋼找指令列出視窗寬度:
tput cols
出自 StackOverflow 的「How do I find the width & height of a terminal window?」。