New ThiefQuest macOS ransomware spreads via pirated software

A new data wiper and info-stealer called ThiefQuest is using ransomware as a decoy to steal files from macOS users. The victims get infected after downloading trojanized installers of popular apps from torrent trackers.

While not common, ransomware has been known to target the macOS platform in the past, with KeRanger, FileCoder (aka Findzip), and Patcher being three other examples of malware designed to encrypt Mac systems.

ThiefQuest was first spotted by K7 Lab malware researcher Dinesh Devadoss and analyzed by Malwarebytes' Director of Mac & Mobile Thomas Reed, Jamf Principal Security Researcher Patrick Wardle, and BleepingComputer's Lawrence Abrams, who found an interesting twist.

Installs a keylogger and opens a reverse shell

Devadoss discovered that ThiefQuest includes the capability to check if it's running in a virtual machine (more of a sandbox check according to Wardle), and it features anti-debug capabilities.

It also checks for some common security tools (Little Snitch) and antimalware solutions (Kaspersky, Norton, Avast, DrWeb, Mcaffee, Bitdefender, and Bullguard) and opens a reverse shell used for communication with its command-and-control (C2) server as VMRay technical lead Felix Seele found.

The malware will connect to http://andrewka6.pythonanywhere[.]com/ret.txt to get the IP address of the C2 server to download further files and send data.

"Armed with these capabilities the attacker can maintain full control over an infected host," Wardle said.

Pirated app infected with ThiefQuest ransomware promoted on RUTracker
Pirated app infected with ThiefQuest ransomware promoted on RUTracker (Malwarebytes)

Distributed as pirated apps on torrent sites

As Reed found after examining the ransomware, ThiefQuest is dropped using infected installers wrapping legitimate software including but not limited to Little Snitch, Ableton, and Mixed in Key.

Even though the malicious .PKG installers downloaded from popular torrent sites are code signed and look just as any legitimate installer would when launched, they are distributed as DMG files and don't have a custom icon, a warning sign that something is not quite right for many macOS users.

Reed also found that, in the case of one of the ThiefQuest samples analyzed, the packages of compressed installer files include the pirated apps' original installers and uninstallers, together with a malicious patch binary and a post-install script used to launch the installer and launch the malware.

ThiefQuest also copies itself into ~/Library/AppQuest/com.apple.questd and creates a launch agent property list at ~/Library/LaunchAgents/com.apple.questd.plist with a RunAtLoad key set to true to automatically get launched whenever the victim logs into the system.

After gaining persistence on the infected device, ThiefQuest launches a configured copy of itself and starts encrypting files appending a BEBABEDD marker at the end.

BEBABEDD  marker

Unlike Windows ransomware, ThiefQuest has issues starting to encrypt files. When it does, it isn't picky.

It seems to be locking files randomly, generating various issues on the compromised system from encrypting the login keychain to resetting the Dock to the default look, and causing Finder freezes.

"Once file encryption is complete, it creates a text file named READ_ME_NOW.txt with the ransom instructions," Wardle added, and it will also display and read a modal prompt using macOS' text-to-speech feature letting the users know that their documents were encrypted.

The victims are asked to pay a $50 ransom in bitcoins within three days (72 hours) to recover their encrypted files and are directed to read a ransom note saved on their desktops.

ThiefQuest encryption message
ThiefQuest encryption message
ThiefQuest ransom note
ThiefQuest ransom note

Suspiciously, ThiefQuest is using the same static Bitcoin address for all victims and does not contain an email address to contact after payment has been made.

This makes it impossible for the attackers to identify victims who paid the ransom, and for a victim to contact the ransomware operators for a decryptor.

Combining a static Bitcoin address with a lack of contact methods is a strong indication that the ransomware is a wiper instead.

Wipers, though, are usually used as a cover for some other malicious activity.

Wiper malware used for data theft

After the malware was analyzed by BleepingComputer's Lawrence Abrams, we believe that the ransomware is simply a decoy for the true purpose of this malware.

That is to search for and steal certain file types from the infected computer.

When the malware is executed on a Mac, it will execute shell commands that download Python dependencies, Python scripts disguised as GIF files, and then run them.

Shell commands
Executed shell commands
Source: BleepingComputer

The tasks conducted by the above command are:

  • Delete the /Users/user1/client/exec.command and /Users/user1/client/click.js files.
  • Download and install PIP
  • Install the Python 'requests' dependency
  • Download p.gif, which is a Python file, and execute it.
  • Download pct.gif, which is another Python file, and execute it.

