[ad_1]
Introduction
The DotNet primarily based CyaX-Sharp loader, also called ReZer0, is thought to unfold commodity malware, resembling AgentTesla. In recent times, this loader has been referenced quite a few occasions, because it was utilized in campaigns throughout the globe. The story of CyaX-Sharp is attention-grabbing, because the takeaways present perception into the best way actors choose to make use of the loader. Moreover, it shines a lightweight onto a spot that isn’t typically illuminated: the internal workings of loaders.
This weblog is cut up up into a number of segments, beginning with a short preface relating to the protection of loaders in stories. After that, the origin of the loader’s title is explored. Subsequent, the loader’s capabilities are mentioned, in addition to the automated extraction of the embedded payload from the loader. Lastly, the majority evaluation of 513 distinctive loader samples is mentioned.
Loaders and their Protection in Blogs
To hide the malware, actors typically use a loader. The aim of a loader is, as its title implies, to load and launch its payload, thereby beginning the subsequent stage within the course of. There may be a number of loaders which might be executed sequentially, very like a Russian Matryoshka doll through which the smallest doll, which is hidden inside quite a few others, is the ultimate payload. The “smallest doll” usually accommodates the malware’s most important capabilities, resembling stealing credentials, encrypting information, or offering distant entry to the actor.
Whereas there may be lots of analysis into the actions of the ultimate payload, the sooner phases are simply as attention-grabbing and related. Regardless that the sooner phases don’t include the capabilities of the malware that’s finally loaded, they supply perception as to what steps are taken to hide the malware. Blogs usually point out the capabilities of a loader briefly, if in any respect. The draw back right here lies within the potential detection guidelines that others can create with the weblog, as the main focus is on the ultimate step within the course of, whereas the detection ought to begin as quickly as attainable.
Per greatest safety practices, organizations ought to shield themselves at each step alongside the best way, somewhat than solely specializing in the skin perimeter. These risk fashions are sometimes called the, respectively, onion and egg mannequin. The egg’s onerous shell is hard to interrupt, however as soon as inside, an attacker has free roam. The onion mannequin opposes the attacker each step of the best way, as a consequence of its layered strategy. Figuring out the habits of the ultimate payload is useful to detect and block malware though, ideally, the malware can be detected as early on as attainable.
This weblog focuses on one particular loader household, however the takeaways are legitimate in a broader sense. The popular configurations of the actors are helpful to know how loaders can be utilized in a wide range of assaults.
Complicated Household Names
A current weblog by G Knowledge’s Karsten Hahn offers a extra in-depth look into malware households ambiguous naming schemes. This loader’s title can be ambiguous, as it’s recognized by a number of names. Samples are sometimes named primarily based on distinctive traits in them. The title CyaX-Sharp is predicated upon the recurring string in samples. That is, nonetheless, precisely why it was additionally named ReZer0.
When trying on the most used names inside the 513 obtained samples, 92 use CyaX-Sharp, whereas 215 use ReZer0. This might make it doubtless that the loader can be dubbed ReZer0, somewhat than CyaX-Sharp. Nonetheless, when trying on the pattern names over time, as may be seen within the graph under, the explanation why CyaX-Sharp was chosen turns into obvious: the title ReZer0 was solely launched 8 months after the primary CyaX-Sharp pattern was found. Based mostly on this, McAfee refers to this loader as CyaX-Sharp.

Throughout the settings, one will discover V2 or V4. This isn’t a reference of the loader’s model, however somewhat the focused DotNet Framework model. Throughout the pattern set, 62% of the samples are compiled to run on V4, leaving 38% to run on V2.
The Loader’s Capabilities
Every model of the loader accommodates all core capabilities, which can or will not be executed throughout runtime, primarily based on the loader’s configuration. The uncooked configurations are saved in a string, utilizing two pipes because the delimiting worth. The string is then transformed right into a string array utilizing stated delimiter. Based mostly on the values at particular indices, sure capabilities are enabled. The screenshots under present, respectively, the uncooked configuration worth, and a number of the used indices in a pattern (SHA-256: a15be1bd758d3cb61928ced6cdb1b9fa39643d2db272909037d5426748f3e7a4).


