Friday, 26 September 2014

shell-shocked: Updaing bash on Linux Mint Olivia

shell-shocked: Updaing bash on Linux Mint Olivia

I've go some old laptops running Linux Mint, Olivia release, based on Ubuntu Raring Ringtail which is not a long term support, and so no ready fix is available.

The bug is shown with this test
rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
Fri Sep 26 09:37:44 BST 2014
which wrongly creates a file called echo holding the output of the date command.

Here is what is required to fix the bash shell-shocked bug.

1. Update the no-longer supported repositories to the new location:

(You should already have done this).

You first need to make sure you have src-deb repositories enabled:
cd /etc/apt/sources.list.d/ 
test -r official-source-repositories.list ||
cp official-package-repositories.list official-source-repositories.list &&
sed -i -e 's/raring/trusty/g;s/^deb /^deb-src/' official-source-repositories.list
And then update the server to old-releases:
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' official-package-repositories.list
apt-get update

2. Install all updates for your system anyway

apt-get update
apt-get upgrade

3. Build bash from the trusty sources

apt-get build-essential bash
apt-get -b source bash

4. Install bash

dpkg -i bash*deb

5. Test the fix

# rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
date
cat: echo: No such file or directory

No comments:

Post a comment