The p.gif file is a heavily obfuscated Python script, and we have not been able to determine what its functionality is.

Heavily obfuscated Python script
Heavily obfuscated Python script
Source: BleepingComputer

Of particular interest in the above file is the comment:

# n__ature checking PoC
# TODO: PoCs are great but this thing will
# deliver much better when implemented in
# production

The pct.gif file is not obfuscated and is clearly a data exfiltration script that steals files under the /Users folder and sends it to a remote URL.

Data exfiltration script
Source: BleepingComputer

When executed, this script will search for any files under the /Users folder that contain the following extensions

.pdf, .doc, .jpg, .txt, .pages, .pem, .cer, .crt, .php, .py, .h, .m, .hpp, .cpp, .cs, .pl, .p, .p3, .html, .webarchive, .zip, .xsl, .xslx, .docx, .ppt, .pptx, .keynote, .js, .sqlite3, .wallet, .dat

For any files that matches the search criteria, it will base64 encode the contents of the file and send it and the path of the file back to the threat actors Command & Control server.

These files include text files, images, Word documents, SSL certificates, code-signing certificates, source code, projects, backups, spreadsheets, presentations, databases, and cryptocurrency wallets.

To illustrate how this may look on the other end for the threat actor, BleepingComputer created a proof-of-concept script that accepted the requests from the above data-stealing script.

PoC
PoC of receiving of stolen files
Source: BleepingComputer

While our PoC only logs the contents of a file to our log file, it could have written each file to a folder matching the victim's IP address.

One interesting feature of this script is that it will not transfer any files greater than 800KB in size.

Advanced Intel's Vitali Kremez, who BleepingComputer shared the script with, agreed with our findings and pointed out that many of the searched file types are generally over 800KB in size.

What victims should do?

As you can see, the ThiefQuest wiper is much more damaging than first thought, as not only will data be encrypted, but it may not even be decryptable if a victim pays.

To make matters worse, the malware will steal files from your computer that contain sensitive information that could be used for a variety of malicious purposes, including identity theft, password harvesting, stealing of cryptocurrency, and stealing private security keys and certificates.

If you were infected with this malware, you should assume any files that match the listed extensions have been stolen or compromised in some manner.

While it is not known if a decryptor can be made, users can install Wardle's free RansomWhere utility, which detects ThiefQuest's attempts to gain persistence and allows them to terminate it once it starts locking their files.

Reed also says that Malwarebytes for Mac is capable of detecting this new macOS ransomware as Ransom.OSX.ThiefQuest and will remove it from infected Macs.

At the moment, researchers are still looking into what encryption ThiefQuest uses to encrypt its victims' files and if there are any weaknesses in the encryption.


Update July 02, 09:00 EDT: We updated the title and the article to reflect the malware's name change to ThiefQuest from EvilQuest (a name used by Chaosoft Games Xbox 360 and PC video game since 2012.) 

Related Articles:

New RustDoor macOS malware impersonates Visual Studio update

CISA warns of patched iPhone kernel bug now exploited in attacks

Oracle warns that macOS 14.4 update breaks Java on Apple CPUs

INC Ransom threatens to leak 3TB of NHS Scotland stolen data

US offers up to $15 million for tips on ALPHV ransomware gang

IOCs

Network traffic:

http://andrewka6.pythonanywhere.com/ret.txt
http://167.71.237.219

Ransom note text:

YOUR IMPORTANT FILES ARE ENCRYPTED

Many of your documents, photos, videos, images and other files are no longer accessible because they have been encrypted. Maybe you are busy looking for a way to recover your files, but do not waste your time. Nobody can recover your file without our decryption service.

We use 256-bit AES algorithm so it will take you more than a billion years to break this encryption without knowing the key (you can read Wikipedia about AES if you don't believe this statement).
Anyways, we guarantee that you can recover your files safely and easily. This will require us to use some processing power, electricity and storage on our side, so there's a fixed processing fee of 50 USD. This is a one-time payment, no additional fees included.
In order to accept this offer, you have to deposit payment within 72 hours (3 days) after receiving this message, otherwise this offer will expire and you will lose your files forever.
Payment has to be deposited in Bitcoin based on Bitcoin/USD exchange rate at the moment of payment. The address you have to make payment is:

                    13roGMpWd7Pb3ZoJyce8eoQpfegQvGHHK7

Decryption will start automatically within 2 hours after the payment has been processed and will take from 2 to 5 hours depending on the processing power of your computer. After that all of your files will be restored.

THIS OFFER IS VALID FOR 72 HOURS AFTER RECEIVING THIS MESSAGE