Zscaler to Expand Zero Trust Exchange Platform's AI Cloud with Data Fabric Purpose-built for Security

Zscaler Blog

Get the latest Zscaler blog updates in your inbox

Subscribe
Security Research

Saefko: A new multi-layered RAT

RAJDEEPSINH DODIA, PRIYANKA BHATI
August 08, 2019 - 11 min read

Recently, the Zscaler ThreatLabZ team came across a new remote-access trojan (RAT) for sale on the dark web. The RAT, called Saefko, is written in .NET and has multiple functionalities. This blog provides a detailed analysis of this piece of malware, including its HTTP, IRC, and data stealing and spreading module.
 

Background

A RAT is a type of malware that includes a backdoor for remote administrative control of the targeted computer. RATs are usually downloaded as a result of a user opening an email attachment or downloading an application or a game that has been infected. Because a RAT enables administrative control, the intruder can do just about anything on the targeted computer, such as monitoring user behavior by logging keystrokes, accessing confidential information, activating the system's webcam, taking screenshots, formatting drives, and more.

Upon successful infection, the Saefko RAT stays in the background and executes every time the user logs in. It fetches the chrome browser history looking for specific types of activities, such as those involving credit cards, business, social media, gaming, cryptocurrency, shopping, and more. It sends the data it has collected to its command-and-control (C&C) server and requests for further instructions. The C&C instructs the malware to provide system information and the RAT will begin to collect a range of data including screenshot,videos, keystroke logs and more. The C&C can also instruct the malware to download additional payload onto the infected system.

RATs present a unique business threat. They have the ability to steal a lot of data without being detected and spread to other systems across the network. The ThreatLabZ team also detonated the Saefko RAT in the Zscaler Cloud Sandbox to determine its functionality, communications, and the potential threat.
 

Technical Analysis of the Saefko RAT

Saefko malware unpacks itself and places the saefkoagent.exe file in “/%AppData%/Roaming/SaefkoAgent.exe” and executes it. It also copies itself to “/%AppData%/Roaming/windows.exe” and "/%AppData%/Local/explorer.exe” and executes them.

Autostart Key

The Saefko malware creates a startup key to execute the malware at every login. If it is executing from an admin account, it creates the following registry key:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\explorer
Otherwise, it creates a registry key in the following path:
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\explorer

Functionality

Saefko first checks to see whether the internet connection is active by connecting to “clients3.google.com/generate_204”. It then uses a unique technique to identify if the infected system contains any vital information. It fetches the browser history and searches for particular websites that have been visited by the user and makes a count based on the categories mentioned below. From the counts, the attacker can determine which systems it should target first from all the infected systems.


The list of different categories it searches include:


Credit card possibility

paypal.com2c2padyen.comvolusion.com
pay.amazon.comapple.com/apple-pay/atos.netauthorize.net
BIPSbitpay.combpay.combraintreepayments.com
centup.orgcm.comcreditcall.comcybersource.com
mastercard.comdigi.cashdigitalriver.comdwolla.com
elavon.comeuronetworldwide.comeway.iofirstdata.com
fortumo.compay.google.com/send/homeheartlandpaymentsystems.comingenico.com
ippayments.comklarna.comemergentpayments.nemoduslink.com
mpay.comneteller.comofx.compagseguro
payoneer.compaymentwall.compaypoint.copaysbuy.com
paysafe.compaytm.compayzone.co.ukcrunchbase.com
qiwi.comglobalpaymentsinc.comreddotpayment.comsagellc.com
skrill.comstripe.comsquareup.comtencent.com

transfermate.com

transferwise.com

wmtransfer.com

trustly.com
wepay.comverifone.comxendpay.compay.weixin.qq.com
money.yandex.ruwirecard.comtruemoney.comxsolla.com
myshopify.com/adminpayza.com2checkout.com3dcart.com
paysafecard.comweebly.com  

 

Gaming activity value

