MacBook and iMac lines is more prevalent than some users realize; it can even hide in Apple’s curated Mac App Store. But the relatively strong defenses of macOS make it challenging for malware authors to persist long-term on Apple computers, even if they can get an initial foothold. Additionally, the avenues available for lurking on macOS are so well known at this point that technicians and malware scanners can flag them quickly. That’s why more subtle approaches are significant.
At the Virus Bulletin security conference in Montreal on Wednesday, Mac security researcher Thomas Reed is presenting one such potentially dangerous opening. When you launch an app installer in macOS, a program called Gatekeeper checks to see whether the app originated from the Mac App Store, or is cryptographically signed by a developer who has registered with Apple. All legitimate programs have to be “code signed” to establish their validity and integrity. By checking a file’s code signature, Gatekeeper can warn you if a program is malware or if someone has tampered with an otherwise benign installer.
These code signature checks are a vital security step. But Reed, who is the director of Mac and mobile platforms at the security firm Malwarebytes, has noticed that once a program passes a code signature check and gets installed, macOS never rechecks its signature. This means that attackers who buy a legitimate certificate from Apple—or steal one—can potentially trick Mac users into installing their malware. And if it manages to infect other legitimate programs after being downloaded, it could evade detection indefinitely.
“Once you have opened an app, you will never get a code signature check ever again on macOS,” Reed says. “So even if it has been maliciously modified or damaged and the code signature is invalid, the OS will not check it again. That provides a big open window for malware persistence. If the malware can infect some of your apps that are already on disk then it can get in there and stay hidden—you’ll never think to look for it there and it can run in the background without you being any the wiser.”