日前Linux官方内置Bash中新发现一个非常严重安全漏洞(漏洞参考https://access.redhat.com/security/cve/CVE-2014-6271  ),***可以利用该Bash漏洞完全控制目标系统并发起***。

    已确认被成功利用的软件及系统:所有安装GNU bash 版本小于或者等于4.3的Linux操作系统。 该漏洞源于你调用的bash shell之前创建的特殊的环境变量,这些变量可以包含代码,同时会被bash执行。  

漏洞检测方法:

$ env -i  X='(){(a)=>\' bash -c 'echo date'; cat echo

修复前 输出:  
当前系统时间  
 
使用修补方案修复后 输出 :
date   
(备注:输出结果中包含date字符串就修复成功了 


ubuntu:(最终解决方案) 更新升级 bash
apt-get update 
apt-get -y install --only-upgrade bash  


参考链接:

Linux Bash严重漏洞修复紧急通知(官方最新解决方案持续更新中)

比“心脏流血”还危险?详解Bash漏洞安全事件!


PS:以下为旧的方案,该修复方案存在被绕过的风险。

漏洞检测方法:

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

输出: 

修复前    
vulnerable   
this is a test    
使用修补方案修复后 
bash: warning: x: ignoring function definition attempt 
bash: error importing function definition for `x' 
this is a test 

wKioL1QkBq3QQR_nAAFwtgMB2-I046.jpg特别提示:该修复不会有任何影响,如果您的脚本使用以上方式定义环境变量,修复后您的脚本执行会报错。 

修复方案:

ubuntu: 
14.04 64bit 

wget 
http://mirrors.aliyun.com/fix_stuff/bash_4.3-7ubuntu1.1_amd64.deb
 && dpkg -i bash_4.3-7ubuntu1.1_amd64.deb


14.04 32bit 

wget 
http://mirrors.aliyun.com/fix_stuff/bash_4.3-7ubuntu1.1_i386.deb
 && dpkg -i  bash_4.3-7ubuntu1.1_i386.deb


12.04 64bit 

wget 
http://mirrors.aliyun.com/fix_stuff/bash_4.2-2ubuntu2.2_amd64.deb
 && dpkg -i  bash_4.2-2ubuntu2.2_amd64.deb

 
12.04 32bit 

wget 
http://mirrors.aliyun.com/fix_stuff/bash_4.2-2ubuntu2.2_i386.deb
 && dpkg -i  bash_4.2-2ubuntu2.2_i386.deb

Ubuntu 用户可以通过如下命令打补丁,无需重启:  

apt-get update  
 
apt-get install bash

参考链接及其他Linux系统修复方案:Linux Bash严重漏洞修复紧急通知