Chinaunix首页 | 论坛 | 博客
  • 博客访问: 281084
  • 博文数量: 38
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 221
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-25 17:36
文章分类

全部博文(38)

文章存档

2015年(1)

2014年(37)

分类: LINUX

2014-09-29 17:28:14

如果运行下面命令

env x='() { :;}; echo vulnerable' bash -c 'echo hello'
输出结果为:
[root@localhost ~]# env x='() { :;}; echo vulnerable' bash -c 'echo hello'
vulnerable
hello
则有漏洞,需要赶紧修复

修复脚本
bashfix.sh

mkdir src
cd src
wget 
#download all patches
for i in $(seq -f "%03g" 0 25); do wget     $i; done
tar zxvf bash-4.3.tar.gz 
cd bash-4.3
#apply all patches
for i in $(seq -f "%03g" 0 25);do patch -p0 < ../bash43-$i; done
#build and install
./configure && make && make install
cd .. 
cd ..
rm -r src

执行脚本:
sh bashfix.sh
然后会自动升级,修复bash的漏洞

再运行

env x='() { :;}; echo vulnerable' bash -c 'echo hello'
如果结果是:

[root@localhost ~]# env x='() { :;}; echo vulnerable' bash -c 'echo hello'
env x='() { :;}; echo vulnerable' bash -c 'echo hello'
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
hello
证明漏洞修复
阅读(2029) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~