현재 Fedora 배포판에서는 19~21버전에서만 취약점에 대한 패치가 제공되고 있으며 Fedora18 이하버전은 yum 업데이트가 중단되어서 이번 bash 쉘 취약점에 대해 패치버전을 제공하지 않고 있습니다. 따라서 아래와 같은 방법으로 업데이트가 가능하오니 참고하세요.
# cat /etc/redhat-release
Fedora release 18 (Spherical Cow)
# uname -a
Linux 115-68-200-23 3.11.10-100.fc18.x86_64 #1 SMP Mon Dec 2 20:28:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
# rpm -q bash
bash-4.2.45-1.fc18.x86_64
bash 쉘 취약점 여부 확인
# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
vulnerable
this is a test
bash 소스 RPM 다운로드
# yumdownloader --source bash
bash 취약점 패치버전 다운로드
cd /root/rpmbuild/SOURCE
# wget http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-048
패치소스 수정
:: Fedora18 에서의 bash 버전이 4.2.45이기에 해당버전 레벨로 수정
# vim bash42-048
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 45
#endif /* _PATCHLEVEL_H_ */
빌드프로세서에 대한 spec 파일 편집
# cd /root/rpmbuild/SPECS/
# vim bash.spec
61 라인
Patch045: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-045
Patch048: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-048
Patch049: ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-049
192 라인
%patch045 -p0 -b .045
%patch048 -p0 -b .048
%patch049 -p0 -b .049
신규 bash 패키지 설치
# rpmbuild -bb bash.spec
# rpm -Uhv /root/rpmbuild/RPMS/x86_64/bash-4.2.45-1.fc18.x86_64.rpm --force
Preparing... ################################# [100%]
Updating / installing...
1:bash-4.2.45-1.fc18 ################################# [100%]
bash 버전 확인
# bash -version
GNU bash, version 4.2.49(1)-release (x86_64-redhat-linux-gnu)
패치여부 확인
# 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'
this is a test
※ Fedora18 x86_64버전에는 첨부된 파일로 설치하면 됩니다.
아래와같이 소스로 패치버전 컴파일 방법
소스컴파일 : https://shellshocker.net
Building From Source
You can patch bash with one command using our bash patcher, just run the following command and you should be good to go!
Make sure you have patch installed before you run this command. sudo apt-get install patch (yum install patch) etc...
curl https://shellshocker.net/fixbash | sh
If you want to do it yourself, feel free. Here are all the commands you'll need.
cd ~/ mkdir bash cd bash wget https://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz #download all patches for i in $(seq -f "%03g" 1 27); do wget https://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; done tar zxvf bash-4.3.tar.gz cd bash-4.3 for i in $(seq -f "%03g" 1 27);do patch -p0 < ../bash43-$i; done ./configure && make && make install |