Tags

,

SHELL SHOCK; A critical vulnerability has been discovered in the Bourne again shell, commonly known as bash and present in most Linux and UNIX distributions, including Mac OS X.

“GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the Force Command feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.”

To check whether your bash is vulnerable; run the following command

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

If the output is

vulnerable
this is a test

Than your system is vulnerable of the bug.

As I am using Ubuntu distro primarily; use the following command to upgrade the bash:

root@access /h/fakrul#sudo apt-get update
root@access /h/fakrul#sudo apt-get install --only-upgrade bash

It’s been very tedious to login all the server and run the command; so I use a small bash (!) command to do the same:

#!/bin/bash
servers=(
 #Put your list of servers here
    192.168.1.10
    192.168.1.100
    192.168.1.110
   )
for server in ${servers[@]}
    do
      ssh -t $server 'sudo apt-get update && sudo apt-get install --only-upgrade bash'
    done

There are few good advisory:

http://www.nzitf.org.nz/news.html

CERT Australia Publication – Bash vulnerability [PDF 665KB]