News - Informatique

Vulnerable à Shellshock ?

Les médias informatiques ne parlent plus que de çà depuis fin septembre : la faille BASH (Bourne-Again Shell) shellshock. Déjà il faut comprendre la faille en elle-même ce qui n'est pas une mince affaire. Visiblement un problème d'interprétation lors l'affectation de variables d'environnement.

Pour l'exploiter il faut vraiment le vouloir et grosso-modo avoir un site internet qui derrière appelle BASH avec les CGI (ou faire appel à des commandes shell via des appels systèmes en PHP ou autre), ce qui n'est pas le cas de la plupart des CMS et autres blogs. La plupart des machines Ubuntu et Debian sont touchées car le BASH est le shell par défaut sur ces machines. Ceux qui se servent de sh ou ksh sont tranquilles.

L'ennui c'est que la faille originale CVE-2014-6271 bien connue... :

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


... n'est pas la seule et a fait des émules.

Je voulais vous présenter un site super bien fait (qui normalement est bien placé dans les résultats de Google) : shellshocker.net

22



Le site propose deux scripts concernant cette ces failles :

Un script afin de tester votre système :

Code BASH :
curl https://shellshocker.net/shellshock_test.sh | bash


Si vous êtes "vulnerable", mettez à jour votre système.
Le deuxième script de ce site permet de mettre à jour BASH y compris sur des veilles distributions qui ne sont plus supportées même niveau sécurité, comme Debian 5 (lenny) ou Ubuntu 13.10 (apt-get upgrade n'a rien fait chez moi sur ce plan) :

Code BASH :
curl https://shellshocker.net/fixbash | sh


En fait il fait tout à la main : il ira chercher les sources de BASH ainsi que tous les petits patches nécessaires, patche les fichiers, recompile (make) et installe (make install) la nouvelle version tout seul sur votre système. Je pense qu'on peut faire confiance à ce site/script puisque tout est récupéré depuis ftp.gnu.org et de toute façon vous avez tout en clair, RAS pour moi, tout est nickel :

Code BASH :
#!/bin/sh
##############################################################
# This is the ShellShocker.net bash updater script.
# Version 1.2!
#
# Are you looking at this in your web browser, and would like to apply the bash patches?
# Just open up your terminal and type:
#
#    curl https://shellshocker.net/fixbash | sh
########
# REV 4: Added prefix to configure for fedora systems.
# REV 5: Bumped patch to 26 from 25.
# REV 6: Bumped patch to 27 from 26.
# REV 7: Not using sudo when logged in as root: https://github.com/wreiske/shellshocker/pull/15
# REV 8: Updated loops to download and apply up to latest patch: https://github.com/wreiske/shellshocker/pull/17
# REV 9: Added check for gcc to be installed.
########
# This script will download bash 4.3 to your home directory, extract, download patches, patch,
# install patches, and install the fixed bash.
#   - Mac: OS X
#   - Linux: x86 and x86_64 systems
##############################################################
echo "----------------------------------------------"
echo "-- WELCOME TO THE SHELLSHOCKER BASH PATCHER --"
echo "----------------------------------------------"
echo "---     Revision 8, 092914-4:56PM ETC      ---"
echo "--- Provided by https://shellshocker.net/  ---"
echo "----------------------------------------------"
GCC=`which gcc`
PATCH=`which patch`
MAKE=`which make`
if [ -z "$GCC" ]; then
    echo "Your system does not have the GNU gcc complier installed."
    echo "Please install the gcc complier and then run this script again."
    exit 1
fi
if [ -z "$PATCH" ]; then
    echo "Your system does not have the GNU patch tool installed."
    echo "Please install the patch tool and then run this script again."
    exit 1
fi
if [ -z "$MAKE" ]; then
    echo "Your system does not have the GNU make tool installed."
    echo "Please install the make tool and then run this script again."
    exit 1
fi
echo "Creating folders..."
cd ~/
mkdir bash-shellshocker
cd bash-shellshocker
echo "Downloading Bash..."
wget -N https://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
echo "Downloading Bash patches..."
i=0
while [ true ]; do i=`expr $i + 1`; wget -N https://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$(printf '%03g' $i); if [ $? -ne 0 ]; then break; fi; done
echo "Extracting bash from tar.gz..."
tar zxvf bash-4.3.tar.gz 
cd bash-4.3
echo "Applying Patches..."
for p in `ls ../bash43-[0-9][0-9][0-9]`; do patch -p0 < $p; done
echo "Ready to install. Configuring..."
./configure --prefix=/
echo "Running make"
make
if [ `id -u` -eq 0 ]
then
  echo "Running make install"
  make install
  cp /bin/bash /usr/local/bin/bash
  if [ $? -ne 0 ]; then
      cp /usr/local/bin/bash /usr/local/bin/bash.back
      cp -f /bin/bash /usr/local/bin/bash
  fi
else
  echo "Running make install  (You may need to type your sudo password here)"
  sudo make install
  sudo cp /bin/bash /usr/local/bin/bash
  if [ $? -ne 0 ]; then
      sudo cp /usr/local/bin/bash /usr/local/bin/bash.back
      sudo cp -f /bin/bash /usr/local/bin/bash
  fi
fi
echo "----------------------------------------------"
echo "Done! Try opening a new bash shell and checking if your system is still vulnerable."
echo "Script provided by https://shellshocker.net/"
echo "Please go leave a comment and let us know if this script worked for you!"
echo "Follow us on twitter too, https://twitter.com/shellshockernet"
echo "Send issue requests to https://github.com/wreiske/shellshocker/issues"
echo "Want to help make shellshocker better? Contribute @ https://github.com/wreiske/shellshocker/"
echo "-Thanks"
 


Testé et approuvé avec succès sur Debian 7 :top :

Code BASH :
root@banane:/audio# curl https://shellshocker.net/shellshock_test.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2533  100  2533    0     0   3293      0 --:--:-- --:--:-- --:--:--  4613
CVE-2014-6271 (original shellshock): not vulnerable
CVE-2014-6277 (segfault): not vulnerable
CVE-2014-6278 (Florian s patch): not vulnerable
CVE-2014-7169 (taviso bug): not vulnerable
CVE-2014-7186 (redir_stack bug): not vulnerable
CVE-2014-7187 (nested loops off by one): not vulnerable
CVE-2014-//// (exploit 3 on http://shellshocker.net/): not vulnerable
root@banane:/audio# cat /etc/debian_version
7.6
root@banane:/audio# uname -a
Linux banane 3.14.5-customkernel #1 SMP Fri Jun 6 21:17:34 CEST 2014 x86_64 GNU/Linux
 


Et aussi sur Ubuntu 13.10 (apt-get install gcc make) :

Code BASH :
root@orange:~# bash --version
GNU bash, version 4.3.30(1)-release (i686-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
Licence GPLv3+ : GNU GPL version 3 ou ultérieure <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
root@orange:~# curl https://shellshocker.net/shellshock_test.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2533  100  2533    0     0   2589      0 --:--:-- --:--:-- --:--:--  2589
CVE-2014-6271 (original shellshock): not vulnerable
CVE-2014-6277 (segfault): not vulnerable
CVE-2014-6278 (Florian s patch): not vulnerable
CVE-2014-7169 (taviso bug): not vulnerable
CVE-2014-7186 (redir_stack bug): not vulnerable
CVE-2014-7187 (nested loops off by one): not vulnerable
CVE-2014-//// (exploit 3 on http://shellshocker.net/): not vulnerable
root@orange:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.10
DISTRIB_CODENAME=saucy
root@orange:~# uname -a
Linux orange 3.11.0-26-generic #45-Ubuntu SMP Tue Jul 15 04:04:15 UTC 2014 i686 i686 i686 GNU/Linux
 


J'ai aussi un serveur IPCOP chez moi et pour le moment pas de mise à jour pour cette faille (toujours en version 2.1.5). En même temps, normalement l'interface d'administration (en CGI) de ce pare-feu n'est accessible que depuis l'interface verte (réseau privé) et non pas la rouge (extérieur). Sauf vous bien sûr vous avez ouvert votre interface d'administration aux quatre vents sur la toile. Mais dans ce cas la faille c'est vous (PEBKAC) et votre pare-feu ne sert à rien.