DSC_4243

A security researcher discovered a zero-day vulnerability in many Mac firmware that could allow an easy installation of an EFI rootkits.

The cyber security expert Pedro Vilaça has discovered a low-level zero-day vulnerability in Apple Mac systems that could be exploited by privileged users to more install an EFI rootkits.

Vilaça explained that the attack is not linked to previous similar researches like the one conducted by the security researcher Trammell Hudson that presented a technique dubbed Thunderstrike hack to infect Apple’s Mac PCs with EFI Bootkit through the Thunderbolt port.

The zero-day discovered by Vilaça exploits unlocked flash protections when machines go into sleep mode.

“Well, Apple’s S3 suspend-resume implementation is so f*cked up that they will leave the flash protections unlocked after a suspend-resume cycle,” wrote the expert in a blog post.

“It means that you can overwrite the contents of your BIOS from userland and rootkit EFI without any other trick other than a suspend-resume cycle, a kernel extension, flashrom, and root access.” “Wait, am I saying Macs EFI can be rootkitted from userland without all the tricks from Thunderbolt that Trammell presented? Yes I am! And that is one hell of a hole :-).”

The expert explained that it is quite easy to exploit the flaw to install an EFI rootkit by using a remote vector, this is possible because the flash lock are removed when machines enter a sleep state for about 30 seconds.

“The bug can be used with a Safari or other remote vector to install an EFI rootkit without physical access [provided] a suspended happens in the current session … you could probably force the suspend and trigger this, all remotely. That’s pretty epic ownage.” states the experts. ” Is physical access required to exploit this bug? No, there’s no physical access required to exploit this. You can trigger sleep with “sudo pmset sleepnow” (thanks Trammell). And then you just wait to come back from sleep and continue exploitation.”

During this time period, an attacker can update the content of the flash rom memory, including EFI binaries.rom memory, including EFI binaries.

MacBook Pro Retina and Pro, and MacBook Airs, running the latest EFI firmware updates are vulnerable to zero-day exploit.

It is curious to note that not all the above systems are affected by the flaw, Vilaça speculate that Apple is aware of the zero-day flaw and has already applied the necessary patch for some of its models.

“If they (Apple) indeed knew about the bug – because I don’t believe it’s a coincidence not working in latest machines – then they keep their pattern of not patching older versions,” he says.

The researcher also provided the instruction to test the bug by comparing the firmware present of the user’s machine with an image he has archived.

“Downloading DarwinDumper and load the DirectHW.kext kernel extension. Then you can use flashrom with “flashrom -r biosdump -V -p internal” to dump the bios and show the register contents. Else you can compile yourself DirectHW.kext and also flashrom. DarwinDumper just works out of the box and its kext appears to be legit (it’s on Apple exclusion list so at least Apple trusts it ;-)).”

Let’s wait for the Apple comment.

Stay tuned.

Pierluigi Paganini