Geert's Place

Tag: Apple

Shellshock exploit

by on Sep.28, 2014, under Apple

After Heartbleed, there is another serious bug around which is affecting Mac and linux systems. More specifically : it is a bug present in bash. This bug can be exploited and it can give an attacker the possibility to run arbitrary commands on your system. In other words: this is extremely dangerous. An overview of the attack vectors can be found on this site.

There are 2 tests you can perform yourself, to check whether your system is vulnerable to the 2 attack vectors :
In a terminal window, type the following command, followed by enter

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

The result should be :

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

If you get the following output, your system is vulnerable :

vulnerable
this is a test

Also check your system for the second vulnerability :

env X='(){(a)=>\’ bash -c “echo date”; cat echo; rm -f echo

You should see this :

date
cat: echo: No such file or directory

In case you get the following output, your system is again vulnerable to the exploit :

date
[The Current Date and Time]

So what you need to do in case your system returned one or both of the bad outputs

  • You could wait for Apple to come up with a patch
  • Patch bash yourself
  • Apple already said they are working on a patch, and that “the vast majority of Apple computers are not vulnerable”. However, I can only highly recommend patching this bug yourself – it doesn’t take long and it’s not complicated.

    The only prerequisite is Xcode – Apple’s development platform. You can download it for free from the App Store.

    Next, perform the following steps from within a Terminal window :

  • mkdir bash-fix
  • cd bash-fix
  • curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf –
  • cd bash-92/bash-3.2
  • curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
  • cd ..
  • xcodebuild
  • It will spawn a lot of text while it’s compiling, and it should come up with “BUILD SUCCEEDED” when it’s done.
    The second patch will be addressed like so :

  • mv build/bash.build/Release/bash.build/DerivedSources/y.tab.* bash-3.2/
  • cd bash-3.2
  • curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0
  • cd ..
  • xcodebuild
  • Again, you’ll see “BUILD SUCCEEDED“. Now it’s time to make a backup of your old bash. Perform the following commands in a Terminal window :

    sudo cp /bin/bash /bin/bash.old
    sudo cp /bin/sh /bin/sh.old

    Now replace the old bash with the new, compiled version :

    sudo cp build/Release/bash /bin
    sudo cp build/Release/sh /bin

    Run the 2 tests again; the output should be fine now.

    Leave a Comment :, more...

    Fix those ugly “Open With..” duplicates in OSX

    by on Nov.01, 2013, under Apple

    Just open a Terminal, and run the following command :

    Screen Shot 2013-11-01 at 15.29.50

    It takes a few minutes to finalize, but afterwards you should be good ! 😉  Also, you may have to relaunch Finder – Control+Option+click on the Finder icon, and then click Relaunch.

    Leave a Comment :, more...

    Looking for something?

    Use the form below to search the site:

    Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

    Visit our friends!

    A few highly recommended friends...