Author Topic: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271  (Read 7821 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« on: กันยายน 25, 2014, 10:09:18 PM »
ถือว่าเป็น bug ที่กระทบกับระบบ linux และ unix ที่ใช้งานตัว bash shell กันครับ
ซึ่งทาง Redhat เองแนะนำให้อัฟเดทเลย เพื่อป้องกันไม่ให้ตกเป็นเป้า อิอิ

Because of its wide distribution, the vulnerability could be as wide-ranging as the Heartbleed bug, though it may not be nearly as dangerous. The vulnerability affects versions 1.14 through 4.3 of GNU Bash. Patches have been issued by many of the major Linux distribution vendors for affected versions, including:

Red Hat Enterprise Linux (versions 4 through 7) and the Fedora distribution
CentOS (versions 5 through 7)
Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTS
Debian
A test on Mac OS X 10.9.4 ("Mavericks") by Ars showed that it also has a vulnerable version of Bash. Apple has not yet patched Bash, though it just issued an update to "command line tools."

While Bash is often thought of just as a local shell, it is also frequently used by Apache servers to execute CGI scripts for dynamic content (through mod_cgi and mod_cgid). A crafted web request targeting a vulnerable CGI application could launch code on the server. Similar attacks are possible via OpenSSH, which could allow even restricted secure shell sessions to bypass controls and execute code on the server. And a malicious DHCP server set up on a network or running as part of an “evil” wireless access point could execute code on some Linux systems using the Dynamic Host Configuration Protocol client (dhclient) when they connect.

There are other services that run on Linux and Unix systems, such as the CUPS printing system, that are similarly dependent on Bash that could be vulnerable.

There is an easy test to determine if a Linux or Unix system is vulnerable. To check your system, from a command line, type:

#env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
If the system is vulnerable, the output will be:

vulnerable
 this is a test
An unaffected (or patched) system will output:

 bash: warning: x: ignoring function definition attempt
 bash: error importing function definition for `x'
 this is a test

###CentOS
#yum update

 bash   x86_64  version : 4.1.2-15.el6_5.1


###Reference
http://arstechnica.com/security/2014/09/bug-in-bash-shell-creates-big-security-hole-on-anything-with-nix-in-it/
« Last Edit: กันยายน 25, 2014, 10:12:41 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« Reply #1 on: กันยายน 25, 2014, 10:28:29 PM »
หรือถ้าท่านไหน yum update ไม่เจอ
ก็สามารถ download bash version ใหม่มาอัฟเดทกันได้นะครับผม

###x86_64
#wget http://www.packetlove.com/linux_packet/bash-3.2-33.el5.1.x86_64.rpm

###i386
#wget http://www.packetlove.com/linux_packet/bash-3.2-33.el5.1.i386.rpm

Upgrade bash
#rpm -Uvh bash-3.2-33.el5.1.x86_64.rpm

เสร็จแล้วทำการ เทสโดย
#env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

ถ้าเจอ output แบบด้านล่างก็แสดงว่า patch เรียบร้อย แก้ไข bug ตัวนี้ ละครับ
bash: warning: x: ignoring function definition attempt
 bash: error importing function definition for `x'
 this is a test

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« Reply #2 on: กันยายน 30, 2014, 09:33:13 AM »
สำหรับ bug ตัวนี้จะมีเกี่ยวข้องกันอยู่ 5 ตัวย่อยๆ นะตอนนี้ สำหรับรายละเอียดลองดูใน wiki เพิ่มเติมได้ครับ

http://en.wikipedia.org/wiki/Shellshock_%28software_bug%29

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« Reply #3 on: ตุลาคม 01, 2014, 03:12:20 PM »
ในกรณี FreeBSD os หลังจากที่ตรวจสอบแล้วว่า bash version ที่ใช้งานอยู่ โดนช่องโหว่ ของ CVE-2014-6271 และ CVE-2014-7169 

โดยก่อนอื่นทำการ อัฟเกรด port เพื่อให้ได้ package ใหม่ที่แก้ไขแล้วมาใช้งานครับ

#portsnap fetch
#portsnap extract
#portsnap update

#cd /usr/ports/shells/bash
#make deinstall
#make reinstall

แล้วลองเชค version ดูนะครับ
#bash --version

#pkg info bash
===>  Cleaning for bash-4.3.27_1
root@XX:/usr/ports/shells/bash # pkg info bash
bash-4.3.27_1
Name           : bash
Version        : 4.3.27_1
Installed on   : Wed Oct  1 15:09:08 ICT 2014
Origin         : shells/bash
Architecture   : freebsd:9:x86:64
Prefix         : /usr/local
Categories     : shells
Licenses       : GPLv3
Maintainer     : ehaupt@FreeBSD.org
WWW            : http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html
Comment        : The GNU Project's Bourne Again SHell

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« Reply #4 on: ตุลาคม 01, 2014, 03:30:48 PM »
ถ้าเจอ error ลักษณะนี้ หมายถึง ทาง freebsd ได้พัฒนาระบบการ install package ใหม่โดยใช้งานผ่านคอมมาน pkg ซึ่งคล้ายๆกับ rpm ของ redhat 

To switch to pkg:
    1) Install ports-mgmt/pkg
       cd ports-mgmt/pkg && make UPGRADEPKG=1 install clean
    2) Convert your package database by running pkg2ng