The loader can delay its execution by sleeping for a sure variety of seconds, use a mutex to make sure it’s not already operating, show a message field with a customized message, persist itself as a scheduled process, and/or execute a given payload in a number of methods. The payload may be downloaded from an exterior location, after which it’s began. Alternatively, or moreover, the embedded payload inside the loader may be launched. This may be performed straight from the loader’s reminiscence with the assistance of reflective calls, or by hollowing a newly created course of. The flowchart under visualizes the method. Be aware that the dotted line means the linked step may be skipped, relying on the loader’s configuration.

Course of Hollowing
The newly created course of is among the following: MSBuild.exe, vbc.exe, RegSvcs.exe, or a brand new occasion of the loader. The method hollowing code section appears to be taken from NYAN-x-CAT’s GitHub, because the for-loop to start out the method hollowing technique is current in each the loader and the linked repository. The way in which an error is dealt with is just not a standardized technique, making the hyperlink between the publicly obtainable code very doubtless. The primary picture under reveals the unique code from the repository, whereas the second picture reveals the code from the loader (SHA-256: a15be1bd758d3cb61928ced6cdb1b9fa39643d2db272909037d5426748f3e7a4)


The loop calls the method hollowing perform a number of occasions to extra simply deal with exceptions. Within the case of an exception through the course of hollowing, the focused course of is killed and the perform returns. To attempt a number of occasions, a loop is used.
Adjustments Over Time
Regardless that the loader has modified over time, it maintained the identical core construction. Later variations launched minor modifications to current options. Under, completely different loader variations will probably be described, the place the size of the string array that accommodates the loader’s configuration is used to establish completely different variations. The graph reveals the rise and fall for every of the variations.

There are two notable variations in variations the place the config array’s measurement is bigger than 29. Some particular samples have barely completely different code in comparison with others, however I didn’t think about these variations sizable sufficient to warrant a brand new model.
Firstly, the power to allow or disable the delayed execution of a pattern. If enabled, the execution is delayed by sleeping for a predefined variety of seconds. In config_29, the delay performance is at all times enabled. The length of the delay is predicated on the System.Random object, which is instantiated utilizing the default seed. The given decrease and higher limits are 45,000 and 60,000, leading to a worth between these limits, which equals within the variety of milliseconds the execution needs to be delayed.
Secondly, the characteristic to show a customized message in a immediate has been added. The config file accommodates the message field’ title, textual content, button type, and icon type. Prompts can be utilized to show a faux error message to the sufferer, which can seem like professional e.g. 43d334c125968f73b71f3e9f15f96911a94e590c80955e0612a297c4a792ca07, which makes use of “You don’t have the correct software program to view this doc” as its message.
Payload and Configuration Extraction
To robotically extract the payload and configuration of a given loader, one can recreate the decryption mechanism in a language of selection, get the encrypted information from the loader, and decrypt it. The draw back right here is the necessity for a precise copy of the decryption mechanism. If the important thing have been to alter, or a barely completely different algorithm have been for use, the copy would additionally must replicate these modifications. To keep away from coping with the decryption technique, a special strategy may be taken.
This loader mistakenly makes use of static variables to retailer the decrypted payload and configuration in. In brief, these variables are initialized previous to the execution of the principle perform of the loader. As such, it’s attainable to reflectively receive the worth of the 2 variables in query. An in depth how-to information may be discovered on my private web site. The info that was extracted from the 513 samples within the set is mentioned within the subsequent part.
Bulk Evaluation Outcomes
The whole set consists of 513 samples, all of which have been discovered utilizing a single Yara rule. The rule focuses on the embedded useful resource which is used to persist the loader as a scheduled process on the sufferer’s system. In some circumstances, the Yara rule is not going to match a pattern, because the embedded useful resource is obfuscated utilizing ConfuserEx (one instance being SHA-256 0427ebb4d26dfc456351aab28040a244c883077145b7b529b93621636663a812). To deobfuscate, one can use ViRb3’s de4dot-cex fork of de4dot. The Yara rule will match with the deobfuscated binary. The graph under reveals the variety of distinctive samples over time.

