背景:
CVE(CAN) ID: CVE-2014-6271 BUGTRAQ ID: 70103
GNU Bash(Bourne again shell)是一个为GNU计划编写的Unix shell,广泛使用在Linux系统内,最初的功能仅是一个简单的基于终端的命令解释器。
GNU Bash 4.3及之前版本在评估某些构造的环境变量时存在安全漏洞,向环境变量值内的函数定义后添加多余的字符串会触发此漏洞,攻击者可利用此漏洞改变或绕过环境限制,以执行shell命令。某些服务和应用允许未经身份验证的远程攻击者提供环境变量以利用此漏洞。此漏洞源于在调用bash shell之前可以用构造的值创建环境变量。这些变量可以包含代码,在shell被调用后会被立即执行。
此漏洞可能会影响到使用ForceCommand功能的OpenSSH sshd、使用mod_cgi或mod_cgid的Apache服务器、DHCP客户端、其他使用bash作为解释器的应用等。 SourceByrd's Weblog-https://note.t4x.org/environment/bourne-again-shell-bug-cve-shellshock/
受影响系统:
GNU Bash <= 4.3
完整解决方法:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
漏洞验证: $ env -i X='() { (a)=>\' bash -c 'echo date'; cat echo bash: X: line 1: syntax error near unexpected token `=' bash: X: line 1: `' bash: error importing function definition for `X' Fri Sep 26 23:30:00 CST 2014 如果显示上述信息,则受影响。 $ env -i X='() { (a)=>\' bash -c 'echo date'; cat echo date Fri Sep 26 23:30:00 CST 2014 如果显示上述信息,则不受影响。 centos:(最终解决方案) yum clean all yum makecache yum -y update bash ubuntu:(最终解决方案) apt-get update apt-get -y install --only-upgrade bash debian:(最终解决方案) 7.5 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 opensuse:(官方还没有给出最终解决方案,该方案存在被绕过的风险,请继续关注) 13.1 64bit wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.x86_64.rpm && rpm -Uvh bash-4.2-68.4.1.x86_64.rpm 13.1 32bit wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.i586.rpm && rpm -Uvh bash-4.2-68.4.1.i586.rpm |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
本地验证bash是否受影响的方法: $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" vulnerable this is a test 如果显示上述信息,则受影响。 $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" bash: warning: x: ignoring function definition attempt bash: error importing function definition for `x' 如果显示上述信息,则不受影响。 临时修复方法: 请您根据Linux版本选择您需要修复的命令, 为了防止意外情况发生,建议您执行命令前先对Linux服务器系统盘打个快照,如果万一出现升级影响您服务器使用情况,可以通过回滚系统盘快照解决。 centos: yum -y update bash (bash-4.1.2-15.el6_5.1.x86_64) 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 10.10 64bit wget http://mirrors.aliyun.com/fix_stuff/bash_4.1-2ubuntu3.1_amd64.deb && dpkg -i bash_4.1-2ubuntu3.1_amd64.deb 10.10 32bit wget http://mirrors.aliyun.com/fix_stuff/bash_4.1-2ubuntu3.1_i386.deb && dpkg -i bash_4.1-2ubuntu3.1_i386.deb debian: 7.5 64bit && 32bit 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%2bdeb6u1_amd64.deb && dpkg -i bash_4.1-3+deb6u1_amd64.deb 6.0.x 32bit wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3%2bdeb6u1_i386.deb && dpkg -i bash_4.1-3+deb6u1_i386.deb opensuse: 13.1 64bit wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.x86_64.rpm && rpm -Uvh bash-4.2-68.4.1.x86_64.rpm 13.1 32bit wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.i586.rpm && rpm -Uvh bash-4.2-68.4.1.i586.rpm aliyun linux: 5.x 64bit wget http://mirrors.aliyun.com/centos/5/updates/x86_64/RPMS/bash-3.2-33.el5.1.x86_64.rpm && rpm -Uvh bash-3.2-33.el5.1.x86_64.rpm 5.x 32bit wget http://mirrors.aliyun.com/centos/5/updates/i386/RPMS/bash-3.2-33.el5.1.i386.rpm && rpm -Uvh bash-3.2-33.el5.1.i386.rpm |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!