转自阿里云:http://bbs.aliyun.com/read/176975.html?spm=5176.7189909.0.0.f9BXki
Bash紧急漏洞,请所有正在使用linux服务器的用户注意。该漏洞直接影响基于 Unix 的系统(如 Linux、OS X 等),可导致远程攻击者在受影响的系统上执行任意代码。
【已确认被成功利用的软件及系统】
所有安装gun bash 版本小于或者等于4.3的linux操作系统。
【漏洞描述】
该漏洞源于你调用的bash shell之前创建的特殊的环境变量,这些变量可以包含代码,同时会被bash执行。
【已确认被成功利用的软件及系统】
所有安装GNU bash 版本小于或者等于4.3的Linux操作系统。
【漏洞描述】
该漏洞源于你调用的bash shell之前创建的特殊的环境变量,这些变量可以包含代码,同时会被bash执行。
【漏洞检测方法】
漏洞检测命令: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
特别提示:该修复不会有任何影响,如果您的脚本使用以上方式定义环境变量,修复后您的脚本执行会报错。
【建议修补方案 】
请您根据Linux版本选择您需要修复的命令, 为了防止意外情况发生,建议您执行命令前先对Linux服务器系统盘打个快照,如果万一出现升级影响您服务器使用情况,可以通过回滚系统盘快照解决。
centos:
yum -y update bash
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
附上修补漏洞的yml文件,适用于Ansible
转自:https://raymii.org/s/articles/Patch_CVE-2014-6271_Shellshock_with_Ansible.html
Main role:
# cat playbooks/update.yml --- - hosts: all roles: - { role: apt-update, when: "ansible_os_family == 'Debian'" } - { role: yum-update, when: "ansible_os_family == 'RedHat'" }
Debian/Ubuntu Playbook
# cat playbooks/roles/apt-update/tasks/main.yml - copy: src=debian-6-lts.list dest=/etc/apt/sources.list.d/debian-6-lts.list when: ansible_distribution_major_version == "6" # Uncomment the following to test for the vuln. # # - shell: "export evil='() { :;}; echo vulnerable'; bash -c echo;" # register: result # - fail: # msg="Not vulnerable" # when: result.stdout != 'vulnerable' - apt: name=bash state=latest update_cache=yes
Debian 6 LTS repo file:
# cat playbooks/roles/apt-update/files/debian-6-lts.list # Added by Ansible to fix CVE-2014-6271 (ShellShock) # See http://arstechnica.com/security/2014/09/bug-in-bash-shell-creates-big-security-hole-on-anything-with-nix-in-it/ deb http://http.debian.net/debian/ squeeze main contrib non-free deb-src http://http.debian.net/debian/ squeeze main contrib non-free deb http://security.debian.org/ squeeze/updates main contrib non-free deb-src http://security.debian.org/ squeeze/updates main contrib non-free deb http://http.debian.net/debian squeeze-lts main contrib non-free deb-src http://http.debian.net/debian squeeze-lts main contrib non-free
Yum Role:
# cat playbooks/roles/yum-update/tasks/main.yml # Uncomment the following to test for the vuln. # # - shell: "export evil='() { :;}; echo vulnerable'; bash -c echo;" # register: result # - fail: # msg="Not vulnerable" # when: result.stdout != 'vulnerable' - command: /usr/bin/yum clean all - yum: name=bash state=latest