The dates are primarily based on VirusTotal’s first seen date. Granted, this date doesn’t must signify the day the malware was first distributed. Nonetheless, when speaking about commodity malware that’s distributed in bulk, the date is dependable sufficient.
The pattern set that was used is smaller than the overall quantity of loaders which were used within the wild. This loader is commonly not the primary stage, however somewhat an in-memory stage launched by one other loader. Virtually, the pattern set is sizable sufficient for this analysis, nevertheless it needs to be famous that there are extra distinctive loader samples within the wild for the given date vary than are used on this report.
It’s helpful to know what the capabilities of a single pattern are, however the principle space of curiosity of this analysis is predicated upon the evaluation of all samples within the set. A number of options will probably be mentioned, together with ideas on them. On this part, all percentages check with the overall of 513 except in any other case specified.
Widespread Utilization
The loader’s utilization is widespread, with out a direct correlation in the direction of a selected group or geographical area. Regardless that some stories point out a selected actor utilizing or creating this loader, the truth that no less than one builder has leaked makes attribution to a number of actors tough. Coupled with the big variety of focused industries, in addition to the broad geographic focused areas, it seems like a number of actors utilise this loader. The objective of this analysis is to not dig into the actors who utilise this loader, however somewhat to take a look at the pattern set typically. Appendix A offers a non-exhaustive record of public articles that (no less than) point out this loader, in descending chronological order.
Execution Strategies
The 2 choices to launch a payload, both reflectively or through course of hollowing, are broadly aside in utilization: 90% of all loaders makes use of course of hollowing, whereas solely 10% of the samples are launched through reflection. Older variations of the loader generally used to reflectively load a decrypted stager from the loader’s assets, which might then launch the loader’s payload through course of hollowing. The metrics under don’t replicate this, which means the precise share of direct launches is likely to be barely decrease than is at the moment said. The small print may be considered within the graph under.

Be aware that the reflective loading mechanism will default to the method hollowing of a brand new occasion of the loader if any exception is thrown. Solely DotNet primarily based information may be loaded reflectively, which means that different information which might be executed this fashion will probably be loaded utilizing a hollowed occasion of the loader.
Persistence and Mutexes
The persistence technique, which makes use of a scheduled process to start out the loader as soon as the pc boots, is utilized by 54% of the loaders. This doesn’t imply that the opposite 46% of the samples are usually not persevered on the sufferer’s machine, as a special stage may present persistence as properly. Notable is the date inside the scheduled process, which equals 2014-10-25T14:27:44.8929027. This date is, on the time of writing, practically 2500 days in the past. If any of the programs in a company encounter a scheduled process with this precise date, it’s sensible to confirm its origin, in addition to the executable that it factors to.
A 3rd of all loaders are configured to keep away from operating when an occasion is already energetic utilizing a mutex. Just like the persistence mechanism, a mutex could possibly be current in a special stage, although this isn’t essentially the case. The noticed mutexes appear to include solely unaccented alphabetical letters, or [a-zA-Z]+ when written as a daily expression.
Delayed Execution
Delayed execution is utilized by practically 37% of the samples, roughly half of that are config_29, which means this setting was not configurable when creating the pattern. The samples the place the delayed execution was configurable, equal practically 19% of the overall. On common, a 4 second delay is used. The very best noticed delay is 600 seconds. The graph under reveals the length of the delay, and the frequency.

Be aware that one loader was configured to have a delay of 0 seconds, primarily not delaying the execution. Normally, the delayed time is a worth that may be divided by 5, which is commonly seen as a spherical quantity by people.
Environmental Consciousness
Previous to launching the payload, the loader can carry out a number of checks. A digital setting may be detected, in addition to a sandbox. Roughly 10% of the samples verify for the presence of a digital machine, whereas roughly 11% verify whether it is executed in a sandbox. Roughly 8% of the 513 samples verify for the presence of each, previous to persevering with their execution. In different phrases, 88% of the samples that attempt to detect a digital machine, additionally tried to detect a sandbox. Vice versa, 74% of the samples that tried to detect the sandbox, tried to detect in the event that they have been executed on a digital machine.
The choice to disable Home windows Defender was primarily current within the earlier samples, which is why solely 15% of the set makes an attempt to disable it.
Payload Households
The loader’s remaining objective is to execute the subsequent stage on the sufferer’s machine. Figuring out what sort of malware households are sometimes dropped may also help to seek out the most important ache factors in your group’s extra defensive measures. The chart under offers perception into the households that have been noticed essentially the most. The section named different accommodates all samples that might in any other case litter the overview because of the few occurrences per household, such because the RedLine stealer, Azorult, or the lesser recognized MrFireMan keylogger.

