MacOS malware used run-only AppleScripts to avoid detection for five years

The macOS.OSAMiner has been active since 2015, primarily infecting users in Asia.

MacOS Macbook Apple

Image: Bundo Kim

For more than five years, MacOS users have been the targets of a sneaky malware operation that used a clever trick to avoid detection and hijacked the hardware resources of infected users to mine cryptocurrency behind their backs.

ZDNet Recommends

The best antivirus software and apps

A roundup of the best software and apps for Windows and Mac computers, as well as iOS and Android devices, to keep yourself safe from malware and viruses.

Read More

Named OSAMiner, the malware has been distributed in the wild since at least 2015 disguised in pirated (cracked) games and software such as League of Legends and Microsoft Office for Mac, security firm SentinelOne said in a report published this week.

"OSAMiner has been active for a long time and has evolved in recent months," a SentinelOne spokesperson told ZDNet in an email interview on Monday.

Also: Best VPNs • Best security keys

"From what data we have it appears to be mostly targeted at Chineses/Asia-Pacific communities," the spokesperson added.

Nested run-only AppleScripts, for the win!

But the cryptominer did not go entirely unnoticed. SentinelOne said that two Chinese security firms spotted and analyzed older versions of the OSAMiner in August and September 2018, respectively.

But their reports only scratched the surface of what OSAMiner was capable of, SentinelOne MacOS malware researcher Phil Stokes said yesterday.

The primary reason was that security researchers weren't able to retrieve the malware's entire code at the time, which used nested run-only AppleScript files to retrieve its malicious code across different stages.

As users installed the pirated software, the boobytrapped installers would download and run a run-only AppleScript, which would download and run a second run-only AppleScript, and then another final third run-only AppleScript.

Since "run-only" AppleScript come in a compiled state where the source code isn't human-readable, this made analysis harder for security researchers.

Yesterday, Stokes published the full-chain of this attack, along with indicators of compromise (IOCs) of past and newer OSAMiner campaigns. Stokes and the SentinelOne team hope that by finally cracking the mystery surrounding this campaign and by publishing IOCs, other MacOS security software providers would now be able to detect OSAMiner attacks and help protect MacOS users.

"Run-only AppleScripts are surprisingly rare in the MacOS malware world, but both the longevity of and the lack of attention to the MacOS.OSAMiner campaign, which has likely been running for at least 5 years, shows exactly how powerful run-only AppleScripts can be for evasion and anti-analysis," Stokes concluded in his report yesterday.

"In this case, we have not seen the actor use any of the more powerful features of AppleScript that we've discussed elsewhere [12], but that is an attack vector that remains wide open and which many defensive tools are not equipped to handle."

The IOCs are available in the SentinelOne OSAMiner report, here.