Geert's Place

Tag: OSX

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...

    OSX on VMware Workstation 10

    by on May.29, 2014, under Apple, VMware

    So you want to install OSX on VMware Workstation … ?  Normally, this doesn’t quite work 🙂  During the creation of a new virtual machine, you won’t see the option to install OSX, and I’m pretty sure even if you would succeed to install it using another linux distribution, it won’t boot up after the installation. Or maybe it does ! But then it will boot up forever and ever 😉

    You will have to patch your VMware Workstation, but first things first.  You need Mavericks (or OSX 10.6 -> 10.8) installation media, so here’s a procedure on how to create a bootable DVD (there are plenty of procedures to create a bootable USB drive with Mavericks on it, so Google for those!)

    So after downloading the Install OS X Mavericks.app file from the Mac App Store (or Google for it), run these 12 commands in Terminal to create a Mavericks.iso file and then burn it to a dual layer DVD with Disk Utility.  If you use this DVD to perform a fresh install on a Mac, you may then boot up from it by holding the option key down and then install Mavericks. This will not install a recovery partition. To do that, uncompress and run the script file from here :

    Recovery Partition Creator

    1. hdiutil attach /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
    2. hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Mavericks
    3. hdiutil resize -size 8g /tmp/Mavericks.sparseimage
    4. hdiutil attach /tmp/Mavericks.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
    5. rm /Volumes/install_build/System/Installation/Packages
    6. cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/
    7. hdiutil detach /Volumes/install_app
    8. hdiutil detach /Volumes/install_build
    9. hdiutil resize -size `hdiutil resize -limits /tmp/Mavericks.sparseimage | tail -n 1 | awk ‘{ print $1 }’`b /tmp/Mavericks.sparseimage
    10. hdiutil convert /tmp/Mavericks.sparseimage -format UDTO -o /tmp/Mavericks
    11. rm /tmp/Mavericks.sparseimage
    12. mv /tmp/Mavericks.cdr ~/Desktop/Mavericks.iso

    The ISO that has been created, can now be burned to a dual-layer DVD using Disk Utility. If you want to use this DVD to install an OSX virtual machine on VMware Workstation, you need to patch Workstation with this script :

    Workstation Patcher

    Unzip, and run the script as Administrator.  Also, make sure Workstation isn’t running at that point.

    That’s it.  When you restart VMware Workstation, you should have the option to install OSX. Now use the DVD you created, or use a bootable USB drive with Mavericks on it.

    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...