The chances within the graph are primarily based on 447 complete payloads, as 66 payloads have been duplicates. In different phrases, 66 of the distinctive loaders dropped a non-unique payload. Of all households, AgentTesla is essentially the most notable, each when it comes to frequency and when it comes to duplicate rely. Of the 66 duplicates, 48 have been associated to AgentTesla.
Barely Utilized Capabilities
Two capabilities of the loader which might be barely used are the message field and the obtain of a distant payload. The utilization of each is, respectively, 1.3% and 0.8%. All the distant payloads additionally contained an embedded payload, though one of many 4 remotely fetching loaders doesn’t include a URL to obtain the distant payload from. The exterior file can be utilized as a further module for a subsequent stage, a separate malicious payload, or it may be used to disable sure protection mechanisms on the sufferer’s system.
Conclusion
Firms utilizing the aforementioned onion safety mannequin profit drastically from the dissection of such a loader, as their inside detection guidelines may be improved with the offered particulars. This stops the malware’s execution in its tracks, as is proven within the sequential diagram of McAfee’s detection under.

The strategies that this loader makes use of are generally abused, which means that the detection of a method resembling course of hollowing can even stop the profitable execution of quite a few different malware households. McAfee’s Endpoint Safety (ENS) and Endpoint Detection & Response (EDR) detect the CyaX-Sharp loader each step of the best way, together with the frequent strategies it makes use of. As such, prospects are protected in opposition to a mess of households primarily based on a program’s heuristics.
Appendix A – Mentions of CyaX-Sharp and ReZer0
Under, a non-exhaustive chronologically descending record of related articles is given. Some articles include info on the focused industries and/or goal geographical space.
- On the 12th of January 2021, ESET talked about the loader in its Operation Spalax weblog
- On the 7th of December 2020, ProofPoint wrote concerning the decryption mechanisms of a number of recognized .NET primarily based packers
- On the 5th of November 2020, Morphisec talked about a packer that appears rather a lot like this loader
- On the 6th of October 2020, G Knowledge talked about the packer (or a modified model)
- On the 29th of September 2020, ZScaler talked about the packer
- On the 17th of September 2020, I wrote concerning the computerized payload and config extraction of the loader
- On the 16th of September 2020, the Taiwanese CERT talked about the loader in a digital COVID-19 risk case research
- On the 23rd of July 2020, ClamAV talked about the loader in a weblog
- On the 14th of Could 2020, Safety agency 360TotalSecurity hyperlinks the loader to the risk actor Vendetta
- On the 21st of April 2020, Fortinet offered perception into the loader’s internal workings
- On the 1st of March 2020, RVSEC0N talked about the loader
- On the 4th of December 2019, Development Micro offered a backstory to CyaX-Sharp
- On the 22nd of March 2019, 360TotalSecurity gave perception into a number of the loader’s options
Appendix B – Hashes
The hashes which might be talked about on this weblog are listed under, so as of prevalence. The SHA-1 and SSDeep hashes are additionally included. A full record of hashes for all 513 samples and their payloads may be discovered right here.
Pattern 1
SHA-256: a15be1bd758d3cb61928ced6cdb1b9fa39643d2db272909037d5426748f3e7a4
SHA-1: 14b1a50c94c2751901f0584ec9953277c91c8fff
SSDeep: 12288:sT2BzlxlBrB7d1THL1KEZ0M4p+b6m0yn1MX8Xs1ax+XdjD3ka:O2zBrB7dlHxv0M4p+b50yn6MXsSovUa
Pattern 2
SHA-256: 43d334c125968f73b71f3e9f15f96911a94e590c80955e0612a297c4a792ca07
SHA-1: d6dae3588a2a6ff124f693d9e23393c1c6bcef05
SSDeep: 24576:EyOxMKD09DLjhXKCfJIS7fGVZsjUDoX4h/Xh6EkRlVMd3P4eEL8PrZzgo0AqKx/6:EyycPJvTGVijUDlhfEEIUvEL8PrZx0AQ
Pattern 3
SHA-256: 0427ebb4d26dfc456351aab28040a244c883077145b7b529b93621636663a812
SHA-1: 8d0bfb0026505e551a1d9e7409d01f42e7c8bf40
SSDeep: 12288:pOIcEfbJ4Fg9ELYTd24xkODnya1QFHWV5zSVPjgXSGHmI:EEj9E/va
[ad_2]

