为什么我无法在 Bash 4.2.0 上重现 ShellShock Bash 错误?

Why can't I get the ShellShock Bash bug to reproduce on Bash 4.2.0?

我正在了解 ShellShock 漏洞,我想测试旧版本的 Bash。
我像这样从 GNU website. After extracting the content, I compiled it based on GNU guide 下载了 Bash 4.2:

bash ./configure
make

完成后我运行下面的漏洞来查看bash是否易受攻击:

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"  

但它没有打印“易受攻击”,这意味着它不易受攻击,我不明白为什么:

root@ubuntu:~/Desktop/bash-4.2# ./bash
root@ubuntu:~/Desktop/bash-4.2# echo $BASH_VERSION
4.2.0(1)-release
root@ubuntu:~/Desktop/bash-4.2# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
this is a test
root@ubuntu:~/Desktop/bash-4.2# 

使用./bash代替bash;您当前的尝试最终会执行默认系统 Bash 实例,希望它确实不会受到攻击。

通常,当前目录不包含在 PATH 中,也不应该包含在内,原因与此完全相同。