Security Experts:

Researcher to Reveal Mac OS X DLL Hijacking Attack

DLL hijacking is not just a Windows thing: it turns out that a conceptually similar attack is possible for OS X systems.

According to new research from Synack's Patrick Wardle, DLL hijacking on Macs can be used to circumvent security features like Apple's Gatekeeper to infect vulnerable computers. Wardle will be presenting on the issue this week at the CanSecWest Applied Security conference in Vancouver.

"OS X dylib [dynamic library] hijacking is conceptually similar to Windows DLL hijacking," explained Wardle, director of research at Synack. "In both cases, there exist situations where the OS loader will look for required dependent libraries in multiple places. If the legitimate library is not found in a primary location, e.g. the first directory the loader looks in, the attacker can then plant a malicious library there. From then on, whenever the application is launched - either by the OS or by the user - the loader will now find and blindly load the attacker’s malicious library since the loader first looks in the location where the attacker planted they library."

The attack relies on leveraging vulnerable apps, and Wardle plans to release an open source python script and a UI application that can be used to scan for them. A scan of his computer, he noted, turned up nearly 150 vulnerable applications, including both Apple applications and third-party apps.

The attack circumvents Gatekeeper, an anti-malware feature that allows users to restrict what sources they can install applications from in order to reduce the likelihood of being infected by a Trojan horse. The feature is included in OS X Lion 10.7.5, OS X Mountain Lion and later versions of the operating system.

"The details of the attack will be revealed at the conference," he stated. "However, I can summarize. There exists a situation where Gatekeeper does not validate everything that is downloaded as it should in a software package such as .dmg file. This opens up a scenario where an attacker can create a software package or infect a legitimate download that Gatekeeper will trust when the user opens it. So even if the user has set Gatekeeper to only allow code from the Mac App Store…the attacker’s malicious unsigned dylib will still be loaded and allowed to execute, thus infecting the user."

The attack is quite elegant as it abuses legitimate functionality of the operating system but is very simple for an attacker to use, added Wardle.

"It can be used in attack scenarios such as persistence, load-time process injection, etc," he explained. "Other attacks that achieve similar goals…are complex, and easily detected [and] prevented. Using this dylib hijack attack, an attacker can achieve the same goal by simply dropping a dylib bundle. That’s it. That combined with the tools I’ll be releasing…make this a trivial, yet fairly devastating attack."

CanSecWest will be held from March 18 to March 20. 

view counter