Diagnosing & Treating Bash "Shellshock"

OS X is a descendant of a long lineage of UNIX operating systems, from which it inherits its incredible stability and enhanced security. However, the past two weeks have uncovered numerous bugs in a core piece of software relied on by many UNIX operating systems, OS X included: bash (Bourne-again shell). It turns out that these bugs have been very long standing and can be exploited in numerous ways to provide unchecked access to a computer (in some cases remotely) with an afflicted version of bash installed. Due to the surprise and scope of this vulnerability, many have dubbed it “Shellshock”, in reference to the combat fatigue experienced by soldiers, but it’s really not a fair comparison to the effects of war.

A “shell” is a program that interprets and acts on textual commands either entered directly by a user at a terminal (or using a virtual terminal like the Terminal app found in /Applications/Utilities on OS X) or from a file containing one or more commands to be run automatically (sort of like a player piano, if that’s even a useful analogy anymore.) Bash is a very common shell program and is the default on many UNIX operating systems, including OS X (as of Mac OS X 10.3 Panther). If you’ve ever opened up the Terminal app and run a command in the last decade, you’ve used bash.

I personally write a fair number of scripts in the bash language to automate various processes on my computers and servers, primarily because it so ubiquitous. It may be partly because I’m a bit of a masochist, but—as a server admin—I also find it helps me perform tasks more efficiently when working in Terminal since it is the default. Needless to say I immediately started investigating the bugs, the attacks, and testing OS X workstations and servers.

Fortunately, without very specific custom configuration, OS X is not vulnerable to remote attacks through the afflicted version of bash, as echoed in the following statement from Apple (given to Jim Dalrymple of The Loop):

The vast majority of OS X users are not at risk to recently reported bash vulnerabilities. […] With OS X, systems are safe by default and not exposed to remote exploits of bash unless users configure advanced UNIX services.

None of the OS X 10.6 Snow Leopard through OS X 10.9 Mavericks systems I tested were vulnerable to remote attacks, however, all versions were susceptible to local attacks. The bugs are such that malicious commands can be inserted into “environment variables” (just what they sound like, data that exists in the environment in which individual shell scripts are run and therefore can be accessed by many scripts) and will be automatically executed upon any bash command or script being run. Not good. Since there are multiple bugs, there are different ways to test for each, but I find running the ‘bashcheck’ script to be very convenient way to test for all of them at once.

The bash developers and community have worked feverishly to investigate and fix these bugs. Apple has released “OS X bash Update 1.0” which includes fixes for the initial pair of bugs, but it unfortunately does not address subsequent bugs. As a further inconvenience, Apple does not provide this update via Software Update or the App Store, so you must download & install the appropriate update for your version of OS X:

OS X bash Update 1.0 – OS X Lion (10.7)
OS X bash Update 1.0 – OS X Mountain Lion (10.8)
OS X bash Update 1.0 – OS X Mavericks (10.9)

For those of you running Mac OS X 10.4 Tiger through 10.6 Snow Leopard on much older Macs, the developers of TenFourFox (an open-source version of the Firefox web browser specifically for older PPC & Intel Macs), provide a download along with detailed instructions to install a version of bash that fixes all the known vulnerabilities at this time. It does require command line experience, so is not for the faint of heart. The updated version provided by the TenFourFox team can also be used on OS X 10.7 Lion through 10.9 Mavericks and actually installs the very latest 4.3.x version of bash as opposed to the older 3.2.x version that Apple includes by default (and provided the partial fix for). This newer version of bash also has some benefits that programmers might enjoy, but it comes at the risk of possibly being downgraded by a future OS X update from Apple.

If you never use the Terminal app, I’d suggest you at least apply the appropriate version of “OS X bash Update 1.0” and any future updates that Apple might release to fix the additional vulnerabilities. For those of you who use Terminal with any frequency, you’ll want to proceed with caution and weigh the pros & cons of relying on Apple’s partial update or manually updating to the latest version of bash for your particular use.

Similar Posts

  • A Candle-Powered iPhone?

    If you’ve been reading Kibbles and Bytes over the past few months, you might have noticed I’ve written more than once about power…

  • Go Wireless!

    I am a huge fan of wireless technology. I have been slowly updating my home office to be as wireless as I can with speakers from Sonos and all of my computer accessories from my keyboard to printer are wireless as well. One area that I had not ventured into yet has been wireless headphones. I am often working at home, and because my office space is part of my main living space, I often have to have headphones while working. It was only recently that I started to use wireless headphones and frankly I can’t believe I hadn’t started to use this technology sooner! Urbanears has a bluetooth option in their popular Plattan line up, the Plattan ADV. I was able to easily link the headphones to my computer and no longer felt tethered to my desk when working. With the bluetooth headphones I could easily leave my desk for a glass of water or to let dogs out without missing a beat. The battery easily lasts all day and unlike some other bluetooth headphones, you can easily plug them into your computer or device directly with a cable should you forget to charge them. I also linked up these headphones to one of my iPads. These headphones allow you to have them linked with up to 8 devices, so you can easily use them from one device to the next without having to pair and unpair constantly.

    Over the ear headphones are great for around the home and office, but not the most practical when you’re exercising. As mentioned a few weeks ago I have begun trying to get out and move more in recent weeks, and carrying my iPhone in my hand or pocket when out for a run was becoming a bit of an annoyance. The Ourdoor Tech Orcas are the perfect solution. With the bluetooth on my Apple Watch I easily paired these headphones with my watch, synced a playlist to my watch and left my phone behind! The headphones are lightweight and comfortable. I am not a fan of in ear headphones and I was skeptical that these headphones would work well for me, but I was pleasantly surprised by how well they stayed in my ears and with the quality of the sound. Many in ear headphones begin to wiggle out of your ears or provide sub par sound quality, but these headphones have truly made me change the way I think of in-ear headphones. As an added bonus they also feature a built in microphone. This feature isn’t something that I can say I have taken advantage of, but it’s certainly nice to know I could take a call if I needed to.

  • Textile Template Article

    What image do you have behind the login menu when you start up? Classically, depending on the exact version of Mac OS X you are using, you have one of the “universe” images. This image can be replaced on your system with a picture of your choice. To replace the image you see as the default desktop behind the login window, find a .jpg file that you want for your new back round.

    Duplicate the image, preferably an image the same resolution as your machine default display resolution, and name the new file “DefaultDesktop.” Open a new finder window and navigate to *(NameofyourHD) > System > Library > CoreServices.* Drag and drop your new DefaultDesktop image into the Core Services folder.

    When you release, you will be asked if you want to replace the existing file first and then to authenticate as an Admin User secondarily. The next time you restart and before you log in, you will see that image behind the login window.

    Apple says:
    end what’s on your Mac screen to an HDTV wirelessly with Apple TV. Mirroring is great for classrooms, conference rooms, and your living room.

  • APP REVIEW: Limbo

    Limbo: perfect game for Halloween night (or any other night actually)! Limbo, by Playdead, is probably one of my favorite games of all…