origin.comsteampowered.comg2a.comtwitch.tv
nichegamer.comtechraptor.netgematsu.comestructoid.com
pcgamer.comgamefaqs.gamespot.comgamespot.comsiliconera.com
rockpapershotgun.comgameinformer.comdecluttr.comglyde.com
gamestop.commicrosoft.com/account/xboxliveplaystation.com/en-us/network/storenintendo.com/games
gog.comgame.co.ukitch.iogamefly.com
greenmangaming.comgaming.youtube.com  



Cryptocurrency value

etoro.com24option.compuatrack.com/coinbull2/luno.com
paxforex.combinance.comcoinbase.comcex.io
changelly.comcoinmama.comxtrade.aecapital.com
paxful.comkraken.compoloniex.comgemini.com
bithumb.comxcoins.iocobinhood.comcoincheck.com
coinexchange.ioshapeshift.iobitso.comindacoin.com
cityindex.co.ukbitbay.netbitstamp.netcryptopia.co.nz
pro.coinbase.comkucoin.combitpanda.comfoxbit.com.br
bitflyer.combitfinex.combit-z.comquadrigacx.com
quadrigacx.combig.onelakebtc.comwex.nz
kuna.ioyobit.iozebpay.comhitbtc.com
bx.in.thtrezor.ioelectrum.orgblockchain.com
crypto.robinhood.comexodus.iomycelium.combitcointalk.org
btc-e.commoonbit.co.inbitcoinaliens.combitcoinwisdom.com
coindesk.comcointelegraph.comccn.comreddit.com/r/Bitcoin/
bitcoin.org/en/blognewsbtc.comblog.spectrocoin.comblog.coinbase.com
bitcoinist.comforklog.comabitcoinc.combitcoin.stackexchange.com
news.bitcoin.comblog.bitfinex.comblog.genesis-mining.com 

 

Instagram activity

instagram.comm.instagram.com

 

Facebook activity

facebook.comm.facebook.com

 

Youtube activity

youtube.comm.youtube.com

 

Google+ activity

plus.google.comm.plus.google.com

 

Gmail activity

gmail.commail.google.com

 

Shopping activity

boohoo.comgymshark.commail.google.comprettylittlething.com
showpo.comathleta.comae.comruelala.com
asos.comsuperdry.comzaful.comzafulswimwear.com
luckybrand.comforever21.comurbanoutfitters.comnastygal.com
jcrew.comanthropologie.comallsaints.comuniqlo.com
armaniexchange.comfashionnova.comsaksoff5th.comtarget.com
macys.combarneys.comzappos.comsneakersnstuff.com
yoox.comnike.comsimmi.comamazon.com
ebay.comwalmart.comnewegg.combestbuy.com
ftd.com1800flowers.comglossier.comsephora.com
thebodyshop.comulta.comhorchow.comhomedepot.com
pier1.combedbathandbeyond.comwayfair.comshoptiques.com
viator.cometsy.comcloud9living.comseatgeek.com
aliexpress.comalibaba.com  

 

Business value

linkedin.comtwitter.comnasdaq.comft.com
reuters.comnyse.comtsx.commarketwatch.com
thestreet.comwsj.cominvesting.cominvestopedia.com
finance.yahoo.comseekingalpha.comfool.cominvestorguide.com
zacks.comhome.saxoforexbrokers.comswissquote.com
cmcmarkets.comfxpro.co.ukforex.comdukascopy.com
interactivebrokers.comtdameritrade.combankofinternet.comally.com
bankpurely.comredneck.bank  

 

Saefko also collects additional user application data, including:

