[FIX] "Dziurawy" BASH

24.09.2014 r. zostąła ujawniona podatność w powłoce systemów Unix - Bash. Pozwala ona na wykonanie niebezpiecznego kodu na serwerze.

W celu sprawdzenia podatności, na serwerze należy wykonać polecenie z poziomu liniii poleceń:

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

Otrzymanie w odpowiedzi zwrotu "vulnerable
this is a test" oznacza, iż dany serwer posiada w dalszym ciągu lukę bezpieczeństwa i należy go bezzwłocznie zaktualizować. Prosimy nie bagatelizować problemu pod żadnym pozorem!!!

Tok postępowania w celu naprawienia problemu

Ubuntu 12.04 oraz 14.04

Z poziomu linii poleceń należy wykonać następującą komenę:
apt
-get update; apt-get install bash -y

Debian 6 "Squeeze"

W pliku /etc/apt/sources.list.d/squeezelts.list dodajemy następującą zawartość:

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
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

następnie w pliku /etc/apt/apt.conf.d/50squeezelts dodajemy:
APT
::Default-Release "squeeze-lts";

uruchamiamy polecenie:
apt
-get update; apt-get install bash

Debian 5

Tworzymy i edytujemy plik bash.sh:
touch bash.sh
chmod +x bash.sh
nano bash.sh

następnie w edytorze nano wklejamy następującą treść do pliku:

#!/bin/bash
# dependencies

apt-get update; apt-get install build-essential gettext bison
# get bash 3.2 source
wget http://ftp.gnu.org/gnu/bash/bash-3.2.tar.gz
tar zxvf bash-3.2.tar.gz
cd
bash-3.2
# download and apply all patches, including the latest one that patches CVE-2014-6271
# Note: CVE-2014-6271 is patched by release 52.
# Release 53 is not out on the GNU mirror yet - it should address CVE-2014-7169.
for i in $(seq -f "%03g" 1 52); do
wget -nv http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-$i
patch -p0 < bash32-$i
done
# compile and install to /usr/local/bin/bash

./configure && make
make install
# point /bin/bash to the new binary
mv /bin/bash /bin/bash.old
ln -s /usr/local/bin/bash /bin/bash

i zapisujemy poprzez F2 oraz Y, i go uruchamiamy:
./bash.sh

Centos oraz RHEL
yum clean all
yum update bash -y

Źródło: https://dmsimard.com/2014/09/25/the-bash-cve-2014-6271-shellshock-vulnerability/


Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 2348