ทำการลง pkg
#cd /usr/ports/ports-mgmt/pkg
#make UPGRADEPKG=1 install clean

เสร็จแล้วทำการ อัฟเกรด bash อีกครั้ง
#cd /usr/ports/shells/bash
#make install clean


golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: A security vulnerability in the GNU Bourne Again Shell (Bash),CVE-2014-6271
« Reply #5 on: ตุลาคม 16, 2014, 10:23:21 AM »
หรือถ้าท่านไหน จะ compile ผ่าน source package ก็ลองดูได้ตามนี้ นะครับผม

เชค version ล่าสุดที่ใช้
#bash --version
GNU bash, version 3.2.32(1)-release (x86_64-unknown-freebsd)
Copyright (C) 2007 Free Software Foundation, Inc.

ทำการ Download bash version 3.2, bash-3.2.48.tar.gz is patched till version 48
#wget http://ftp.gnu.org/gnu/bash/bash-3.2.48.tar.gz

Download all patches after bash32-048 (at the moment I publish this article, latest is bash32-057)
#mkdir bash-3.2-patches
#cd bash-3.2-patches
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-049
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-050
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-051
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-052
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-053
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-054
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-055
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-056
#wget http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-057
#cd ..

Go to bash source folder and patch the source
#tar -xvzf bash-3.2.48.tar.gz
#cd bash-3.2.48
#patch -p0 < /root/bash-3.2-patches/bash32-049
#patch -p0 < /root/bash-3.2-patches/bash32-050
#patch -p0 < /root/bash-3.2-patches/bash32-051
#patch -p0 < /root/bash-3.2-patches/bash32-052
#patch -p0 < /root/bash-3.2-patches/bash32-053
#patch -p0 < /root/bash-3.2-patches/bash32-054
#patch -p0 < /root/bash-3.2-patches/bash32-055
#patch -p0 < /root/bash-3.2-patches/bash32-056
#patch -p0 < /root/bash-3.2-patches/bash32-057

เริ่มการ Compile
#/.configure
#make
#make install

###ลองเทสดู Bash version ตอนนี้ต้องแสดง .57
root@nexenta:~# bash –version
GNU bash, version 3.2.57(3)-release (i386-pc-solaris2.10)
Copyright (C) 2007 Free Software Foundation, Inc.

# Test if your bash against Shellshock bug.
env ‘VAR=() { :;}; echo Bash is vulnerable!’ ‘FUNCTION()=() { :;}; echo Bash is vulnerable!’ bash -c “echo Bash is not vulnerable”

ลองดูกันนะครับผม