CommandDescription
irc_channelIRC channel name
irc_nicknameNickname
irc_passwordIRC channel Password
irc_portIRC Port for communication to a server
irc_serverServer name
machine_active_timeSystem uptime
machine_artctMachine Architecture
machine_bitcoin_valueNumber of cryptocurrency sites visited by the user
machine_business_valueNumber of business sites visited by the user
machine_calls_activity0
machine_camera_activityNo. of “.png” files present on the desktop
machine_country_iso_codeCountry code fetch from “ipinfo.io/geo”
machine_latlatitude
machine_lnglongitude
machine_creadit_card_posibltyChecks the number of payment sites visited by the user
machine_current_timeTaking machine current time
machine_facebook_activityChecks the number of times the user visited facebook
machine_gaming_valueChecks the number of times the user visited gaming websites
machine_gmail_avtivityChecks the number of times the user visited gmail
machine_googleplus_activityChecks the number of times the user visited google+
machine_instgram_activtyChecks the number of times the user visited Instagram
machine_ipMachine IP
machine_latThe geographic location of the system (latitude)
machine_lngThe geographic location of the system (longitude)
machine_os_type1
machine_screenshotCaptures screenshot and encode it in base 64
machine_shooping_activityChecks number of times shopping sites visit by the user

 

The RAT sends the collected data to a command and control server as shown below:

Image

After getting an "ok" response from the server, Saefko begins the "StartServices" function, which has four different infection modules:

  • HTTPClinet
  • IRCHelper
  • KEYLogger
  • StartLocalServices (USB spreading)

Image


HTTP Clinet

(Possible misspelling of HTTP Client by the author)

The RAT sends a request to the server, requesting for a new task. It sends a command “UpdateAndGetTask” and also sends other information, including machine_ID, machine_os, and privateip, as shown below:

Image

The task is the URL from which the malware downloaded the new payload and executed it on the infected machine.


Key Logger

The malware uses the SetWindowsHookEx API for capturing keystrokes. It stores the captured keystrokes into a “log.txt” file. The filepath is: “\%AppData%\Local\log.txt.”


IRC Helper

First, the malware disconnects the current IRC connection. Then, it sends status information to the C&C as shown below:

Image

  • pass: password
  • command: UpdateHTTPIRCStatus
  • machine_id: unique id sent by C&C in an earlier request
  • irc_status: 1 

Next malware fetch 

  • Serverlist: it selects a server from the list below.
  • Port: port 
  • Nickname: generates a random 7 character name 


List of IRC servers and ports

IRC serverPortIRC serverPort
irc.afterx.net6667irc.cyanide-x.net6667
chat.freenode.net6667irc.europnet.org6667
irc.azzurra.org6669irc.rizon.net6669
irc.dal.net6667irc.efnet.org6667
irc.gamesurge.net6667open.ircnet.net6669
irc.quakenet.org6667irc.swiftirc.net6667
eu.undernet.org6667irc.webchat.org7000
irc.2600.net6667irc.abjects.net6669
irc.accessirc.net6667irc.afternet.org6667
irc.data.lt6667irc.allnetwork.org6667
irc.alphachat.net6667irc.austnet.org6667
irc.axenet.org6667irc.ayochat.or.id6667
irc.beyondirc.net6669irc.blitzed.org6667
irc.bongster.org6669irc.caelestia.net6667
irc.canternet.org6667irc.chatall.org6669
irc.chatcafe.net6667irc.chatspike.net6667
irc.chatzona.org6667irc.criten.net6667
irc.cyberarmy.net6667irc.d-t-net.de6667
irc.darkmyst.org6667irc.deepspace.org6667
irc.dream-irc.de6667irc.drlnet.com6667
irc.dynastynet.net6667irc.echo.com6667
irc.ecnet.org6667irc.enterthegame.com6667
irc.epiknet.org6667irc.esper.net6667
irc.euirc.net6669irc.evolu.net6667
irc.explosionirc.net6667irc.fdfnet.net6668
irc.fef.net6667  

 

Saefko connects to one of these servers and waits for a response. In the response, it checks for “T_T” string and any separate messages using that string. Below is the list of IRC functions that the RAT can perform. According to the command it receives, Saefko will respond with corresponding data.


List of IRC Commands

IRC CommandDescription
dexeDownload a file from a given URL and execute it
hdexeDownload a file from a given URL and execute it (UseShellExecute=false)
vistpageOpen URL
hvistpageOpen URL (UseShellExecute = false)
snapshot

