歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> Unix基礎知識 >> 類Unix系統Bash漏洞的檢測及修復方法

類Unix系統Bash漏洞的檢測及修復方法

日期:2017/3/3 14:55:04   编辑:Unix基礎知識

近期Bash漏洞讓不少類Unix躺槍。。

下面是相關的檢測方法和修復方法(內容來源阿裡雲開發者論壇)

-----------------------------------------------------------------------------------------------------

Bash緊急漏洞預警,請所有正在使用Linux服務器的用戶注意。該漏洞直接影響基於 Unix 的系統(如 Linux、OS X 等),可導致遠程攻擊者在受影響的系統上執行任意代碼。

【已確認被成功利用的軟件及系統】

所有安裝gun bash 版本小於或者等於4.3的linux操作系統。

【漏洞描述】

該漏洞源於你調用的bash shell之前創建的特殊的環境變量,這些變量可以包含代碼,同時會被bash執行。

【漏洞檢測方法】

輸入:

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

輸出:

vulnerable

this is a test

【已確認被成功利用的軟件及系統】

所有安裝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

查看本欄目更多精彩內容:http://www.bianceng.cn/OS/unix/

特別提示:該修復不會有任何影響,如果您的腳本使用以上方式定義環境變量,修復後您的腳本執行會報錯。

【建議修補方案 】

請您根據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

Ubuntu12.04 64位檢測方法和修復方法親測可用!

Copyright © Linux教程網 All Rights Reserved