[分享]Linux超级Bash漏洞(Shellshock)修复方法,内附Debian服务器详细方法

20141107补充:有人写了一个脚本,也可以用这个:http://www.v2ex.com/t/136038

近日,Linux社区爆出了关于Linux Bash的安全漏洞,该漏洞源于你调用的bash shell之前创建的特殊的环境变量,这些变量可以包含代码,同时会被bash执行。 不同于之前的SSL的HeartBlood漏洞,这个Bash漏洞能让黑客通过嵌入恶意命令完全控制目标机器,而不像HeartBlood只是可以嗅探敏感信息。

对于所有安装GNU bash 版本小于或者等于4.3的Linux操作系统都应该检测并修复该漏洞,以免造成不必要的损失。

检测方法:

命令行中输入:

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

如果显示了如下红色加粗内容,说明你的linux系统存在该漏洞,请立即修复。

vulnerable
this is a test

 

修补方案:

Centos修补方案(执行如下命令,不用重启):

yum clean all
yum makecache
yum -y update bash

Ubuntu修补方案(执行如下命令,不用重启):

apt-get update
apt-get -y install --only-upgrade bash

Debian稍微复杂一点

先输入如下命令查看Debian系统版本号:

cat /etc/issue

比如我的是Debian GNU/Linux 7 \n \l

 

再查看是32bit还是64bit的

file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x55f1e005df252708d4c456dcc2c7dccea1006553, stripped

 

debian: 7.X 64bit && 32bit  (最终解决方案)

apt-get update
apt-get -y install --only-upgrade bash

 

6.0.x 64bit

wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_amd64.deb
dpkg -i bash_4.1-3+deb6u2_amd64.deb

6.0.x 32bit

wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_i386.deb
dpkg -i bash_4.1-3+deb6u2_i386.deb

 

最后确认是否修复,输入

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

如果看不到vulnerable,就说明修复成功了。

发表回复