Captures video frame, converts into Base64 and sends to C&C (Detailed information explained below); also replies “.oksnapshot”

shellExecutes command using cmd.exe
tcpMakes a tcp connection using a given IP and port.
identify

Send system information:

OS type: Microsoft windows

OS version: OS version

OS Username: username

OS MachineName: System name

OS SystemDirectory: System Directory

opencdOpen CDROM drive. Command: set CDAudio door open
closecdClose CDROM drive. Command: set CDAudio door closed
screenshotCapture screenshot, encode it into Base64 and send to C&C
pingReply “okping”
camlist

Gets the video devices from the system and sends information to the C&C.Detailed information explained below.

pwdCurrent directory
location

Gets the system location using “https://ipinfo.io/geo”

IP, city, region, country, latitude and longitude

keylogsEncode the keylog file (log.txt) using base64 and send it to C&C
uninstallDelete the autostart registry key (RUN) and terminate itself.

 

Camlist

Saefko also searches for the following payloads in the system:

  • AForge.dll
  • AForge.Video.DirectShow.dll
  • AForge.Video.dll
  • Sqlite3.dll

If these files are not present, the malware sends a request to the C&C to download these files. Next, it searches for a list of video input devices on the targeted system and sends the related information to the C&C.

Image

Snapshot

Saefko also captures videos from the device present on the system, encodes the video frame with Base64 and sends it to the C&C.

Image


Start USB Service

Saefko checks to see if the drive type is either removable or networked, after which it starts the infection and copies the files below onto a removable drive.

  • Sas.exe
  • USBStart.exe
  • usbspread.vbs

Sas.exe is a copy of the malware itself. USBStart.exe is fetched from the resource section of the main binary. It contains code to execute Sas.exe. It creates a usbspread.vbs file then executes it. It searches every directory and all the files and creates a "lnk" file for each file and directory with a target path USBStart.exe file. When the removable device is plugged in any other system, the user is tricked into clicking a lnk file as the main files and folder are hidden. Lnk file executes the USBStart.exe that ends up executing Sas.exe which is the main payload. So it futher infect other Systems.

Below is the code of the usbspread.vbs file:

Image

One online forum has an ad for a cracked Saefko RAT tool as shown below. It is a multi-protocol, multi-operating system remote administration tool that can be used to launch the malware on Windows and Android devices.

Image

 

Conclusion

To protect systems from RATs, users must refrain from downloading programs or opening attachments that aren't from a trusted source. At the administrative level, it's always a good idea to block unused ports, turn off unused services, and monitor outgoing traffic. Attackers are often careful to prevent the malware from doing too much activity at once, which would slow down the system and possibly attract the attention of the user and IT.

Zscaler ThreatLabZ team continues to monitor this threat and others to ensure that Zscaler customers are protected.
 

IOCs

Md5:
D9B0ECCCA3AF50E9309489848EB59924
C4825334DA8AA7EA9E81B6CE18F9C15F
952572F16A955745A50AAF703C30437C
4F2607FAEC3CB30DC8C476C7029F9046
7CCCB06681E7D62B2315761DBE3C81F9
5B516EAB606DC3CC35B0494643129058

Downloader URL:
industry.aeconex[.]com/receipt-inv.zip
3.121.182[.]157/dwd/explorer.exe
3.121.182[.]157/dwd/vmp.exe
deqwrqwer.kl[.]com.ua/ex/explorer.exe
maprivate[.]date/dhl-miss%20craciun%20ana%20maria%20#bw20feb19.zip

Network URL:
acpananma[.]com/love/server.php
3.121.182[.]157/smth/server.php
f0278951.xsph[.]ru/server.php
maprivate[.]date/server.php

form submtited
Thank you for reading

Was this post useful?

dots pattern

Get the latest Zscaler blog updates in your inbox

By submitting the form, you are agreeing to our privacy policy.