“Shell Shock Bash” vulnerability on your server

On September 24th, a vulnerability was reported in the GNU Bourne-Again-Shell (BASh, or Bash), specifically a flaw with how Bash processes values of environment variables, that allows remote code execution of varying types in many common configurations. The overall risk is severe due to bash being configured for use, by default, on most Linux servers.

GigaPros immediately fixed this for all the shared servers (servers which are hosting Personal plans, Business plans and Reseller plans). The main hardware nodes of VPS and Cloud servers are also fixed.

But for VPS containers, Cloud containers as well as Dedicated servers, users are advised to check because some servers may remain vulnerable depending on their update settings or other unforeseen intervening factors. Thus, we’ve provided the instructions below. To Summarize:

  • This flaw exploits Bash, a Unix command-line shell run by default on most Linux servers.
  • Allows for remote code execution, and many types of command-line based attacks.
  • A patch is available, and your server can be easily updated.
  • We have tutorials on How to Update Bash on CentOS and How to Update Bash on Ubuntu.
  • Test the vulnerability of your server with the information below.

The National Cyber Awareness System describes the issue as follows:

GNU Bash through 4.3 bash43-025 processes trailing strings after certain malformed function definitions in the values of environment variables, which allows remote attackers to write to files or possibly have unknown other impact via a crafted environment, as demonstrated by vectors involving the ForceCommand 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. NOTE: this vulnerability exists because of an incomplete fix for CVE-2014-6271.

Check Whether Your Server is Vulnerable

It is very easy to check whether or not your server is vulnerable by running the following (safe to run) code:

cd /tmp; rm -f /tmp/echo; env 'x=() { (a)=>\' bash -c "echo date"; cat /tmp/echo

If your server isn’t vulnerable, then the following will be displayed:

bash: x: line 1: syntax error near unexpected token `=’
bash: x: line 1: `’
bash: error importing function definition for `x’
date
cat: /tmp/echo: No such file or directory

Or in some cases simply:

date
cat: /tmp/echo: No such file or directory

If your server is vulnerable, then the following will be displayed (with the date):

bash: x: line 1: syntax error near unexpected token `=’
bash: x: line 1: `’
bash: error importing function definition for `x’
Fri Sep 26 11:55:07 EDT 2014

And the file /tmp/echo will be created.

Now its time for the tutorials, once you follow the tutorials, confirm your server is no longer vulnerable by running the above code once more!

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Tutorial: How to Update Bash on CentOS -

Pre-Flight Check
  • These instructions are intended specifically for updating Bash on CentOS.
  • Login as root and run the following commands -
Clean-Up Yum

yum clean all

Update Bash

Updating Bash is as simple as running just one command: yum -y update bash

or… Update All Installed Packages

Optionally, it is possible to update all of the installed packages at once with the following command: yum -y update

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Tutorial: How to Update Bash on Ubuntu -

Pre-Flight Check
  • These instructions are intended specifically for updating Bash on Ubuntu.
  • Login as root and run the following commands -
Clean-Up Apt-get

apt-get autoclean

Update Bash

Updating Bash is as simple as running just one command: apt-get install --only-upgrade bash

or… Upgrade All Installed Packages

Optionally, it is possible to Upgrade all of the installed packages at once with the following command: apt-get upgrade