#### p g
# The Mac Malware of 2021
##### a comprehensive analysis of the year's new malware!
by: Patrick Wardle / January 1, 2022
Objective-See's research, tools, and writing, are supported by the "Friends of Objective-See" such as:
1Password
Jamf
Mosyle
Kandji
CleanMyMac X
Kolide
### Printable
A printable (PDF) version of this report can be downloaded here:
**[The Mac Malware of 2021.pdf](https://objective-see.com/downloads/MacMalware_2021.pdf)**
### 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:](https://www.computerworld.com/article/3636409/apple-gains-traction-as-enterprise-workplaces-become-hybrid.html)**
-----
…and unsurprisingly macOS malware continues following suit!
```
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.
**Features & Goals:**
What was the purpose of the malware? a backdoor? a cryptocurrency miner? or something more insidious…
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!
### Malware Analysis Tools & Tactics
Throughout this blog, I reference various tools used in analyzing the malware specimens. While there are a myriad of malware analysis tools,
these are some of my favorites, and include:
```
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!
```
Interested in general Mac malware analysis techniques?
You're in luck, as I've written an entire (free) book on this
very topic:
The Art Of Mac Malware, Vol. 0x1: Analysis
```
-----
Below, is a timeline highlighting the new macOS malware of 2021:
-----
g
```
OSX.ElectroRAT
ElectroRAT is a cross-platform remote “administration” tool (RAT), designed to steal information from
cryptocurrency users.
Download: OSX.ElectroRAT (password: infect3d)
###### ElectroRAT was uncovered by Intezer, who note:
```
_"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”](https://objective-see.com/blog/blog_0x61.html)**
**[“Operation ElectroRAT: Attacker Creates Fake Companies to Drain Your Crypto Wallets”](https://www.intezer.com/blog/research/operation-electrorat-attacker-creates-fake-companies-to-drain-your-crypto-wallets/)**
**Infection Vector: Trojanized/Fake Crypto-Currency Applications**
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):](https://objective-see.com/products/utilities.html#ProcessMonitor)**
###### # 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 } }
**Persistence: Launch Item**
```
OSX.ElectroRAT persists as a launch agent (mdworker.plist).
```
-----
###### # 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 Label mdworker ProgramArguments /Users/user/.mdworker RunAtLoad
As the RunAtLoad is set to true the OS will automatically (re)launch the malware each time the user (re)logs in.
**Capabilities: Persistent Backdoor (+ embedded binaries).**
[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](https://twitter.com/AbbyMCH)
_IP address":_
-----
[[1/7] Operation #ElectroRAT is a new campaign that takes sizable](https://twitter.com/hashtag/ElectroRAT?src=hashtag_click)
measures to steal crypto wallets. For more information about the
[operation - intezer.com/blog/research/…](https://t.co/CWLnOevKir?amp=1)
The following is a technical analysis->
[@IntezerLabs](https://twitter.com/IntezerLabs?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470186082136064%7Ctwgr%5E%7Ctwcon%5Es2_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
ElectroRAT: Attacker Creates Fake Companies to Drain Crypto…
Wide-spread campaign already with thousands of victims
promotes trojanized applications on niche cryptocurrency …
intezer.com
Avigayil Mechtinger
@AbbyMCH
#### [2/7] Upon execution, ElectroRAT queries a raw pastebin page to retrieve the C&C IP address. The malware then calls the registerUser function, which creates and sends a user registration Post request to the C&C.
[4:54 AM · Jan 5, 2021](https://twitter.com/AbbyMCH/status/1346470186082136064?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470186082136064%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
4 [Reply](https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470186082136064%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html&in_reply_to=1346470186082136064) Share this Tweet
[Read 2 replies](https://twitter.com/AbbyMCH/status/1346470186082136064?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470186082136064%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
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:
-----
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
#### [5/7] Commands received from the C&C are parsed by the RAT using corresponding functions before sending a message back with the response. The commands are sent as a json structure with the following keys: type, uid and data for additional parameters needed for the command.
[4:54 AM · Jan 5, 2021](https://twitter.com/AbbyMCH/status/1346470201173266432?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470201173266432%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
4 [Reply](https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470201173266432%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html&in_reply_to=1346470201173266432) Share this Tweet
[Read 1 reply](https://twitter.com/AbbyMCH/status/1346470201173266432?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470201173266432%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
[4:54 AM · Jan 5, 2021](https://twitter.com/AbbyMCH/status/1346470201173266432?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1346470201173266432%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
**[Avigayil also notes that:](https://twitter.com/AbbyMCH)**
_"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.](https://objective-see.com/blog/blog_0x61.html)
These binaries include:
```
darwinCam (SHA1: 7e0a289572c2b3ef5482dded6019f51f35f85456):
```
-----
###### ./darwinCam -h
USAGE: ./darwinCam [options] [filename] Version: 0.2.5 Captures an image from a video device and saves it in a file. If no device is specified, the system default will be used. If no filename is specfied, snapshot.jpg will be used. Supported image types: JPEG, TIFF, PNG, GIF, BMP -h This help message -v Verbose mode -l List available video devices -t x.xx Take a picture every x.xx seconds -q Quiet mode. Do not output any text -w x.xx Warmup. Delay snapshot x.xx seconds after turning on camera -d device Use named video device
```
darwinChrome (SHA1: 4bb418ba9833cd416fd02990b8c8fd4fa8c11c0c):
```
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:](https://github.com/extremecoders-re/pyinstxtractor)**
###### $ python pyinstxtractor.py darwinChrome
[+] Processing darwinChrome
[+] Pyinstaller version: 2.1+
[+] Python version: 27
[+] Length of package: 5155779 bytes
[+] Found 109 files in CArchive
[+] Beginning extraction...please standby
[+] Possible entry point: pyiboot01_bootstrap.pyc
[+] Possible entry point: Apple.pyc
[+] Found 335 files in PYZ archive
[+] Successfully extracted pyinstaller archive: darwinChrome
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.
darwinKeylogger (SHA1: 3bcbfc40371c8d96f94b5a5d7c83264d22b0f57b):
```
This binary appears to be a basic macOS keylogger based on the open-source **[Swift-Keylogger project (that (ab)uses](https://github.com/SkrewEverything/Swift-Keylogger/blob/master/Keylogger/Keylogger/Keylogger.swift)**
```
IOHIDManagerCreate / IOHIDManagerRegisterInputValueCallback).
darwinVnc (SHA1: 872da05c137e69617e16992146ebc08da3a9f58f):
```
[This binary appears to the well known OSXvnc, a “robust, full-featured VNC server for MacOS X":](https://github.com/stweil/OSXvnc)
###### ./darwinVnc -h
Available options:
-rfbport port TCP port for RFB protocol -rfbwait time Maximum time in ms to wait for RFB client -rfbnoauth Run the server without password protection -rfbauth passwordFile Use this password file for VNC authentication (use 'storepasswd' to create a password file)
-----
```
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
**[Avigayil sums this up well:](https://twitter.com/AbbyMCH)**
_"ElectroRAT is extremely intrusive._
_...it has various capabilities such as keylogging, downloading files and executing commands on the victim's console."_
-----
```
Compiled to natively execute on Apple Silicon (M1/arm64), this payload-less malware, affected
approximately 30,000 Macs.
Download: OSX.SilverSparrow (password: infect3d)
```
```
SilverSparrow was discovered by researchers at Red Canary, in mid-February:
```
Red Canary
@redcanary
#### Silver Sparrow is a cluster of activity that includes a binary compiled to run on Apple’s new M1 chips but lacks one very important feature: a malicious payload. redcanary.com/blog/clipping-…
Silver Sparrow macOS malware with M1 compatibility
Silver Sparrow includes a binary compiled to run on Apple’s new
M1 chips but lacks one very important feature: a payload
redcanary.com
[2:21 PM · Feb 18, 2021](https://twitter.com/redcanary/status/1362557900128985089?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1362557900128985089%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
[Read the full conversation on Twitter](https://twitter.com/redcanary/status/1362557900128985089?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1362557900128985089%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
285 [Reply](https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1362557900128985089%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html&in_reply_to=1362557900128985089) Share this Tweet
[Read 8 replies](https://twitter.com/redcanary/status/1362557900128985089?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1362557900128985089%7Ctwgr%5E%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fobjective-see.com%2Fblog%2Fblog_0x6B.html)
They shared their findings in a detailed **[write-up …have a read!](https://redcanary.com/blog/clipping-silver-sparrows-wings/)**
**Writeups:**
**[“Clipping Silver Sparrow’s wings”](https://redcanary.com/blog/clipping-silver-sparrows-wings/)**
**[“The mystery of the Silver Sparrow Mac malware”](https://blog.malwarebytes.com/mac/2021/02/the-mystery-of-the-silver-sparrow-mac-malware/)**
**Infection Vector: Installer Packages, via ...?**
-----
[The noted mac malware analyst Thomas Reed, articulates this well:](https://twitter.com/thomasareed)
_"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”
SilverSparrows Packages / Logic (credit: Red Canary)
We can expand the .pkg file, then view this JavaScript (found in the .pkgs Distribution XML):
###### % pkgutil --expand-full SilverSparrow/updater.pkg SilverSparrow/expandedPKG
% cat SilverSparrow/expandedPKG/Distribution ...