<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Intezer Research – Apt_china</title><link>https://research.intezer.com/tags/apt_china/</link><description>Recent content in Apt_china on Intezer Research</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 16 Jan 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://research.intezer.com/tags/apt_china/index.xml" rel="self" type="application/rss+xml"/><item><title>Threat Bulletin: Weaponized Software Targets Chinese-Speaking Organizations</title><link>https://research.intezer.com/blog/2025/01/weaponized-software-targets-chinese/</link><pubDate>Thu, 16 Jan 2025 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2025/01/weaponized-software-targets-chinese/</guid><description>
&lt;h2&gt;Overview of the Attack&lt;span class="hx:absolute hx:-mt-20" id="overview-of-the-attack"&gt;&lt;/span&gt;
&lt;a href="#overview-of-the-attack" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Intezer Labs research team has identified a series of attacks targeting
organizations in Chinese-speaking regions like Hong Kong, Taiwan, and China
itself. These attacks utilize a multi-stage loader, which we named PNGPlug, to
deliver the ValleyRAT payload.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bbs.kanxue.com/thread-284691.htm"target="_blank" rel="noopener"&gt;A similar attack chain is documented in this report&lt;/a&gt;,
which sheds light on the infection vector and the method of delivering the
malicious files.&lt;/p&gt;
&lt;p&gt;According to the report, the attack begins with a phishing webpage designed to
encourage victims to download a malicious MSI (Microsoft Installer) package
disguised as legitimate software.&lt;/p&gt;
&lt;p&gt;Upon execution, the installer performs two critical tasks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Deploying a benign application to maintain the illusion of legitimacy.&lt;/li&gt;
&lt;li&gt;Extracting an encrypted archive containing the malware payload.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The MSI package uses the Windows Installer’s CustomAction feature, enabling it
to execute malicious code, including running an embedded malicious DLL that
decrypts the archive (all.zip) using a hardcoded password hello202411 to
extract the core malware components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;libcef.dll: The loader, designed with padding to inflate its size to 220MB,
helps it evade detection as many security tools skip analyzing large files.
(&lt;a href="../../../2023/05/how-hackers-use-binary-padding-to-outsmart-sandboxes/"&gt;For more information about how this technique is used in loaders, check out our recent blog post.&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;down.exe: A legitimate application used to mask malicious activities.&lt;/li&gt;
&lt;li&gt;aut.png and view.png: Files masquerading as PNG images containing encoded
malicious payloads.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Role of the PNGPlug Loader&lt;span class="hx:absolute hx:-mt-20" id="role-of-the-pngplug-loader"&gt;&lt;/span&gt;
&lt;a href="#role-of-the-pngplug-loader" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The primary function of the loader (&lt;code&gt;libcef.dll&lt;/code&gt;) is to set up the environment
for malware execution via the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Patching ntdll.dll: Enables memory injection.&lt;/li&gt;
&lt;li&gt;Command-line Argument Parsing:
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;/aut&lt;/code&gt; argument is present, the loader decrypts the registry path
&lt;code&gt;Software\DICKEXEPATH&lt;/code&gt; using XOR encryption and writes the down.exe path
to the registry (&lt;code&gt;HKEY_CURRENT_USER\Software\DICKEXEPATH&lt;/code&gt;). The loader then
uses the
&lt;a href="https://github.com/hasherezade/pe_to_shellcode/tree/a2458c96619b721677af0f9b906cd6a229364b4c"target="_blank" rel="noopener"&gt;pe_to_shellcode&lt;/a&gt;
injection method to inject the contents of aut.png into memory.
(&lt;a href="https://bbs.kanxue.com/thread-284691.htm"target="_blank" rel="noopener"&gt;For more information about this injected payload, refer to this report.&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;/aut&lt;/code&gt; is absent, the loader runs &lt;code&gt;down.exe&lt;/code&gt; with the argument and
continues its checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Anti-Virus Detection: The loader searches for the presence of 360 Total
Security by checking the path &lt;code&gt;C:\Program Files (x86)\360\360Safeuninst.exe&lt;/code&gt;.
If absent, the loader maps &lt;code&gt;view.png&lt;/code&gt; into memory and creates a new process
(&lt;code&gt;colorcpl.exe&lt;/code&gt;), injecting the contents of &lt;code&gt;view.png&lt;/code&gt;. During
investigations, the process was executing ValleyRAT malware.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The use of .png file extensions for malicious payloads is a key stealth tactic
and inspired the name &lt;strong&gt;PNGPlug&lt;/strong&gt;. As shown in the screenshots below, these PNG
files contain additional data, specifically PE executables, embedded at
specific offsets. This data is loaded and injected into the process as
described earlier, further enhancing the malware’s ability to evade detection
while executing its payload.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/01/weaponized-software-targets-chinese/images/fig1.png" title="Binwalk output for one of the PNG files used by the loader, demonstrating that it has a Windows executable (PE) at offset 0x2AB9E." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Binwalk output for one of the PNG files used by the loader, demonstrating that it has a Windows executable (PE) at offset 0x2AB9E.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/01/weaponized-software-targets-chinese/images/fig2.png" title="A function in the loader that handles the mapping of the PNG file into the memory. Specifically, it looks for the data that begins at offset 0x2AB9E in the PNG file." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;A function in the loader that handles the mapping of the PNG file into the memory. Specifically, it looks for the data that begins at offset 0x2AB9E in the PNG file.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;ValleyRAT Details&lt;span class="hx:absolute hx:-mt-20" id="valleyrat-details"&gt;&lt;/span&gt;
&lt;a href="#valleyrat-details" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;ValleyRAT is a sophisticated, multi-stage malware attributed to the Silver Fox
APT. It employs advanced techniques such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shellcode Execution: Running components directly in memory to reduce its file
footprint and evade detection.&lt;/li&gt;
&lt;li&gt;Obfuscation and Privilege Escalation: Hiding malicious activities and gaining
elevated access.&lt;/li&gt;
&lt;li&gt;Persistence Mechanisms: Leveraging scheduled tasks and registry modifications
to maintain control over infected systems.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The malware’s stages include initial execution, deployment of obfuscated
shellcode, and a loader module that fetches additional malicious components
from its command-and-control (C2) server.&lt;/p&gt;
&lt;h2&gt;Attribution&lt;span class="hx:absolute hx:-mt-20" id="attribution"&gt;&lt;/span&gt;
&lt;a href="#attribution" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href="https://www.fortinet.com/blog/threat-research/valleyrat-campaign-targeting-chinese-speakers#:~:text=This%20relatively%20new%20RAT%20is%20attributed%20to%20the%20suspected%20APT%20group%20%E2%80%9CSilver%20Fox%E2%80%9D."target="_blank" rel="noopener"&gt;Evidence links this campaign to the Silver Fox APT&lt;/a&gt;,
a group known for espionage and cybercrime campaigns targeting Chinese-speaking
individuals and organizations. Their tactics include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Phishing Techniques: Using trojanized files and SEO-optimized phishing sites.&lt;/li&gt;
&lt;li&gt;Espionage Tools: Deploying malware like ValleyRAT and Gh0st RAT to monitor
user activities, deliver plugins, and potentially install additional
payloads.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Based on victimology, infection vectors, and observed payloads, we attribute
this campaign to Silver Fox with high confidence. Their operations underscore
the need for robust cybersecurity measures to counter evolving threats from
sophisticated actors.&lt;/p&gt;
&lt;h2&gt;What’s Interesting?&lt;span class="hx:absolute hx:-mt-20" id="whats-interesting"&gt;&lt;/span&gt;
&lt;a href="#whats-interesting" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;This campaign stands out due to its unique focus on Chinese-speaking victims
and organizations across China, Hong Kong, and Taiwan. It demonstrates an
attack that broadly targets one specific demographic—the Chinese-speaking.
Interestingly, despite their well-documented disputes and distinct political
landscapes, the attackers are treating these regions as a unified target. This
differs from the conventional perspective within the security community, which
often considers them separately when analyzing threats.&lt;/p&gt;
&lt;p&gt;Another notable aspect of these attacks is the potential operational gaps
within these organizations, particularly the lack of investment in employee
tools among some larger companies. This oversight frequently forces employees
to rely on free software, inadvertently increasing their vulnerability to
malicious campaigns.&lt;/p&gt;
&lt;p&gt;Equally striking is the attackers’ sophisticated use of legitimate software as
a delivery mechanism for malware, seamlessly blending malicious activities with
seemingly benign applications. The adaptability of the PNGPlug loader further
elevates the threat, as its modular design allows it to be tailored for
multiple campaigns. This flexibility underscores the evolving nature of the
threat landscape, emphasizing the urgent need for advanced detection and
prevention mechanisms to counter these stealthy and persistent attacks.&lt;/p&gt;
&lt;h2&gt;IOCs&lt;span class="hx:absolute hx:-mt-20" id="iocs"&gt;&lt;/span&gt;
&lt;a href="#iocs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;156.247.33[.]53&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;08dad42da5aba6ef48fca27c783f78f06ab9ea7a933420e4b6b21e12e550dd7d&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;33bc111238a0c6f10f6fe3288b5d4efe246c20efd8d85b4fe88f7d602d70738e&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;50a64e97c6a5417023f3561f33291b448ce830a4d99c40356af67301c8fa7523&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;6d4dd4334791c91bb09e7a91dd5c450b2c6e3348a5586de011c54ce3f473f619&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;76fc76dc651c3cc9d766a6ad8a90f605326463bc4cb2f8f053d44dfbc913beee&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ad23f5c9bab137dc24343fc410f7587885aab6772dee5e75a216ed579c6ee420&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;c497506fe2df57c39fcf92398f4864ca4bfcb1a6f2f80c3c520166bc61882855&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;e49b085f5484531395b5a7903f004b2a02a2b4ebfa46116d1a665ba881b1f528&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;c636120749b49f47fc8d42409ead6c51ea44bc40c815370997ca63f48acdf002&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;79acdca5247ca9719f2f3a34c7942cd60b209f7b616efa5dd81e6656a8baf9a5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;70facc8ad5db172e235b4cc720a0edaedd4470b8a6ec5da8dee2758f4a1aafef&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;e9e4751c88d3a1a4bfdd5d07bb35636787b0d6fbf68b17642d3fe03cbe5ebf70&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;de8a0da702a491f610b9e85050d8641cadf4ed84edf4d151f94335b0d78d6636&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;6d2a4d9e2fc6e4dac2c426851b4bdf86dd63a5515d8d853e622a0bc01d250ce9&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;4a68bdfa3e31a8c063bbf94469160eb7998a556027d5ad33f37c347a71c2d3a4&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;7c31c4d0308fb1d67f6af48a76138a9db19f494c1e9a12debdcca7382ad5418c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;5f9a5ad43a9f79976cd7014ce072429ef2edbae872b4226372cfb07d8a86b8a5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;3ac3ca18142a935608cb0d2c8d6421ebb9abc30bce93f094447b9c3f63fe791b&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9d97f3f55bc647911e14a36c83f263e91662cf9d13a2fc3ec7c92dedb8977d37&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;c070749f95aeeefcd1c3a875c1b8e77b57cad0c8338436af9a3c9e1323fd4e11&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;7eaed6fa867875119c3ebb40aa24716d91fdbccb2106fa4708ff0637920a920c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fa26722e99763a29af160fae64183a47a57362b666753624b78e954c8cde0525&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9aa51d1c82fdbc8f0f27340180bd40faa7e76b8ac6d204b2d3548cfd0897d805&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;58416315c61ed5cb2c754244ed5c081963dabf3e698b04226a00f978cd913e84&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;f2f96e5ac1b4bd6cac49c71ca2010dcbe5751757483520cfc7dddf4fb7186044&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;45.195.148[.]107&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;46af73560cafff5c8bbc16980d01641af0de3b689bc248dfb52afcf3a8a76a55&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;7bff2404c2816c4e1576d449820f01e3f46e7c972beb1843e3b8da2e065f8dc3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;94ff4679dd5aec7874354c14132701ecdfbbb558c6011e4952d13bf843255529&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ae6d88ea99e530f778ee6088862b50dfb6e8bb45857211e9105428c57c2a7b4a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9aea0fdfead2e956bc0b4574c2b4cb2855dd9df6a5fd61d350f3285d249adfca&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;First stage of the loader:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;c5d5054047a12efc68a67abd8f15069a853dd09800cd39d68df5a27702b45334&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a97371df7d51fe0aee1d54b5b233a1713f69224802b1da35337a3041788990e6&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;4b6bf40dc331c89e416ef012a6dc4f55c83136197be7115246b42e4f7a828baa&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;30147b6691e5bc1a15c76cebf81b2de77d9099e8200b6ed9742c6e3b36505f34&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9bd53057c8905d508374698e2595301f0be1529ec4ebfa71c09ad0c01a562982&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;4d64c2d1ae0de0f3066a6c020ab7aa5a9dd487c0cf1ff1ca2e93d98ff30e039f&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;99fb7a40dbf6a042bcb77f67a5a76fe03ec3c6820ac5e15cb009795d545152ea&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;d9e939f904a1cddf5fb8ffba14acbfe227ed5dfc4990b52a44d4dfd0baa6de4e&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0b33f08bc2917c4825c053754fc88e16b35d1a8fff4135595b265a4c6f850250&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd347b9f558cf024df1dbb62ed7a0d72a2edc04b1330058cfa1baf4fc3894e03&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;8aa28f35dbafc18a37b07fd15bb599e3c8de5b692117f1c6fd491bd03028a423&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;d51db234d0236cd0dbfcf13adc33387f10920011537815d188eff012872e30be&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;d0ce85ec31053478c67e4f53ca2ef9b7b1f0fda74621c9c7c8c1612772ca778c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;504d7714419931f80b734e212a9431ec98887c56ade8966c4d7cae58b28d49ca&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;16bb3968e1112b63fef8a4e7bda9d021dfef6fd1955fdfa677545535a14a65b4&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;659ede632d3bfc28d143c144fdba34d08b21c4f97ce6c9dc1fcd4d2bf5cc25e3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;463c9704fb009cd13e0ef50fa7d5035aa5f35b4841fe75ecab5c4a276601f837&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;3fc35cab1272f769af309cb46375e21680f13d629181c7646cb0cf2c9b2e72e7&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;517b43bf057877727387316d8538dc07599856eb428d43f512e89964a5dfb331&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;e54ce9939679c691dc5719e309a8d541183b6672269fd61013109ef0d8509b1e&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Technical Analysis of a Novel IMEEX Framework</title><link>https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/</link><pubDate>Thu, 10 Oct 2024 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/</guid><description>
&lt;p&gt;The IMEEX framework is a newly discovered, custom-built malware designed to
target Windows systems. Delivered as a 64-bit DLL, it offers attackers
extensive control over compromised machines. This framework is notable for its
robust capabilities, featuring a wide array of functionalities, including
execution of additional modules, file manipulation, process management,
registry modification, and remote command execution. It also performs system
reconnaissance by gathering critical system information, such as hostname,
operating system version, volume serial number, and system language, and relays
this data to its command-and-control (C2) server.&lt;/p&gt;
&lt;p&gt;Our analysis indicates that the IMEEX framework has primarily targeted
&lt;a href="#imeex-targeting-djibouti"&gt;Djibouti&lt;/a&gt;, with a less capable variant appearing
targeting &lt;a href="#imeex-targeting-afghanistan"&gt;Afghanistan&lt;/a&gt;. At this time, we are
unaware of the wider distribution of the campaign but assume it&amp;rsquo;s not limited
to these two countries. While the infection vector remains unclear, the
behavior of the malware suggests it is part of a carefully orchestrated attack
campaign aimed at maintaining persistence and avoiding detection through
advanced techniques such as masquerading as legitimate processes, mutex
creation, and encrypted communications with the C2 server.&lt;/p&gt;
&lt;p&gt;Interestingly, there are signs of infrastructure reuse with ShadowPad, a
modular malware platform privately sold and employed by multiple Chinese threat
actor groups. This overlap might indicate a strategic rotation from ShadowPad
to the IMEEX framework, although it does not conclusively link the campaign to
any specific group. Instead, it suggests a possible evolution in tactics, where
the attackers leverage IMEEX as an alternative toolset.&lt;/p&gt;
&lt;p&gt;This blog aims to provide a detailed technical analysis of the IMEEX
framework&amp;rsquo;s capabilities. We will explore its core functionalities, ranging
from system reconnaissance and data collection to dynamic module loading and
execution of additional modules.&lt;/p&gt;
&lt;h2&gt;Key Findings about IMEEX&lt;span class="hx:absolute hx:-mt-20" id="key-findings-about-imeex"&gt;&lt;/span&gt;
&lt;a href="#key-findings-about-imeex" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Geographic Distribution: The IMEEX framework samples were submitted to
VirusTotal from Djibouti and Afghanistan, indicating potential targeting or
deployment in those regions. This geographic pattern suggests a focused
campaign, with some variations between samples in terms of functionality.&lt;/li&gt;
&lt;li&gt;Masquerading as Legitimate Processes: IMEEX framework expects to be loaded by
svchost.exe or rundll32.exe, ensuring it blends with legitimate Windows
processes to avoid detection.&lt;/li&gt;
&lt;li&gt;Configuration Decryption: IMEEX framework extracts its configuration from the
last 108 bytes of its executable. The decrypted data includes C2 domains and
a port number, usually 443.&lt;/li&gt;
&lt;li&gt;Command and Control (C2) Communication: The malware communicates with its C2
server via custom structured packets, including checksums and identifiers for
data integrity. It uses port 443, blending in with legitimate HTTPS traffic,
over TLS.&lt;/li&gt;
&lt;li&gt;Advanced File, Process, and Registry Operations: IMEEX framework supports a
wide range of operations, including file manipulation, process control,
remote code execution, and extensive Windows Registry modifications.&lt;/li&gt;
&lt;li&gt;Modular Execution: The framework employs a modular approach, loading and
executing components on-demand. The malware uses the Windows Registry to keep
track of its modules, ensuring each is executed only once and monitoring
their state throughout execution.&lt;/li&gt;
&lt;li&gt;Persistence and Evasion: By modifying registry keys and leveraging scheduled
deletions for locked files, the malware maintains persistence while evading
detection.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Technical Overview&lt;span class="hx:absolute hx:-mt-20" id="technical-overview"&gt;&lt;/span&gt;
&lt;a href="#technical-overview" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The malware checks the context in which its DLL is loaded by verifying if it is
running under legitimate system processes like svchost.exe or rundll32.exe.
Based on the process name, it either proceeds to establish network connections,
or terminates to avoid detection. This behavior suggests an attempt to and
blend in with trusted Windows processes, enhancing stealth and persistence.&lt;/p&gt;
&lt;p&gt;The malware creates a mutex named either Global4B59AFCC or Global3796878E. This
mutex ensures that only one instance of the malware runs on the infected system
at any given time, preventing conflicts and redundant resource usage.&lt;/p&gt;
&lt;h3&gt;Sample Analysis&lt;span class="hx:absolute hx:-mt-20" id="sample-analysis"&gt;&lt;/span&gt;
&lt;a href="#sample-analysis" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;We analyzed four samples, and most of their functions remained consistent
across versions. The samples analyzed include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3e25798da0232d9039e570fb34d4bdccf7f082fa38b486a097d954f5f3debab3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;7a3113d3212605a33924ad16ab360b7d48cc94de0de1c1cf9dc44695d4a01648&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;7d02ad54e4e56f34e59414f9b02397901fc61bb1158a31ab2586fe62564aeb93&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;94b8a01ad4b53d202984afb6781d7f88cb5cd329349791516e985ea88e08ad66&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Four files were submitted to VirusTotal from Djibouti. During the
investigation, we found a similar framework variant from Afghanistan with fewer
capabilities, which we will also cover.&lt;/p&gt;
&lt;p&gt;The files from Djibouti are nearly identical, with only minor differences in
mutex names and C2 domains. The consistent codebase and minimal changes suggest
they are variants deployed within the same campaign. The primary differences
lie in the names of the mutexes and the process names the framework uses for
masquerading.&lt;/p&gt;
&lt;h3&gt;Configuration Extraction and Decryption&lt;span class="hx:absolute hx:-mt-20" id="configuration-extraction-and-decryption"&gt;&lt;/span&gt;
&lt;a href="#configuration-extraction-and-decryption" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The framework extracts its configuration data from the last 108 bytes of its
own executable file. This data is encrypted using a custom XOR-based algorithm.
The decryption process involves:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Read the encrypted data from the executable&amp;rsquo;s end.&lt;/li&gt;
&lt;li&gt;Perform a reverse iteration through the data, XOR-ing each value with the
value that precedes it&lt;/li&gt;
&lt;li&gt;Validate the decrypted data with the magic value &lt;code&gt;0xFEFCFDFB&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The first 2 bytes following the magic are the value of the port – 443.&lt;/li&gt;
&lt;li&gt;The rest of the bytes are XOR-ed with the value &lt;code&gt;0xE6&lt;/code&gt; giving the decrypted
domains,separated by a semicolon.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Appendix B includes Python configuration extractors for all variants observed.&lt;/p&gt;
&lt;p&gt;We extracted the following C2 domains and addresses from the samples we
analyzed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;yurtumawat.wwwhost[.]us&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;erkinhorshiden.onedumb[.]com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;45.141.139[.]146&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Network Initialization and Operation&lt;span class="hx:absolute hx:-mt-20" id="network-initialization-and-operation"&gt;&lt;/span&gt;
&lt;a href="#network-initialization-and-operation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;IMEEX initializes network communication by establishing a socket connection to
decrypted C2 server addresses. It attempts to connect over TCP port 443, likely
evading network monitoring by blending with legitimate encrypted web traffic.
Notably, the framework uses dynamic DNS providers for its command-and-control
servers.&lt;/p&gt;
&lt;p&gt;The framework employs checksums and specific identifiers in its communication
protocol to ensure data integrity and accurate command execution. The use of
structured headers and data packets allows for a modular approach to command
handling and response generation.&lt;/p&gt;
&lt;p&gt;Key Features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Checksums: Calculated to verify that data has not been tampered with during
transmission. Each packet includes a checksum calculated over the header.&lt;/li&gt;
&lt;li&gt;IDs and Sub-IDs: Numeric identifiers specify the exact command or response
type, ensuring proper interpretation of exchanged information between the
malware and the C2 server. The response packets also use a unique ID to
identify the operation that is sending the response.&lt;/li&gt;
&lt;li&gt;Error Handling: The malware sends error responses when operations fail,
allowing the C2 server to handle exceptions or retry commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;C2 Packet Data Structure&lt;span class="hx:absolute hx:-mt-20" id="c2-packet-data-structure"&gt;&lt;/span&gt;
&lt;a href="#c2-packet-data-structure" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Communication between the malware and the C2 server uses specific packet
formats for both requests and responses. Each packet contains a header and a
data section, adhering to predefined structures to facilitate various
operations.&lt;/p&gt;
&lt;p&gt;Structure of packets received from the C2:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Packet&lt;/th&gt;
&lt;th&gt;Offset&lt;/th&gt;
&lt;th&gt;(Bytes)&lt;/th&gt;
&lt;th&gt;Size (Bytes)&lt;/th&gt;
&lt;th&gt;Field Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Header&lt;/td&gt;
&lt;td&gt;0-3&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Unspecified Operation-specific data.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4-7&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Class ID&lt;/td&gt;
&lt;td&gt;Specifies the main operation to perform.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;8-11&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Command ID&lt;/td&gt;
&lt;td&gt;Additional identifier for sub-commands.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;12-15&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Checksum&lt;/td&gt;
&lt;td&gt;Validates the integrity of the header data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;16+&lt;/td&gt;
&lt;td&gt;Parameters&lt;/td&gt;
&lt;td&gt;Contains parameters or data required for executing the command.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Structure of packets that are sent to the C2:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Packet&lt;/th&gt;
&lt;th&gt;Offset (Bytes)&lt;/th&gt;
&lt;th&gt;Size (Bytes)&lt;/th&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Header&lt;/td&gt;
&lt;td&gt;0-3&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Packet size&lt;/td&gt;
&lt;td&gt;Specifies the size of the packet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4-7&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;ID&lt;/td&gt;
&lt;td&gt;Identifies the operation or response.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;8-11&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Checksum&lt;/td&gt;
&lt;td&gt;Validates the integrity of the header data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;12+&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Command parameters&lt;/td&gt;
&lt;td&gt;Contains the actual data or payload.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The ID field encodes a combination of the Class ID, Command ID, and an optional
flag in big-endian format, serving as a unique identifier to correlate specific
responses from the framework with the operations that generated them.&lt;/p&gt;
&lt;h3&gt;Reconnaissance&lt;span class="hx:absolute hx:-mt-20" id="reconnaissance"&gt;&lt;/span&gt;
&lt;a href="#reconnaissance" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Before initiating its main thread, which manages communication with the C2
server and executes various operations, the framework performs initial
reconnaissance on the infected endpoint. It collects system information and
sends this data to the C2 server. The information gathered includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;System ANSI Code Page Identifier&lt;/strong&gt;: Obtained using the
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getacp"target="_blank" rel="noopener"&gt;GetACP&lt;/a&gt;
function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;File System and Volume Information&lt;/strong&gt;: Retrieves details about the file
system and volume of the current working directory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt;: The network name assigned to the host machine.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Operating System Version&lt;/strong&gt;: The version number and build information of the
host&amp;rsquo;s operating system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IP Address&lt;/strong&gt;: The current IP address assigned to the host.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This collected information is sent to the C2 server with an identifier value of
&lt;code&gt;0x88&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Supported Commands by the Framework&lt;span class="hx:absolute hx:-mt-20" id="supported-commands-by-the-framework"&gt;&lt;/span&gt;
&lt;a href="#supported-commands-by-the-framework" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The IMEEX framework supports a wide array of commands, enabling comprehensive
control over infected systems. These commands are categorized into several
classes, such as file management, process manipulation, remote command
execution, and registry operations. The RAT&amp;rsquo;s functionality includes reading,
writing, deleting files and directories, enumerating and terminating processes,
and remotely executing programs and commands on the compromised machine. It
uses a structured communication protocol with custom packet headers to manage
command exchanges with its C2 server.&lt;/p&gt;
&lt;p&gt;In addition to basic system control, the framework supports Windows Registry
operations, allowing it to write, update, and delete registry values—critical
for maintaining persistence and managing module execution. These capabilities
make it highly versatile for remote administration and execution of malicious
tasks.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command Class&lt;/th&gt;
&lt;th&gt;Class ID&lt;/th&gt;
&lt;th&gt;Command ID&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Extra Parameters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File Operation&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Get Drive Info&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;File/Directory Discovery&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Write File&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Read File&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;No Operation/Reserved&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Delete folder and content&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Process Operation&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Get Processes Info&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Terminate Process&lt;/td&gt;
&lt;td&gt;PID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remote Process Execution&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;Create a Process and run a command&lt;/td&gt;
&lt;td&gt;Command to execute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command Execution Using Windows Pipe&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Set a pipe connected to cmd&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Terminate Pipe&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Write to pipe&lt;/td&gt;
&lt;td&gt;Content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Modules Operation&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Write File&lt;/td&gt;
&lt;td&gt;Registry key and then content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Delete file from Registry entry path&lt;/td&gt;
&lt;td&gt;Registry sub-key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Create Registry Values&lt;/td&gt;
&lt;td&gt;key/val&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Get Data from the Registry&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;Checksum&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Driver Operation&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Check if new drivers were added&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;File Operations&lt;span class="hx:absolute hx:-mt-20" id="file-operations"&gt;&lt;/span&gt;
&lt;a href="#file-operations" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h5&gt;Get Driver Information&lt;span class="hx:absolute hx:-mt-20" id="get-driver-information"&gt;&lt;/span&gt;
&lt;a href="#get-driver-information" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The framework iterates over all available drivers (A-Z) and determines their
type using the
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdrivetypew"target="_blank" rel="noopener"&gt;GetDriveTypeW&lt;/a&gt;
API (e.g., fixed, removable, CD-ROM). For CD-ROM drivers, it retrieves the
display name. For fixed drivers, it calls
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationw"target="_blank" rel="noopener"&gt;GetVolumeInformationW&lt;/a&gt;,
which returns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Volume Name&lt;/strong&gt;: The label of the specified volume.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volume Serial Number&lt;/strong&gt;: A unique number assigned by the OS during disk
formatting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maximum Component Length&lt;/strong&gt;: Maximum file name component length.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;File System Flags&lt;/strong&gt;: Features supported by the file system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;File System Name&lt;/strong&gt;: The name of the file system (e.g., NTFS, FAT32).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All this information is sent to the C2 server in a header with the ID 0x31. As
mentioned above, the ID that is sent back consists of the class ID (3) and the
command ID (1).&lt;/p&gt;
&lt;h5&gt;Directory Discovery&lt;span class="hx:absolute hx:-mt-20" id="directory-discovery"&gt;&lt;/span&gt;
&lt;a href="#directory-discovery" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The framework receives a path from the C2 and performs a directory scan to
enumerate the files and folders within it. It then gathers detailed information
for each file, including size, last modified timestamp, attributes, and
filename. This collected data is subsequently transmitted back to the C2 in
separate packets, with each packet bearing an ID of 0x324. The presence of a 4
in this ID signifies that the operation has not yet completed sending the data.
In its final stage, when the last packet with ID 0x32 is sent, it indicates the
successful completion of the data transmission.&lt;/p&gt;
&lt;h5&gt;Write File&lt;span class="hx:absolute hx:-mt-20" id="write-file"&gt;&lt;/span&gt;
&lt;a href="#write-file" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The framework receives a file path where the file will be created, and after
the file is created, it sends an acknowledgment (ACK) packet to the C2. The
packet ID in this case is 0x33, and it returns the allocated file size.&lt;/p&gt;
&lt;p&gt;Next, the framework waits to receive the file content from the C2. Each
packet&amp;rsquo;s content is verified using a checksum, with the expected checksum value
stored in the 8th byte of the packet. For each chunk written, the framework
sends an ACK, indicating the status of the
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile"target="_blank" rel="noopener"&gt;WriteFile&lt;/a&gt;
API call.&lt;/p&gt;
&lt;h5&gt;Read File&lt;span class="hx:absolute hx:-mt-20" id="read-file"&gt;&lt;/span&gt;
&lt;a href="#read-file" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The framework receives a path to a file to be read. It will open the file, read
its contents, and send it back to the C2 in chunks of 0x8000 bytes. The packet
IDs associated with this operation are 0x34.&lt;/p&gt;
&lt;h5&gt;Delete File/Folder&lt;span class="hx:absolute hx:-mt-20" id="delete-filefolder"&gt;&lt;/span&gt;
&lt;a href="#delete-filefolder" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The framework receives a path to a folder, which it will recursively delete. It
first sets the folder&amp;rsquo;s file attributes to FILE_ATTRIBUTE_NORMAL, then iterates
over all files in the provided path, deleting each one. The operation sends
back an ACK with the success code and the ID 0x36.&lt;/p&gt;
&lt;h4&gt;Process Operations&lt;span class="hx:absolute hx:-mt-20" id="process-operations"&gt;&lt;/span&gt;
&lt;a href="#process-operations" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h5&gt;Get Processes Info&lt;span class="hx:absolute hx:-mt-20" id="get-processes-info"&gt;&lt;/span&gt;
&lt;a href="#get-processes-info" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This command enumerates all processes and collects information such as the
process ID (PID), parent process ID, executable name, and whether it is a
system process. The information is sent to the C2 in a packet with the ID
0x514. Once all the information is sent, a final ACK packet is sent with the ID
0x55.&lt;/p&gt;
&lt;h5&gt;Terminate Process&lt;span class="hx:absolute hx:-mt-20" id="terminate-process"&gt;&lt;/span&gt;
&lt;a href="#terminate-process" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;The command receives a PID to terminate. The framework elevates its privileges
by setting the SeDebugPrivilege, which allows it to debug other processes and
access their memory. It then terminates the specified process using the
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess"target="_blank" rel="noopener"&gt;TerminateProcess&lt;/a&gt;
API call. The operation sends back an ACK with the success code and the ID
0x52.&lt;/p&gt;
&lt;h5&gt;Remote Code Execution&lt;span class="hx:absolute hx:-mt-20" id="remote-code-execution"&gt;&lt;/span&gt;
&lt;a href="#remote-code-execution" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This operation receives from the C2 a path to an executable on the victim
machine. It creates a new hidden process using the specified executable. An ACK
packet with the status code of this operation and the ID 11 is sent.&lt;/p&gt;
&lt;h4&gt;Command Execution&lt;span class="hx:absolute hx:-mt-20" id="command-execution"&gt;&lt;/span&gt;
&lt;a href="#command-execution" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h5&gt;Set a pipe connected to the cmd&lt;span class="hx:absolute hx:-mt-20" id="set-a-pipe-connected-to-the-cmd"&gt;&lt;/span&gt;
&lt;a href="#set-a-pipe-connected-to-the-cmd" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This operation creates a
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/ipc/pipes"target="_blank" rel="noopener"&gt;pipe&lt;/a&gt; connected to
cmd.exe with a hidden window. The input is redirected to cmd.exe, and the
output is sent to the C2. Essentially, this connects the socket to the pipe and
gives the attackers the ability to execute commands. The header for this packet
has an ID of 0x101: the 0x10 represents the class ID 16 and 1 is the command
ID.&lt;/p&gt;
&lt;h5&gt;Terminate pipe&lt;span class="hx:absolute hx:-mt-20" id="terminate-pipe"&gt;&lt;/span&gt;
&lt;a href="#terminate-pipe" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;When this command is received, the framework terminates the pipe process using
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess"target="_blank" rel="noopener"&gt;TerminateProcess&lt;/a&gt;
and sends an ACK.&lt;/p&gt;
&lt;h5&gt;Write to pipe&lt;span class="hx:absolute hx:-mt-20" id="write-to-pipe"&gt;&lt;/span&gt;
&lt;a href="#write-to-pipe" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This command sends input to the pipe connected to cmd.exe. The input data is
first processed by retrieving the system&amp;rsquo;s OEM code page identifier using
GetOEMCP and converting it using
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte"target="_blank" rel="noopener"&gt;WideCharToMultiByte&lt;/a&gt;.
The framework then writes the command line into the pipe, waits for 100
milliseconds, and captures the output. If any output is detected, it sends the
content to the C2 in packets with an ID of 0x104. Once all the output is
captured, a final packet with ID 0x1044 is sent.&lt;/p&gt;
&lt;h4&gt;Modules Operation&lt;span class="hx:absolute hx:-mt-20" id="modules-operation"&gt;&lt;/span&gt;
&lt;a href="#modules-operation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;The framework has extended capabilities for remote code execution of modules,
and it uses information that is stored in the Windows Registry to track and
execute them.&lt;/p&gt;
&lt;h5&gt;Write a file and update the Windows Registry&lt;span class="hx:absolute hx:-mt-20" id="write-a-file-and-update-the-windows-registry"&gt;&lt;/span&gt;
&lt;a href="#write-a-file-and-update-the-windows-registry" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This function receives data from the C2, verifies its integrity, writes it to a
temporary file, and adds the file path to the system registry. The framework
uses a Windows Registry path that is intended to store the location of the
temporary executable.&lt;/p&gt;
&lt;p&gt;If the registry path already contains data, the file creation process is
skipped, assuming the executable is already present. Otherwise, a new file is
created, the name is set by the
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamew"target="_blank" rel="noopener"&gt;GetTempFileNameW&lt;/a&gt;
API function, and the extension is set to.dat. Next, the framework receives
from the C2 the content of the file and writes into the file.&lt;/p&gt;
&lt;p&gt;After successfully receiving and writing all the data, the function sets the
file&amp;rsquo;s attributes to System (&lt;code&gt;FILE_ATTRIBUTE_SYSTEM&lt;/code&gt;) and copies timestamps
from kernel32.dll to the file, helping it blend in with legitimate system
files. Then, the path to the file is saved in the following Windows Registry
path: &lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;num&amp;gt;N&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;If any errors occur (such as checksum failures, write errors, or network
issues), the function deletes the temporary file and sends an error response to
the C2 server.&lt;/p&gt;
&lt;h5&gt;Delete File Specified in Registry&lt;span class="hx:absolute hx:-mt-20" id="delete-file-specified-in-registry"&gt;&lt;/span&gt;
&lt;a href="#delete-file-specified-in-registry" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This function deletes a file based on the registry key it receives from the C2.
The operation accesses the registry at the path:
&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;provided_key&amp;gt;&lt;/code&gt;, and the subkey
&amp;ldquo;N&amp;rdquo; that stores paths to files on the machine. It attempts to delete the file
and, if unsuccessful, moves it to a temporary location and schedules it for
deletion upon the next system restart using
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw"target="_blank" rel="noopener"&gt;MoveFileExW&lt;/a&gt;.&lt;/p&gt;
&lt;h5&gt;Write Values to Registry Keys&lt;span class="hx:absolute hx:-mt-20" id="write-values-to-registry-keys"&gt;&lt;/span&gt;
&lt;a href="#write-values-to-registry-keys" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This operation writes specific values to the Windows Registry under the keys
&amp;ldquo;A&amp;rdquo; and &amp;ldquo;P&amp;rdquo; within the path &lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;ID&amp;gt;&lt;/code&gt;.
The function receives the data in a structure named RegistryWriteData. The
value of &lt;ID&gt; is received from the attacker.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Byte Offset&lt;/th&gt;
&lt;th&gt;Field Name&lt;/th&gt;
&lt;th&gt;Size (Bytes)&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;RegistryPathID&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Identifier for the registry path (a number)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Reserved&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Reserved for future use or alignment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;ValueAData&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Data for registry key &amp;ldquo;A&amp;rdquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;ValuePSize&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Size of ValuePData&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;ValuePData&lt;/td&gt;
&lt;td&gt;ValuePSize&lt;/td&gt;
&lt;td&gt;Data for registry key &amp;ldquo;P&amp;rdquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The function begins by determining whether it should write to the registry key
&amp;ldquo;A&amp;rdquo;. It checks if ValueAData is equal to -1; if so, it interprets this as a
signal to skip writing to key &amp;ldquo;A&amp;rdquo;. Otherwise, it attempts to write the provided
data to registry key &amp;ldquo;A&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Similarly, for the registry key &amp;ldquo;P&amp;rdquo;, the function examines ValuePSize. If this
value is zero, it determines that writing to key &amp;ldquo;P&amp;rdquo; is unnecessary. Otherwise,
it attempts to write the data pointed to by ValuePData to the registry key &amp;ldquo;P&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The function constructs the full registry path as
&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;ID&amp;gt;&lt;/code&gt;, where it writes the data to
keys &amp;ldquo;A&amp;rdquo; and &amp;ldquo;P&amp;rdquo; after encoding the input string using a reversible XOR-based
encoding algorithm.&lt;/p&gt;
&lt;p&gt;The function allocates memory and encodes the data for the registry keys using
a simple, reversible encoding process. Each character of the input string is
modified using an XOR operation, starting with an initial seed value of 0xE4.
The modified characters are then split into high and low 4-bit nibbles and
mapped to ASCII characters starting from &amp;lsquo;A&amp;rsquo;. The encoded data is stored in an
output array, ensuring it does not exceed twice the length of the original
input.&lt;/p&gt;
&lt;p&gt;Essentially, it the operation creates to WIndows Registry paths:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;ID&amp;gt;\A&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\P&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;ID&amp;gt;\N&lt;/code&gt; (Was created by the
write function described above)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The framework uses these subkeys to track executed modules, with &lt;ID&gt; serving
as the module identifier. It&amp;rsquo;s unclear whether these values follow a specific
scheme or are chosen arbitrarily.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Subkey &amp;ldquo;A&amp;rdquo; stores execution type information.&lt;/li&gt;
&lt;li&gt;Subkey &amp;ldquo;P&amp;rdquo; holds configuration or additional parameters.&lt;/li&gt;
&lt;li&gt;Subkey &amp;ldquo;N&amp;rdquo; contains the module&amp;rsquo;s file path.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Execute a Module&lt;span class="hx:absolute hx:-mt-20" id="execute-a-module"&gt;&lt;/span&gt;
&lt;a href="#execute-a-module" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This operation handles dynamic retrieval and loading of modules, specifically
DLL files, from the Windows Registry based on instructions from the C2.&lt;/p&gt;
&lt;p&gt;Below is a table that represents the structure of the packet that is being sent
to the Module Load operation:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Byte Offset&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Field Name&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;12 bytes&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;The header of the packet as described in the previous section&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;moduleID&lt;/td&gt;
&lt;td&gt;Represents the identifier in the WIndows Registry for the module to be executed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;executionType&lt;/td&gt;
&lt;td&gt;Specifies the type of execution (2, 3, or other) to determine how the module should be run.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;numberOfParameters&lt;/td&gt;
&lt;td&gt;Number of parameters passed to the module function.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;params[]&lt;/td&gt;
&lt;td&gt;Array of parameters passed to the module function as part of the execution call.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The function first checks if the module, identified by &lt;code&gt;moduleID&lt;/code&gt;, is already
loaded in memory by traversing a linked list of loaded modules. If found, it
returns a pointer to the module&amp;rsquo;s information, avoiding redundant loading.&lt;/p&gt;
&lt;p&gt;If the module is not loaded, the function retrieves the module&amp;rsquo;s name from the
Windows Registry (subkey &amp;ldquo;N&amp;rdquo;), allocates memory, and attempts to load the
module using &lt;code&gt;LoadLibraryW&lt;/code&gt;. It then locates the &amp;ldquo;Execute&amp;rdquo; function with
&lt;code&gt;GetProcAddress&lt;/code&gt;. Once found, the module is added to the linked list for future
use. If the function fails at any point, it cleans up by freeing memory and
unloading the module, returning an error code.&lt;/p&gt;
&lt;p&gt;Once loaded, the function checks the &lt;code&gt;executionType&lt;/code&gt; received from the C2, with
three possible options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Load configuration from the Registry and execute (executionType = 2)&lt;/strong&gt;: The
function checks if the module is in memory. If not, it loads it again and
retrieves additional data from
&lt;code&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\IMEEX\&amp;lt;moduleID&amp;gt;\P&lt;/code&gt;, invoking the &amp;ldquo;Execute&amp;rdquo;
function. If successful, the module&amp;rsquo;s execution state is updated to prevent
re-execution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Load and execute with predefined values (executionType = 3)&lt;/strong&gt;: Similar to
the previous case, it finds the module in memory, executes it with hardcoded
arguments, and updates its state post-execution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Execute with parameters from the C2 (executionType is not 2 or 3)&lt;/strong&gt;: The
function directly passes the C2 parameters to the module. If successful, the
result is sent back to the C2; otherwise, an error is reported.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This module execution process allows the framework to dynamically load and
execute modules from the Windows Registry, ensuring that each module is
executed only once while tracking their execution states. Results from
successful executions are sent back to the C2, with error handling and cleanup
in case of failure.&lt;/p&gt;
&lt;p&gt;The framework also has a dedicated process that iterates over the values stored
in the subkey &amp;ldquo;A&amp;rdquo; (stores the execution type of the module), and if the value
is not 0 – it would run the module if it&amp;rsquo;s not already running.&lt;/p&gt;
&lt;h5&gt;Retrieve IMEEX framework Windows Registry Values&lt;span class="hx:absolute hx:-mt-20" id="retrieve-imeex-framework-windows-registry-values"&gt;&lt;/span&gt;
&lt;a href="#retrieve-imeex-framework-windows-registry-values" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;This operation retrieves numeric subkeys from the malware&amp;rsquo;s registry location:
&lt;code&gt;Software\Microsoft\IMEEX&lt;/code&gt;. It gathers the subkeys and their values,
transmitting the data over a network socket. If data is cached in memory, it is
included in the packet. The stored data, encrypted with XOR, is decoded before
transmission and sent to the C2 in chunks.&lt;/p&gt;
&lt;p&gt;If no subkeys are found or an error occurs, an empty packet or error code is
returned. The function processes all subkeys until transmission is complete,
ensuring proper packet structure and network integrity. A final checksum is
computed and sent with the remaining data.&lt;/p&gt;
&lt;h4&gt;Driver Operation&lt;span class="hx:absolute hx:-mt-20" id="driver-operation"&gt;&lt;/span&gt;
&lt;a href="#driver-operation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;This operation is executed if the command received by the framework does not
match any of the specified operations. The framework calls
&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlogicaldrives"target="_blank" rel="noopener"&gt;GetLogicalDrives&lt;/a&gt;
to retrieve a bitmask representing available disk drives and compares it to a
stored global variable containing previously retrieved information. If a
mismatch is found, the framework calls the Get Driver Information operation,
described under File Operations.&lt;/p&gt;
&lt;h2&gt;Attribution Indicators and The Geopolitics of The Region&lt;span class="hx:absolute hx:-mt-20" id="attribution-indicators-and-the-geopolitics-of-the-region"&gt;&lt;/span&gt;
&lt;a href="#attribution-indicators-and-the-geopolitics-of-the-region" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Network Pivoting&lt;span class="hx:absolute hx:-mt-20" id="network-pivoting"&gt;&lt;/span&gt;
&lt;a href="#network-pivoting" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Our investigation into the IMEEX framework was assisted by Tom Hegel from
SentinelOne, who provided valuable information about C2 domains. The analysis
reveals a potential connection between several domains and IP addresses,
suggesting shared infrastructure with ShadowPad – a privately sold modular
malware platform used by at least four clusters of Chinese espionage activity,
allowing threat actors to access advanced anti-detection and persistence
techniques without developing their own backdoors.&lt;/p&gt;
&lt;p&gt;The domain &lt;code&gt;bbsnews.sytes.net&lt;/code&gt; is resolved to the IP address 103.151.229.184
from Hong Kong, which is a generally unused address. Further investigation
shows that this IP has been linked to several other domains:
&lt;code&gt;cha.ylsyzxxwgov.cn&lt;/code&gt;, &lt;code&gt;ftp-server.serveftp.com&lt;/code&gt;, and
&lt;code&gt;it-technology.serveblog.net&lt;/code&gt;, indicating a potential relationship between
these entities. Notably, prior to using 103.151.229.184,
&lt;code&gt;ftp-server.serveftp.com&lt;/code&gt; was hosted on the similar IP address 103.151.229.52,
which hosted domains linked to ShadowPad activity in 2022, as reported by
&lt;a href="https://web.archive.org/web/20220814120943/https://www.ptsecurity.com/upload/corporate/ww-en/pt-esc/winnti-2020-eng.pdf"target="_blank" rel="noopener"&gt;PT Security&lt;/a&gt;
(such as point.linkpc.net). Another IP address, 38.60.200.224, also hosted
multiple shadowpad-linked domains, including connecter.publicvm.com, previously
identified as part of the Shadowpad malware
&lt;a href="https://www.sentinelone.com/labs/shadowpad-a-masterpiece-of-privately-sold-malware-in-chinese-espionage/"target="_blank" rel="noopener"&gt;by SentinelOne&lt;/a&gt;
in 2021, and which was also hosted on 103.151.229.52.&lt;/p&gt;
&lt;p&gt;The investigation has uncovered a potential connection between several domains
and IP addresses, suggesting shared infrastructure with the use of ShadowPad by
multiple Chinese APT groups. However, this does not strongly indicate specific
attribution to a particular group, but rather suggests a possible rotation from
ShadowPad to another toolset.&lt;/p&gt;
&lt;h3&gt;IMEEX targeting Djibouti&lt;span class="hx:absolute hx:-mt-20" id="imeex-targeting-djibouti"&gt;&lt;/span&gt;
&lt;a href="#imeex-targeting-djibouti" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/images/fig2.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Djibouti holds significant geopolitical importance due to its strategic
location at the crossroads of the Red Sea and the Gulf of Aden, controlling
access to one of the world&amp;rsquo;s busiest maritime routes. This small East African
nation
&lt;a href="https://moderndiplomacy.eu/2024/02/21/strategic-significance-of-djibouti-a-geopolitical-playground-for-global-powers/#:~:text=The%20militaries%20of%20France%2C%20Saudi%20Arabia%2C%20and%20Japan%20rub%20shoulders%20here%20with%20the%20US.%20What%E2%80%99s%20even%20more%20surprising%20is%20that%20so%20does%20China.%20India%20and%20Russia%20are%20keen%20to%20join%20in%20too.%20Despite%20its%20chaotic%20neighbors%2C%20Djibouti%20offers%20an%20excellent%20position%20for%20foreign%20militaries%20to%20project%20their%20power."target="_blank" rel="noopener"&gt;hosts military bases&lt;/a&gt;
from several global powers, including the U.S., France, and Japan, making it a
critical hub for military and trade operations. Notably, Djibouti is home to
&lt;a href="https://thediplomat.com/2021/01/china-consolidates-its-commercial-foothold-in-djibouti/#:~:text=In%20recent%20years%2C%20China%2DDjibouti%20relations%20have%20developed%20and%20achieved%20fruitful%20results%20in%20various%20fields.%20In%202017%2C%20China%20established%20a%20naval%20base%20in%20Djibouti%2C%20representing%20the%20first%20time%20it%20has%20sought%20a%20permanent%20military%20presence%20beyond%20its%20borders."target="_blank" rel="noopener"&gt;China&amp;rsquo;s first overseas military base&lt;/a&gt;,
established in 2017, which has become a central part of China&amp;rsquo;s Belt and Road
Initiative (BRI). This base helps China secure its economic and military
interests in the region, particularly along vital shipping lanes connecting the
Indian Ocean to Europe via the Suez Canal.
&lt;a href="https://www.cfr.org/blog/chinas-strategy-djibouti-mixing-commercial-and-military-interests"target="_blank" rel="noopener"&gt;China&amp;rsquo;s involvement&lt;/a&gt;
in Djibouti extends beyond military interests, with heavy investments in
infrastructure like railways, ports, and a free trade zone. These efforts
support
&lt;a href="https://djiboutiembassykuwait.net/en/p/index/14#:~:text=Djibouti%202035%27s%20core%20economic%20objective,than%20200%2C000%20jobs%20by%202035."target="_blank" rel="noopener"&gt;Djibouti&amp;rsquo;s &amp;ldquo;Vision 2035&amp;rdquo; plan&lt;/a&gt;,
aimed at becoming a commercial and logistics hub for Africa. However, these
investments have also deepened Djibouti&amp;rsquo;s reliance on Chinese loans, raising
concerns about potential debt dependency.&lt;/p&gt;
&lt;p&gt;Given Djibouti&amp;rsquo;s strategic significance to China&amp;rsquo;s global trade routes and
military expansion, it is plausible that China could leverage cyber operations,
including potential malware attacks, to safeguard its interests. The country&amp;rsquo;s
proximity to important shipping lanes and the presence of multiple global
military powers, including the U.S. and France, make it a critical point for
espionage and intelligence gathering. Cyberattacks offer a low-risk,
high-reward method for China to monitor adversaries, gather intelligence, and
secure its foothold in Djibouti without escalating to open conflict. In this
competitive geopolitical environment, malware could be used to disrupt
operations that threaten China&amp;rsquo;s regional strategic goals, aligning with
Beijing&amp;rsquo;s broader approach of blending economic influence and military
presence.&lt;/p&gt;
&lt;h3&gt;IMEEX targeting Afghanistan&lt;span class="hx:absolute hx:-mt-20" id="imeex-targeting-afghanistan"&gt;&lt;/span&gt;
&lt;a href="#imeex-targeting-afghanistan" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/images/fig3.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;China&amp;rsquo;s interests in Afghanistan are multifaceted, revolving around security,
economic influence, and geopolitical strategy. After the U.S. withdrawal and
the Taliban&amp;rsquo;s return to power, China has sought to
&lt;a href="https://www.rferl.org/a/afghanistan-taliban-china-goals/31420549.html"target="_blank" rel="noopener"&gt;fill the power vacuum&lt;/a&gt;
by fostering stronger relations with Afghanistan. Key interests include
securing China&amp;rsquo;s western border, ensuring stability in the region, and
safeguarding investments under the Belt and Road Initiative (BRI). The
expansion of the China-Pakistan Economic Corridor (CPEC) into Afghanistan is
crucial for enhancing regional connectivity and trade, linking China to Central
Asia and beyond.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://global.chinadaily.com.cn/a/202305/07/WS6457244aa310b6054fad1807.html"target="_blank" rel="noopener"&gt;Security is a significant concern for China&lt;/a&gt;,
especially with regard to extremist groups that could threaten its investments
or spill over into its own territories, like Xinjiang. Afghanistan&amp;rsquo;s
instability presents risks to China&amp;rsquo;s projects and personnel in the region,
which may motivate the use of malware as a tool to monitor potential threats,
gather intelligence, and protect its strategic interests. Cyber operations
could also help China track the activities of other foreign powers or influence
local dynamics without direct intervention.&lt;/p&gt;
&lt;p&gt;Given the volatile situation and China&amp;rsquo;s deep economic and strategic interests,
the deployment of malware could serve as a low-cost, effective means of
advancing China&amp;rsquo;s goals in Afghanistan.&lt;/p&gt;
&lt;h3&gt;Analysis of Variants or Related Samples&lt;span class="hx:absolute hx:-mt-20" id="analysis-of-variants-or-related-samples"&gt;&lt;/span&gt;
&lt;a href="#analysis-of-variants-or-related-samples" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;sha256: &lt;code&gt;6fcd206752cd87c26909ed3751b94eb8ef14cd1567d3757cae7fa0b89d3f77c7&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The malware sample submitted to VirusTotal from Afghanistan features a
compilation timestamp of April 4, 2016. This date is more recent than other
known variants, which were compiled between 2014 and 2015. Despite the newer
timestamp, the Afghan variant has fewer capabilities compared to its
predecessors, indicating a reduction in functionality despite the newer
compilation date.&lt;/p&gt;
&lt;p&gt;Upon execution, the malware creates a mutex with the value:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Global42EC381F&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Codebase and Functional Differences&lt;span class="hx:absolute hx:-mt-20" id="codebase-and-functional-differences"&gt;&lt;/span&gt;
&lt;a href="#codebase-and-functional-differences" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;While the core codebase of the Afghan variant remains largely consistent with
other versions, there are notable differences in its operational capabilities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Execution of additional modules&lt;/strong&gt;: This variant does not support the
execution of modules. Specifically, it lacks the functionality to store
arguments and information required for the remote execution of modules within
the Registry.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Process Management&lt;/strong&gt;: The malware cannot create or terminate processes.
This absence of process manipulation capabilities reduces its ability to
execute additional payloads or disrupt system processes, potentially limiting
its impact compared to more feature-rich variants.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Configuration Storage&lt;span class="hx:absolute hx:-mt-20" id="configuration-storage"&gt;&lt;/span&gt;
&lt;a href="#configuration-storage" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The method of storing configuration data in this variant differs from other
versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Storage Location&lt;/strong&gt;: Unlike other variants, this version retrieves
configuration values from the read-only (.rdata) section of the binary
instead of loading configuration data from the end of the executable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data Obfuscation&lt;/strong&gt;: Each byte of the configuration data is XOR-encoded with
the value 0xEC. This simple obfuscation technique serves to conceal the
configuration information from straightforward analysis, requiring reverse
engineers to decode the data to understand the malware&amp;rsquo;s settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The C2 used by this variant is: &lt;code&gt;bbsnews.sytes[.]net&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A script to decode the configuration of this variant is provided in the
appendix below.&lt;/p&gt;
&lt;h2&gt;Overall Assessment&lt;span class="hx:absolute hx:-mt-20" id="overall-assessment"&gt;&lt;/span&gt;
&lt;a href="#overall-assessment" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Considering the reduced functionality in execution of modules and process
operations, along with the modified method of configuration storage, this
variant appears to be a more &lt;strong&gt;compact iteration of the IMEEX Framework&lt;/strong&gt;. The
simplifications suggest a focus on specific operational objectives, potentially
prioritizing stealth and resource efficiency over comprehensive system control.
This makes the Afghan sample a potentially less versatile but more discreet
threat compared to its more feature-rich counterparts.&lt;/p&gt;
&lt;p&gt;Summary of supported commands by the Afghan variant:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Commands Id&lt;/th&gt;
&lt;th&gt;Sub-Command Id&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Extra Parameters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File Operation&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Get Driver Info&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;File/Directory&lt;/td&gt;
&lt;td&gt;Discovery File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Write File&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Read File&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;6 (No number 5)&lt;/td&gt;
&lt;td&gt;Delete folder and content&lt;/td&gt;
&lt;td&gt;File path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remote Process Execution&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;Create a Process and run a command&lt;/td&gt;
&lt;td&gt;Command to execute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command Execution Using Windows Pipe&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Set a pipe connected to cmd&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Terminate Pipe&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Write to pipe&lt;/td&gt;
&lt;td&gt;Content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Driver Operation&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Check if new drivers were added&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A comparative analysis of the command processing functionalities in the
Djibouti and Afghan variants reveals similarities between the two versions.
Notably, the absence of the execution of modules is observed in the Afghan
variant, underscoring its functional deficiencies compared to the more
comprehensive Djibouti implementation.&lt;/p&gt;
&lt;p&gt;The function that processes the command in the Djibouti variant.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/images/fig4.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The function that processes the command in the Afghan variant.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2024/10/technical-analysis-of-a-novel-imeex-framework/images/fig5.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;Technical Appendix: Indicators of Compromise&lt;span class="hx:absolute hx:-mt-20" id="technical-appendix-indicators-of-compromise"&gt;&lt;/span&gt;
&lt;a href="#technical-appendix-indicators-of-compromise" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Appendix A: File Names and Process Indicators&lt;span class="hx:absolute hx:-mt-20" id="appendix-a-file-names-and-process-indicators"&gt;&lt;/span&gt;
&lt;a href="#appendix-a-file-names-and-process-indicators" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Attempts to run as svchost.exe, imaadp.dll or rundll32.exe&lt;/p&gt;
&lt;h4&gt;Network Infrastructure&lt;span class="hx:absolute hx:-mt-20" id="network-infrastructure"&gt;&lt;/span&gt;
&lt;a href="#network-infrastructure" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h5&gt;Domains:&lt;span class="hx:absolute hx:-mt-20" id="domains"&gt;&lt;/span&gt;
&lt;a href="#domains" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;yurtumawat.wwwhost[.]us&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;erkinhorshiden.onedumb[.]com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;45.141.139[.]146&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bbsnews.sytes[.]net&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Port&lt;span class="hx:absolute hx:-mt-20" id="port"&gt;&lt;/span&gt;
&lt;a href="#port" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;443/TCP&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Mutexes&lt;span class="hx:absolute hx:-mt-20" id="mutexes"&gt;&lt;/span&gt;
&lt;a href="#mutexes" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Global\4B59AFCC&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Global\42EC381F&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Global\3796878E&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Registry Keys&lt;span class="hx:absolute hx:-mt-20" id="registry-keys"&gt;&lt;/span&gt;
&lt;a href="#registry-keys" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Software\Microsoft\IMEEX\&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Subkeys: N, A, P&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Appendix B: String Decryption Script&lt;span class="hx:absolute hx:-mt-20" id="appendix-b-string-decryption-script"&gt;&lt;/span&gt;
&lt;a href="#appendix-b-string-decryption-script" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Djibouti variant:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;struct&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;typing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Union&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Tuple&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;sys&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decrypt_and_store_in_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Union&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Tuple&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; Decrypts data from an executable, validates the decrypted data, and extracts a port and string.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; Args:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; file_path (str): Path to the executable file containing the encrypted data.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; Returns:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; Union[Tuple[int, str], None]: Returns a tuple containing the port and decrypted string,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; or None if decryption fails.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Open the file for reading&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;rb&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Move the file pointer to 108 bytes before the end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;seek&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;108&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SEEK_END&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Read 108 bytes of data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;108&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;108&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="c1"&gt;# Failed to read the correct amount of data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Decrypt the data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;data_buffer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;107&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# XOR the first byte with 0xF0 as part of the decryption&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="mh"&gt;0xF0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Pack the first 4 bytes to check for validation&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;decrypted_header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unpack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&amp;lt;I&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;))[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;decrypted_header&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mh"&gt;0xFEFCFDFB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="c1"&gt;# Validation failed&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Extract the port from the next 4 bytes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unpack_from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&amp;lt;I&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Decrypted string starts at offset 8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;decrypted_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data_buffer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;:])&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;x00&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;latin1&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Decrypt the string using XOR with 0xE6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;decrypted_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;chr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;ord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="mh"&gt;0xE6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;decrypted_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decrypted_string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="ne"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Error: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; Main function to handle command-line arguments and execute the decryption.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Usage: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &amp;lt;path_to_executable&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Check if file exists&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;File &amp;#39;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#39; does not exist.&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decrypt_and_store_in_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decrypted_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Port: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Decrypted String: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;decrypted_string&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Decryption failed or validation failed.&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vm"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;__main__&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Afghan Variant&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decode_hex_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hex_string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Convert the hex string to a byte array&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;byte_array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;bytearray&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fromhex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hex_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# XOR each byte with 0xEC and decode to string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;decoded_chars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;chr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;byte&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="mh"&gt;0xEC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;byte&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;byte_array&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Join the characters to form the decoded string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;decoded_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decoded_chars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;decoded_string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# The encoded hex value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;encoded_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;8E8E9F82899B9FC29F9598899FC28289&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Decode the value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;decoded_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decode_hex_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;encoded_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Print the decoded string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Decoded Value:&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decoded_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Appendix C: YARA&lt;span class="hx:absolute hx:-mt-20" id="appendix-c-yara"&gt;&lt;/span&gt;
&lt;a href="#appendix-c-yara" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;import &amp;#34;pe&amp;#34;
rule IMEEX_Framework
{
meta:
desc = &amp;#34;Detect IMEEX Framework&amp;#34;
author = &amp;#34;Intezer&amp;#34;
last_modified = &amp;#34;11-09-2024&amp;#34;
hash = &amp;#34;3e25798da0232d9039e570fb34d4bdccf7f082fa38b486a097d954f5f3debab3&amp;#34;
strings:
/*
The code that loads the string //Global\4B59AFCC
*/
$s1 = {C7????47006C00C7????6F006200C7????61006C00C7????5C00}
/*
The code that loads the string: &amp;#34;Software\Microsoft\IMEEX&amp;#34;
*/
$s2 = {C7????68 53006F00 C7????6C 66007400 C7????70 77006100 C7????74 72006500 C7????78 5C004D00 C7????7C 69006300 C7458072 006F00C7 45847300 6F00C745 88660074 00C7458C 5C004900 C745904D 004500C7 45944500 5800}
$a1 = &amp;#34;server finished&amp;#34; ascii wide
$a2 = &amp;#34;extended master secret&amp;#34; ascii wide
$a3 = &amp;#34;client finished&amp;#34; ascii wide
$a4 = &amp;#34;SRVRCLNT\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$a5 = &amp;#34;key expansion&amp;#34; ascii wide
$a6 = &amp;#34;SeDebugPrivilege&amp;#34; ascii wide
$a7 = &amp;#34;AES-256-ECB&amp;#34; ascii wide
$a8 = &amp;#34;AES-256-CTR&amp;#34; ascii wide
$a9 = &amp;#34;AES-256-CBC&amp;#34; ascii wide
$a10 = {fb fd fc fe}
condition:
pe.is_dll() and pe.is_64bit() and (all of ($s*) or 80% of ($a*))
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>New Linux Backdoor RedXOR Likely Operated by Chinese Nation-State Actor</title><link>https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/</link><pubDate>Wed, 10 Mar 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/</guid><description>
&lt;ul&gt;
&lt;li&gt;We discovered a new sophisticated backdoor targeting Linux endpoints and
servers&lt;/li&gt;
&lt;li&gt;Based on Tactics, Techniques, and Procedures (TTPs) the backdoor is believed
to be developed by Chinese nation-state actors&lt;/li&gt;
&lt;li&gt;The backdoor masquerades itself as polkit daemon. We named it RedXOR for its
network data encoding scheme based on XOR. The malware was compiled on Red
Hat Enterprise Linux&lt;/li&gt;
&lt;li&gt;We provide recommendations for detecting and responding to this threat below&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Intro&lt;span class="hx:absolute hx:-mt-20" id="intro"&gt;&lt;/span&gt;
&lt;a href="#intro" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;2020
&lt;a href="https://intezer.com/blog/cloud-security/2020-set-record-for-new-linux-malware-families/?utm_campaign=research-blog&amp;amp;utm_content=new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;set a record&lt;/a&gt;
for new Linux malware families. New malware families targeting Linux systems
are being discovered on a regular basis. Backdoors attributed to advanced
threat actors are disclosed less frequently.&lt;/p&gt;
&lt;p&gt;We have discovered an undocumented backdoor targeting Linux systems,
masqueraded as &lt;a href="https://linux.die.net/man/8/polkitd"target="_blank" rel="noopener"&gt;polkit daemon&lt;/a&gt;. We named
it RedXOR for its network data encoding scheme based on XOR.&lt;/p&gt;
&lt;p&gt;Based on victimology, as well as similar components and Tactics, Techniques,
and Procedures (TTPs), we believe RedXOR was developed by high profile Chinese
threat actors. The samples, which have low detection rates in VirusTotal, were
uploaded from Indonesia and Taiwan, countries known to be targeted by Chinese
threat actors. The samples are compiled with a legacy GCC compiler on an old
release of Red Hat Enterprise Linux, hinting that RedXOR is used in targeted
attacks against legacy Linux systems.&lt;/p&gt;
&lt;p&gt;During our investigation we experienced an &amp;ldquo;on and off&amp;rdquo; availability of the
Command and Control (C2) server indicating that the operation is still active.&lt;/p&gt;
&lt;h2&gt;Connections to Chinese Threat Actors&lt;span class="hx:absolute hx:-mt-20" id="connections-to-chinese-threat-actors"&gt;&lt;/span&gt;
&lt;a href="#connections-to-chinese-threat-actors" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;We uncovered key similarities between RedXOR and previously reported malware
associated with Winnti umbrella threat group. These malware are PWNLNX backdoor
and XOR.DDOS and Groundhog, two botnets attributed to Winnti by
&lt;a href="https://www.blackberry.com/us/en/pdfviewer?file=/content/dam/blackberry-com/asset/enterprise/pdf/direct/report-bb-decade-of-the-rats.pdf"target="_blank" rel="noopener"&gt;BlackBerry&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The below samples can be used for reference:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PWNLNX –
&lt;a href="https://analyze.intezer.com/files/6a9f16440b9319f427825bb12d7a0cda89b101cf7b8b15ec7dd620b4d68db514?utm_campaign=research-blog&amp;amp;utm_content=new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;4278ab79c34ea92788259fb43e535aa3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;XOR.DDOS –
&lt;a href="https://analyze.intezer.com/files/dba757c20fbc1d81566ef2877a9bfca9b3ddb84b9f04c0ca5ae668b7f40ea8c3?utm_campaign=research-blog&amp;amp;utm_content=new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;d6a6dee6afa6879b729a0af3cde7ff33&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Similarities between the samples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use of old open-source kernel rootkits: RedXOR uses an open-source LKM
rootkit called &amp;ldquo;&lt;a href="https://github.com/yaoyumeng/adore-ng"target="_blank" rel="noopener"&gt;Adore-ng&lt;/a&gt;&amp;rdquo; to hide
its process. Based on a
&lt;a href="https://content.fireeye.com/apt-41/rpt-apt41/"target="_blank" rel="noopener"&gt;FireEye report&lt;/a&gt; Winnti used
this rootkit in their &amp;ldquo;ADORE.XSE&amp;rdquo; Linux backdoor. Embedding open-source LKM
rootkits is a common Winnti technique. The group has been documented using
&lt;a href="https://medium.com/chronicle-blog/winnti-more-than-just-windows-and-gates-e4f03436031a"target="_blank" rel="noopener"&gt;Azazel&lt;/a&gt;
and
&lt;a href="https://www.blackberry.com/us/en/pdfviewer?file=/content/dam/blackberry-com/asset/enterprise/pdf/direct/report-bb-decade-of-the-rats.pdf#MKTG%2020-0089%20Decade_the_RAT%27s_Report.indd%3A.176091%3A522"target="_blank" rel="noopener"&gt;Suterusu&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;CheckLKM&lt;/code&gt; function name used by RedXOR has also been used in PWNLNX and
XOR.DDOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Provides the operator with a pseudo-terminal: RedXOR uses Python pty shell by
importing the &lt;a href="https://docs.python.org/3/library/pty.html"target="_blank" rel="noopener"&gt;python pty&lt;/a&gt;
library. PWNLNX implements the pty shell function in c.
&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig1.png" title="Figure 1: Python pty shell used in RedXOR" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 1: Python pty shell used in RedXOR&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Encoding network with XOR: The backdoor encodes its network data with a
scheme based on XOR. Encoding network data with XOR has been used in previous
Winnti malware including PWNLNX.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Persistence service name: As part of its persistence methods, RedXOR attempts
to create a service under rc.d. The developer added &amp;ldquo;S99&amp;rdquo; before the name of
the service to lower its priority and make it run last on system initiation.
This technique was used in XOR.DDOS and Groundhog samples where the malware
developer added &amp;ldquo;S90&amp;rdquo; to the service name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Main functions flow: PWNLX and RedXOR have a main function which is in charge
of initialization. In both backdoors, the main function calls another
function which is in charge of the main logic. The main logic function names
are main_process in RedXOR and MainThread in PWLNX. Both main functions
daemonize the process to detach from the terminal and run in the background.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;XML for file listing: RedXOR’s directory function and PWNLNX’s getfiles
function are both in charge of directory listing. Their code flow
implementation is different, however, as both malware send the directory
listing as an XML file to the C2 server. Figure 2 shows the XML structure
used in PWNLNX and RedXOR. The file’s data used in both functions are: path,
name, type, user, permission, size, time.
&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig2.png" title="Figure 2: The XML structure used by PWNLNX’s getfiles function and RedXOR’s directory function" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 2: The XML structure used by PWNLNX’s getfiles function and RedXOR’s directory function&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Legacy Red Hat compilers: RedXOR and PWNLNX were both compiled with a Red Hat
4.4.7 compiler. This compiler is the default GCC compiler on RHEL6.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Chown similarity: Both PWNLNX and RedXOR change the file’s user and group
owner to a large ID. The same technique has been used by the XOR.DDoS malware
as referenced in the analysis by
&lt;a href="https://blog.malwaremustdie.org/2014/09/mmd-0028-2014-fuzzy-reversing-new-china.html"target="_blank" rel="noopener"&gt;MalwareMustDie&lt;/a&gt;.
&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig3.png" title="Figure 3: Similarity between PWNLNX and RedXOR of the UID and GID used with lchown function call" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 3: Similarity between PWNLNX and RedXOR of the UID and GID used with lchown function call&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Overall flow and functionalities: The overall code flow, behavior, and
capabilities of RedXOR are very similar to PWNLNX. Both have file uploading
and downloading functionalities together with a running shell. The network
tunneling functionality in both families is called &amp;ldquo;PortMap&amp;rdquo;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Unstripped ELF binaries: Malware developers will often tamper with a file’s
symbols and/or sections, making it harder for researchers to analyze them.
However, RedXOR and various Winnti malware, including PWNLNX and XOR.DDOS,
are unstripped.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Technical Analysis&lt;span class="hx:absolute hx:-mt-20" id="technical-analysis"&gt;&lt;/span&gt;
&lt;a href="#technical-analysis" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The samples are both unstripped 64-bit ELF files called po1kitd-update-k.
Uploaded to VirusTotal from Taiwan and Indonesia, they are low detected at the
time of this writing.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig4.png" title="Figure 4: 2bd6e2f8c1a97347b1e499e29a1d9b7c in VirusTotal" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 4: 2bd6e2f8c1a97347b1e499e29a1d9b7c in VirusTotal&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Malware Installation&lt;span class="hx:absolute hx:-mt-20" id="malware-installation"&gt;&lt;/span&gt;
&lt;a href="#malware-installation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Upon execution RedXOR forks off a child process allowing the parent process to
exit. The purpose is to detach the process from the shell. The new child
determines if it has been executed as the root user or as another user on the
system. It does this to create a hidden folder, called &lt;code&gt;.po1kitd.thumb&lt;/code&gt;, inside
the user’s home folder which is used to store files related to the malware. The
malware creates a hidden file called &lt;code&gt;.po1kitd-2a4D53&lt;/code&gt; inside the folder. The
file is locked to the current running process, seen in Figure 5, essentially
creating a mutex. If another instance of the malware is executed, it also tries
to obtain the lock but ultimately fails. Upon this failure the process exits.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig5.png" title="Figure 5: The malware creates a mutex file locking it to the process ID" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 5: The malware creates a mutex file locking it to the process ID&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After the malware creates the mutex, it installs itself on the infected
machine. As shown in Figure 6, the malware looks up its current path and moves
the binary to the created folder. It hides the file by naming it
&lt;code&gt;.po1kitd-update-k&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig6.png" title="Figure 6: Malware moves the binary to the hidden folder po1kitd.thumb created earlier. It first tries to use the rename function provided by libc. If this fails, it executes an mv shell command via the system function" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 6: Malware moves the binary to the hidden folder po1kitd.thumb created earlier. It first tries to use the rename function provided by libc. If this fails, it executes an mv shell command via the system function&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After installing the binary to the hidden folder, the malware sets up
persistence via &lt;code&gt;init&lt;/code&gt; scripts. The following files are created after executing
the malware on boot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/usr/syno/etc/rc.d/S99po1kitd-update.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d/po1kitd-update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/rc2.d/S99po1kitd-update&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The malware checks if the rootkit is active by creating a file and removing it.
Then, the malware compares the &amp;ldquo;saved set-user-ID&amp;rdquo; of the process to the user
ID. If they don’t match, the rootkit is enabled. If they match, it looks to see
if the user ID is &amp;ldquo;10&amp;rdquo;. If this is the case, the rootkit is enabled. This logic
is shown in Figure 7.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig7.png" title="Figure 7: Logic used by RedXOR to check if the rootkit is enabled" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 7: Logic used by RedXOR to check if the rootkit is enabled&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;CheckLKM&lt;/code&gt; logic is almost identical to the &lt;code&gt;adore_init&lt;/code&gt; function in the
&amp;ldquo;adore-ng&amp;rdquo; rootkit. Afore-ng is a Chinese open-source LKM (Loadable Kernel
Module) rootkit. This technique allows the malware to stay under the radar by
hiding its processes. The code for the init function is shown in Figure 8.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig8.png" title="Figure 8: Client authentication code for the adore-ng rootkit" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 8: Client authentication code for the adore-ng rootkit&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Configuration&lt;span class="hx:absolute hx:-mt-20" id="configuration"&gt;&lt;/span&gt;
&lt;a href="#configuration" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware stores the configuration encrypted within the binary. In addition
to the Command and control (C2) IP address and port it can also be configured
to use a proxy. The configuration includes a password, as can be seen in Figure
9. This password is used by the malware to authenticate to the C2 server.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig9.png" title="Figure 9: Configuration options for the malware" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 9: Configuration options for the malware&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The configuration values are decrypted by the &lt;code&gt;doXor&lt;/code&gt; function. A pseudo-code
representation of the function is shown in Figure 10. The decryption logic is a
simple XOR against a byte key. The byte key is incremented by a constant for
each item in the buffer. The only configuration value that is not encrypted is
the server port. The port value is used to derive the key and the adder. The
key is derived from bit shifting the port value eight steps to the right. The
constant uses the port value.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig10.png" title="Figure 10: Decryption logic of the configuration data. The data is XORed against a key byte that is incremented by a constant for each entry in the buffer" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 10: Decryption logic of the configuration data. The data is XORed against a key byte that is incremented by a constant for each entry in the buffer&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Communication with the C2&lt;span class="hx:absolute hx:-mt-20" id="communication-with-the-c2"&gt;&lt;/span&gt;
&lt;a href="#communication-with-the-c2" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware communicates with the C2 server over a TCP socket. The traffic is
made to look like HTTP traffic. Figure 11 shows a pseudo-code representation of
the function used by the malware to prepare data that is to be sent to the C2
server. First, it fills the buffer with null bytes. The request body is XORed
against a key. The malware uses the buffer length as the key. This value is
also passed into the function as the &amp;ldquo;total_length&amp;rdquo; argument.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig11.png" title="Figure 11: Function for preparing data to be sent to the C2 server" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 11: Function for preparing data to be sent to the C2 server&lt;/figcaption&gt;
&lt;/figure&gt;
The same logic is used to decrypt the response body from the C2 server. From
the response, the malware extracts &amp;ldquo;JSESSIONID&amp;rdquo;, &amp;ldquo;Content-Length&amp;rdquo;,
&amp;ldquo;Total-Length&amp;rdquo; and the response body. The data is added to a struct with the
following layout:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;0x0 JSESSIONID as int
0x8 Content-Length as long
0x10 Total-Length as long
0x18 Response body&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The content length is the length of the response body but also used as the key.
The total length value is used as a constant which is added to the key in each
iteration. The JSESSIONID value holds the command ID for the job the C2 wants
the malware to perform.&lt;/p&gt;
&lt;h3&gt;Commands&lt;span class="hx:absolute hx:-mt-20" id="commands"&gt;&lt;/span&gt;
&lt;a href="#commands" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The C2 server tells the malware to execute different commands via a command
code that is returned in the &amp;ldquo;JSESSIONID&amp;rdquo; cookie. The codes are encoded as
decimal integers. A full list of commands supported by the analyzed malware
sample are shown in the table below. They can be grouped into command types.
Commands in the 2000 range provide &amp;ldquo;filesystem&amp;rdquo; interaction, 3000 handle
&amp;ldquo;shell&amp;rdquo; commands, and 4000 handle network tunneling.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Table 1: List of commands supported by the malware&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0000&lt;/td&gt;
&lt;td&gt;System information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0008&lt;/td&gt;
&lt;td&gt;Update&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0009&lt;/td&gt;
&lt;td&gt;Uninstall&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt;Ping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1010&lt;/td&gt;
&lt;td&gt;Install LKM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2049&lt;/td&gt;
&lt;td&gt;List folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2054&lt;/td&gt;
&lt;td&gt;Upload file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2055&lt;/td&gt;
&lt;td&gt;Open file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2056&lt;/td&gt;
&lt;td&gt;Execute with system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2058&lt;/td&gt;
&lt;td&gt;Remove file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2060&lt;/td&gt;
&lt;td&gt;Remove folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2061&lt;/td&gt;
&lt;td&gt;Rename&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2062&lt;/td&gt;
&lt;td&gt;Create new folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2066&lt;/td&gt;
&lt;td&gt;Write content to file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3000&lt;/td&gt;
&lt;td&gt;Start shell&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3058&lt;/td&gt;
&lt;td&gt;Exec shell command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3999&lt;/td&gt;
&lt;td&gt;Close tty&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4001&lt;/td&gt;
&lt;td&gt;Portmap (Proxy)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4002&lt;/td&gt;
&lt;td&gt;Kill portmap&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;System Information&lt;span class="hx:absolute hx:-mt-20" id="system-information"&gt;&lt;/span&gt;
&lt;a href="#system-information" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;When the malware first contacts the C2 server it sends a password encoded in
the request body. The C2 server responds with the command code 0 to collect
system information. The data collected about the system by the malware is
listed in the table below. The data is serialized into a URL query-like string,
encrypted and then sent as the request body.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Table 2: Data collected by the malware and sent back to the C2 server&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;URL key&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Comment&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;hostip&lt;/td&gt;
&lt;td&gt;IP&lt;/td&gt;
&lt;td&gt;Hardcoded to 127.0.0.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;softtype&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Hardcoded to &amp;ldquo;Linux&amp;rdquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pscaddr&lt;/td&gt;
&lt;td&gt;MAC address&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostname&lt;/td&gt;
&lt;td&gt;Machine name&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hosttar&lt;/td&gt;
&lt;td&gt;Username&lt;/td&gt;
&lt;td&gt;Possibly &amp;ldquo;host target&amp;rdquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostos&lt;/td&gt;
&lt;td&gt;Distribution&lt;/td&gt;
&lt;td&gt;Extracted from /etc/issue or /etc/redhat-release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostcpu&lt;/td&gt;
&lt;td&gt;Clock speed&lt;/td&gt;
&lt;td&gt;/proc/cpuinfo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostmem&lt;/td&gt;
&lt;td&gt;Amount of memory&lt;/td&gt;
&lt;td&gt;/proc/meminfo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostpack&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Hardcoded to &amp;ldquo;Linux&amp;rdquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lkmtag&lt;/td&gt;
&lt;td&gt;Is rootkit enabled&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;kernel&lt;/td&gt;
&lt;td&gt;Kernel version&lt;/td&gt;
&lt;td&gt;Extracted from uname&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Figure 12 shows the communication between RedXOR and the C2. The malware sends
the password &lt;code&gt;pd=admin&lt;/code&gt; and C2 responds with &lt;code&gt;all right&lt;/code&gt; (&lt;code&gt;JSESSIONID=0000&lt;/code&gt;).
Next, the malware sends the system information and the C2 replies with the ping
command (&lt;code&gt;JSESSIONID=1000&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig12.png" title="Figure 12: RedXOR communication with C2" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 12: RedXOR communication with C2&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Update Functionality&lt;span class="hx:absolute hx:-mt-20" id="update-functionality"&gt;&lt;/span&gt;
&lt;a href="#update-functionality" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware can be updated by the threat actor. This is performed by sending
command code 8 to the malware. When the malware receives this code the
following actions are taken:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The malware opens the mutex file for writing.&lt;/li&gt;
&lt;li&gt;It sends a request with the command code 8 and an empty request body to the
C2 server.&lt;/li&gt;
&lt;li&gt;The response body from the server is written to the mutex file. The response
body is not encrypted.&lt;/li&gt;
&lt;li&gt;The lock is released on the mutex file.&lt;/li&gt;
&lt;li&gt;The malware executes &amp;ldquo;chmod&amp;rdquo; to set the execution flag on the file via the
libc system function.&lt;/li&gt;
&lt;li&gt;The malware sleeps and tries to obtain the lock on the file again when it
wakes up. If it fails, it assumes the update was successful, closes the
connection to the C2 server and exits.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Shell Functionality&lt;span class="hx:absolute hx:-mt-20" id="shell-functionality"&gt;&lt;/span&gt;
&lt;a href="#shell-functionality" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware has the ability to provide its operator with a &lt;code&gt;tty&lt;/code&gt; shell. If a
shell is requested via the command code 3000, the malware creates a new thread
executing &lt;code&gt;/bin/sh&lt;/code&gt;. In the new spawned shell, the malware executes
&lt;code&gt;python -c &amp;quot;import pty;pty.spawn('/bin/sh')&amp;quot;&lt;/code&gt; to get a pseudo-terminal (pty)
interface. Any shell commands sent to the malware with the command code of 3058
are executed in the pty and the response is returned to the operator.&lt;/p&gt;
&lt;h3&gt;Network Tunneling&lt;span class="hx:absolute hx:-mt-20" id="network-tunneling"&gt;&lt;/span&gt;
&lt;a href="#network-tunneling" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Network tunneling is enabled by sending the command code 4001 to the malware.
As part of the request, a &amp;ldquo;configuration&amp;rdquo; is sent as part of the response body.
The configuration consists of three items separated by a &amp;ldquo;#&amp;rdquo; character. The
items are: a port to bind to, the IP to connect to, and a port to connect to.
The malware uses a modified version of the open-source project Rinetd for the
tunneling logic. Rinetd is designed to use a configuration file stored on the
machine. To get around this, the malware author has modified the function that
parses the configuration in order to directly take the required values normally
found in the configuration file.&lt;/p&gt;
&lt;h2&gt;Wrap Up&lt;span class="hx:absolute hx:-mt-20" id="wrap-up"&gt;&lt;/span&gt;
&lt;a href="#wrap-up" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Linux systems are under constant attack given that Linux runs on most of the
public cloud workload. A
&lt;a href="https://secure2.sophos.com/en-us/content/state-of-cloud-security.aspx"target="_blank" rel="noopener"&gt;survey conducted by Sophos&lt;/a&gt;
found that 70% of organizations using the public cloud to host data or
workloads experienced a security incident in the past year. Along with botnets
and cryptominers, the Linux threat landscape is also home to sophisticated
threats like RedXOR developed by
&lt;a href="https://intezer.com/blog/malware-analysis/looking-back-on-the-last-decade-of-linux-apt-attacks/?utm_campaign=research-blog&amp;amp;utm_content=new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;nation-state actors&lt;/a&gt;.
RedXOR samples are indexed in Intezer Analyze so that you can detect any
suspicious file that shares code with this malware.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/03/new-linux-backdoor-redxor-likely-operated-by-chinese-nation-state-actor/images/fig14.png" title="Figure 13: RedXOR sample in Intezer Analyze" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Figure 13: RedXOR sample in Intezer Analyze&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;IoCs&lt;span class="hx:absolute hx:-mt-20" id="iocs"&gt;&lt;/span&gt;
&lt;a href="#iocs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Files&lt;span class="hx:absolute hx:-mt-20" id="files"&gt;&lt;/span&gt;
&lt;a href="#files" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;0a76c55fa88d4c134012a5136c09fb938b4be88a382f88bf2804043253b0559f
0423258b94e8a9af58ad63ea493818618de2d8c60cf75ec7980edcaa34dcc919&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Network&lt;span class="hx:absolute hx:-mt-20" id="network"&gt;&lt;/span&gt;
&lt;a href="#network" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;update[.]cloudjscdn[.]com
158[.]247[.]208[.]230
34[.]92[.]228[].216&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Process name&lt;span class="hx:absolute hx:-mt-20" id="process-name"&gt;&lt;/span&gt;
&lt;a href="#process-name" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;po1kitd-update-k&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;File and directories created on disk&lt;span class="hx:absolute hx:-mt-20" id="file-and-directories-created-on-disk"&gt;&lt;/span&gt;
&lt;a href="#file-and-directories-created-on-disk" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;.po1kitd-update-k
.po1kitd.thumb
.po1kitd-2a4D53
.po1kitd-k3i86dfv
.po1kitd-nrkSh7d6
.po1kitd-2sAq14
.2sAq14
.2a4D53
po1kitd.ko
po1kitd-update.desktop
S99po1kitd-update.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>The Evolution of APT15's Codebase 2020</title><link>https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/</link><pubDate>Thu, 21 May 2020 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/</guid><description>
&lt;p&gt;The Ke3chang group, also known as APT15, is an alleged Chinese
government-backed cluster of teams known to target various high-profile
entities spanning multiple continents. Examples include attacks on
&lt;a href="https://www.fireeye.com/content/dam/fireeye-www/global/en/current-threats/pdfs/wp-operation-ke3chang.pdf"target="_blank" rel="noopener"&gt;European ministries&lt;/a&gt;,
&lt;a href="https://unit42.paloaltonetworks.com/operation-ke3chang-resurfaces-with-new-tidepool-malware/"target="_blank" rel="noopener"&gt;Indian embassies&lt;/a&gt;,
and
&lt;a href="https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2018/march/apt15-is-alive-and-strong-an-analysis-of-royalcli-and-royaldns/"target="_blank" rel="noopener"&gt;British military contractors&lt;/a&gt;.
The group&amp;rsquo;s activities have been traced back to 2010 and it is known to boast a
large number of custom tools, most often tailored to their specific target.&lt;/p&gt;
&lt;p&gt;In mid May, we identified three recently uploaded samples from VirusTotal that
share code with older APT15 implants. We named this new family of samples,
&amp;ldquo;Ketrum&amp;rdquo;, due to the merger of features in the documented backdoor families
&amp;ldquo;Ketrican&amp;rdquo; and &amp;ldquo;Okrum&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;We believe the operation was conducted very recently. Below we present a
technical analysis of these samples and explain the evolution of APT15&amp;rsquo;s
codebase over the last year.&lt;/p&gt;
&lt;h2&gt;Overview&lt;span class="hx:absolute hx:-mt-20" id="overview"&gt;&lt;/span&gt;
&lt;a href="#overview" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The three samples we discovered seem to be a mix of the Ketrican and Okrum
backdoors documented by researchers at
&lt;a href="https://www.welivesecurity.com/wp-content/uploads/2019/07/ESET_Okrum_and_Ketrican.pdf"target="_blank" rel="noopener"&gt;ESET&lt;/a&gt;
in 2019. Features have been merged from these two malware families to create a
different RAT class for the group. We&amp;rsquo;ve decided to call this umbrella of
malware &amp;ldquo;Ketrum.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The new samples we found continue the Ke3chang group&amp;rsquo;s strategy of using a
basic backdoor to gain control over the victim&amp;rsquo;s device, so that an operator
can then connect to it and run commands manually to conduct further operations.&lt;/p&gt;
&lt;p&gt;Before beginning our technical analysis, we were able to connect these binaries
to Ke3chang using &lt;a href="https://analyze.intezer.com/?utm_campaign=research-blog&amp;amp;utm_content=the-evolution-of-apt15s-codebase-2020&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;Intezer Analyze&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href="https://analyze.intezer.com/?utm_campaign=research-blog&amp;amp;utm_content=the-evolution-of-apt15s-codebase-2020&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com#/files/271384a078f2a2f58e14d7703febae8a28c6e2d7ddb00a3c8d3eead4ea87a0c0"target="_blank" rel="noopener"&gt;Genetic Analysis&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;All three samples contacted the same C2 server and appear to have been used in
two different time periods, judging by the PE timestamps and VirusTotal upload
date:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;SHA256s&lt;/th&gt;
&lt;th style="text-align: left"&gt;Name&lt;/th&gt;
&lt;th style="text-align: left"&gt;VirusTotal Date&lt;/th&gt;
&lt;th style="text-align: left"&gt;PE Timestamp&lt;/th&gt;
&lt;th style="text-align: left"&gt;C2&lt;/th&gt;
&lt;th style="text-align: left"&gt;Family&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;a142625512e5372a1728595be19dbee23eea50524b4827cb64ed5aaeaaa0270b&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;RavAudio64.exe&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;2019-12-03&lt;/td&gt;
&lt;td style="text-align: left"&gt;7 Jan 2010&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;menu.thehuguardian[.]com&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Ketrum1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;271384a078f2a2f58e14d7703febae8a28c6e2d7ddb00a3c8d3eead4ea87a0c0&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;-&lt;/td&gt;
&lt;td style="text-align: left"&gt;2020-05-16&lt;/td&gt;
&lt;td style="text-align: left"&gt;13 May 2020&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;www.thehuguardian[.]com&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Ketrum2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;aacaf0d4729dd6fda2e452be763d209f92d107ecf24d8a341947c545de9b7311&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;-&lt;/td&gt;
&lt;td style="text-align: left"&gt;2020-05-17&lt;/td&gt;
&lt;td style="text-align: left"&gt;13 May 2020&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;www.thehuguardian[.]com&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Ketrum2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The C2 was registered towards the end of 2019, which makes us believe the first
PE timestamp was tampered with, and the latter two timestamps are at least
close to the real compilation date.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also important to note the C2 was registered in China and ceased operating
in mid May.&lt;/p&gt;
&lt;h2&gt;The Best of Two Worlds&lt;span class="hx:absolute hx:-mt-20" id="the-best-of-two-worlds"&gt;&lt;/span&gt;
&lt;a href="#the-best-of-two-worlds" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;We documented several interesting differences between the backdoors:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;&lt;/th&gt;
&lt;th style="text-align: left"&gt;Ketrican&lt;/th&gt;
&lt;th style="text-align: left"&gt;Okrum&lt;/th&gt;
&lt;th style="text-align: left"&gt;Ketrum1&lt;/th&gt;
&lt;th style="text-align: left"&gt;Ketrum2&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Identify installed proxy servers and use them for HTTP requests&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Special folder retrieval using registry key &lt;code&gt;[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;The response from the server is an HTTP page with backdoor commands and arguments included in the HTML fields&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Backdoor commands are determined by a hashing value received from C2&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Communication with the C&amp;amp;C server is hidden in the Cookie and Set-Cookie headers of HTTP requests&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Impersonate a logged in user&amp;rsquo;s security context&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Create a copy of &lt;code&gt;cmd.exe&lt;/code&gt; in their working directory and use it to interpret backdoor commands&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Usual Ke3chang backdoor functionalities - download, upload, execute files/shell commands and configure sleep time&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Screenshot-grabbing functionality&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;td style="text-align: left"&gt;✅&lt;/td&gt;
&lt;td style="text-align: left"&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Ketrum 1&lt;span class="hx:absolute hx:-mt-20" id="ketrum-1"&gt;&lt;/span&gt;
&lt;a href="#ketrum-1" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The Ketrum 1 sample was uploaded to VirusTotal in December 2019. This version
registers itself as a &amp;ldquo;WMI Provider Host&amp;rdquo; service &lt;em&gt;if&lt;/em&gt; it is able to obtain
&lt;code&gt;SeDebugPrivilege&lt;/code&gt;; otherwise it creates an entry in the startup directory.&lt;/p&gt;
&lt;p&gt;This sample incorporates many features from Okrum as can be seen in the table
above, however, it abandons more advanced Okrum features such as offering a
reflective injection via an export and the use of hashes to receive command
IDs.&lt;/p&gt;
&lt;p&gt;In the past, APT15 has used the
&lt;a href="https://bohops.com/2018/03/17/abusing-exported-functions-and-exposed-dcom-interfaces-for-pass-thru-command-execution-and-lateral-movement/"target="_blank" rel="noopener"&gt;IWebBrowser2&lt;/a&gt;
COM interface to manage its network communications. This time, the Ketrum
developer abandoned this technique and used simple HTTP APIs:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig2.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Interestingly, this sample also incorporates a screenshot-grabbing command.&lt;/p&gt;
&lt;h2&gt;Ketrum 2&lt;span class="hx:absolute hx:-mt-20" id="ketrum-2"&gt;&lt;/span&gt;
&lt;a href="#ketrum-2" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Ketrum 2 seems to have been built for minimalism. As can be seen in Table 2,
many functionalities have been dropped.&lt;/p&gt;
&lt;p&gt;Unlike the Ketrican variant, Ketrum implants no longer try to weaken the
system&amp;rsquo;s security configurations. In previous implants, Powershell was used for
this end. Interestingly, a string still remains in Ketrum 2, which refers to
this deleted feature—perhaps an unintentional left-over from copy-pasting:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig3.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Several other interesting unused file names are included in the binary such as
&lt;code&gt;%sadult.sft&lt;/code&gt; and &lt;code&gt;%sMessage&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The malware first collects basic system information to track the infected
endpoint and then sends it to the C2 server together with a hash of the system
info:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig4.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig5.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;All incoming and outcoming payloads are fed through an RC4 encryption and
base64 encoding. The RC4 encryption uses an unusual key:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig6.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;These are actually constants used in the MD5 and SHA1 algorithms. The Ketrum
developer most likely intended to confuse researchers reversing this function.&lt;/p&gt;
&lt;p&gt;A command is then extracted from the HTML in the response:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig7.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;This backdoor only supports a limited number of commands, which is typical of
Okrum and Ketrican backdoors. Unlike Ketrum 1, Ketrum 2 does not support
screenshot grabbing. This is the list of possible backdoor commands:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Command ID&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;1&lt;/td&gt;
&lt;td style="text-align: left"&gt;Adjust sleep time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;2&lt;/td&gt;
&lt;td style="text-align: left"&gt;Execute a shell command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;3&lt;/td&gt;
&lt;td style="text-align: left"&gt;Upload a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;4&lt;/td&gt;
&lt;td style="text-align: left"&gt;Download a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;5&lt;/td&gt;
&lt;td style="text-align: left"&gt;Execute a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;7 (there is no 6)&lt;/td&gt;
&lt;td style="text-align: left"&gt;Execute a shell command with adjusted sleep time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;8&lt;/td&gt;
&lt;td style="text-align: left"&gt;Adjust execute shell sleep time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;9&lt;/td&gt;
&lt;td style="text-align: left"&gt;Download &amp;ldquo;Notice&amp;rdquo; file to working directory - * it is unclear how this is used&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Code Reuse&lt;span class="hx:absolute hx:-mt-20" id="code-reuse"&gt;&lt;/span&gt;
&lt;a href="#code-reuse" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Both Ketrum samples resemble a similar layout to previous Ke3chang tools, apart
from low level implementation and use of system APIs. Even in the two Ketrum
samples, there are differences between the low-level APIs used to achieve the
same functionality. For example, the file upload feature is implemented using
different APIs throughout the families; mostly using a constant value of
&lt;code&gt;0x20000&lt;/code&gt; when reading files:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig8.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig9.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Ketrum 1 — Ketrum 2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig10.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2020/05/the-evolution-of-apt15s-codebase-2020/images/fig11.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Ketrican 2018 — Okrum&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As reported by FireEye and ESET, it&amp;rsquo;s likely the Ke3chang cluster of malware is
developed by multiple teams and the developers of Ketrican/Okrum belong to a
different team than the developers of Ketrum, albeit related. This could
explain the high-level and flow similarities but also the low-level
differences.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;span class="hx:absolute hx:-mt-20" id="conclusion"&gt;&lt;/span&gt;
&lt;a href="#conclusion" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Ke3chang&amp;rsquo;s numerous tools such as Okrum, Ketrican, TidePool, Mirage, Ketrum,
and others all serve the same purpose, give or take a few techniques or
functionalities tailored for specific targets. We can regard these tools under
the same umbrella of BS2005 malware, distributed as different versions per
operation. However, the distinction created by naming them differently is
useful for tracking the group&amp;rsquo;s operations and different development cycles.&lt;/p&gt;
&lt;p&gt;The Ke3chang&amp;rsquo;s group tools have not deviated much from the same tools reported
in FireEye&amp;rsquo;s first Ke3chang report. The group continues to morph its code and
switch basic functionalities in their various backdoors. This strategy has been
working for the group for years and there is no indication yet that it will
deviate from this modus operandi.&lt;/p&gt;
&lt;p&gt;The information security field has seen many improvements since the group&amp;rsquo;s
inception, however, surprisingly, this is not reflected in the group&amp;rsquo;s
persistence to use the same old TTPs in their tools.&lt;/p&gt;
&lt;h2&gt;IOCs&lt;span class="hx:absolute hx:-mt-20" id="iocs"&gt;&lt;/span&gt;
&lt;a href="#iocs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;271384a078f2a2f58e14d7703febae8a28c6e2d7ddb00a3c8d3eead4ea87a0c0
aacaf0d4729dd6fda2e452be763d209f92d107ecf24d8a341947c545de9b7311
a142625512e5372a1728595be19dbee23eea50524b4827cb64ed5aaeaaa0270b
thehuguardian[.]com
45.56.84[.]25&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>ChinaZ Updates Toolkit by Introducing New, Undetected Malware</title><link>https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/</link><pubDate>Fri, 13 Dec 2019 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/</guid><description>
&lt;h2&gt;Introduction&lt;span class="hx:absolute hx:-mt-20" id="introduction"&gt;&lt;/span&gt;
&lt;a href="#introduction" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;ChinaZ is a Chinese cybercrime group and the author of several
&lt;a href="https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf"target="_blank" rel="noopener"&gt;DDoS malware&lt;/a&gt;.
We have profiled this group in a
&lt;a href="../../../2019/01/chinaz-relations"&gt;previous article&lt;/a&gt; discussing connections
between ChinaZ and other Chinese threat actors.&lt;/p&gt;
&lt;p&gt;Recently, we have discovered new tools being utilized by ChinaZ which have low
detection rates in comparison to the group’s other, more common malware.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig1.jpeg" title="VirusTotal detection rate of one of the discovered samples" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;VirusTotal detection rate of one of the discovered samples&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Some of the components reported in this article have been present in the wild
for at least one year, which implies the active state of this group. We have
based this conclusion upon seeing that the first submission was made to
VirusTotal one year ago:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig2.jpeg" title="VirusTotal analysis of an older, related sample" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;VirusTotal analysis of an older, related sample&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;We believe this may be an attempt by ChinaZ to retool its current toolset,
using new malware with low detection rates to accomplish its operations, since
the group has received more attention from the infosec community in recent
years.&lt;/p&gt;
&lt;p&gt;The new malware samples seem to implement a combination of backdoor and DDoS
bot capabilities to mainly target Linux servers. However, we do not discount
the possibility that Windows variants may exist, since this is a recurrent
pattern we have observed from ChinaZ malware in the past.&lt;/p&gt;
&lt;p&gt;In addition, we were able to retrieve a CNC binary from one of the samples,
which has enabled us to learn more about the network protocol along with some
of the malware’s capabilities.&lt;/p&gt;
&lt;p&gt;In this post, we will present the technical findings of those tools, including
a technical analysis of the files and network protocols.&lt;/p&gt;
&lt;h2&gt;Technical Analysis&lt;span class="hx:absolute hx:-mt-20" id="technical-analysis"&gt;&lt;/span&gt;
&lt;a href="#technical-analysis" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;We’ve received several hits of suspicious files from VirusTotal Intelligence
that communicated with given subdomains under the domain l11l1.com. All of the
identified subdomains were hosting several HttpFileServer panels, web servers
specifically designed for publishing and sharing files. ChinaZ is known to have
used these types of panels in the past.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig3.jpeg" title="HttpFileServer panel of one of the identified servers" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;HttpFileServer panel of one of the identified servers&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Based on VirusTotal passive DNS records, it appears that some Windows malware
samples were also hosted on some of these subdomains:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig4.jpeg" title="VirusTotal Intelligence graph from one of the discovered samples" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;VirusTotal Intelligence graph from one of the discovered samples&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After analyzing some of the Windows binaries we observed that based on code
reuse analysis, the majority of these files seem to be variants of Gh0st or
ServStart, modified Chinese RATs with DDoS capabilities known to be leveraged
by ChinaZ in the past.&lt;/p&gt;
&lt;p&gt;These
&lt;a href="https://analyze.intezer.com/?utm_campaign=research-blog&amp;amp;utm_content=chinaz-updates-toolkit-by-introducing-new-undetected-malware&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com#/files/167c1036befcbd69c83666fd8125209aed5dd89be1068d0bb2ed1974fa6faf27"target="_blank" rel="noopener"&gt;samples&lt;/a&gt;
are also infected by common PE file infectors such as Sality, Parite, and
Virut. ChinaZ has a reputation for deploying infected malware compromised with
these aforementioned file infectors:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig5.jpeg" title="Sality genes from one of the hosted Windows malware samples" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Sality genes from one of the hosted Windows malware samples&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;As seen in the screenshot above, a Gh0st RAT instance deployed by ChinaZ
contains code from Sality. This implies that the subject Gh0st RAT is infected
with Sality. We documented this same pattern in our
&lt;a href="../../../2019/01/chinaz-relations"&gt;previous article&lt;/a&gt; on the subject matter.
This finding may imply that these new malware samples may be operating from the
same servers as other malware under the ChinaZ umbrella.&lt;/p&gt;
&lt;p&gt;Furthermore, when we analyze the newly discovered samples using Genetic Malware
Analysis, we observed that they all share the same ratio of genes across
several malware families related to ChinaZ threat actors.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig6.jpeg" title="Malware Analysis across samples under the ChinaZ umbrella" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Malware Analysis across samples under the ChinaZ umbrella&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After analyzing these connections we observed that they all have been
statically compiled with specific versions of some C++ libraries.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig7.jpeg" title="C&amp;#43;&amp;#43; function similarities between one of the identified samples and a XorDDoS instance" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;C&amp;#43;&amp;#43; function similarities between one of the identified samples and a XorDDoS instance&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;These code similarities are from C++ statically linked library code, which at
first glance are often considered non-attributive. However, based on the high
number of code connections between hundreds of other malware samples related to
ChinaZ, we can interpret them as if the authors of these newly discovered
samples will be using the same compiler version or toolchain to generate their
implants as the one used by a large number of ChinaZ threat actors.&lt;/p&gt;
&lt;p&gt;Among the different identified samples we were able to classify three variants
with different functionalities. Each of these variants were found hosted
together and often sharing the same CNC server. The following section includes
an analysis of each of the new implants we discovered.&lt;/p&gt;
&lt;h3&gt;NewManager&lt;span class="hx:absolute hx:-mt-20" id="newmanager"&gt;&lt;/span&gt;
&lt;a href="#newmanager" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;NewManager is a minimalistic backdoor with arbitrary command execution and file
upload capabilities. The functionality of the backdoor is fairly simple in
logic. NewManager is intended to be executed as root, therefore we can assume
the backdoor is used as a stager when a given target is compromised.&lt;/p&gt;
&lt;p&gt;The backdoor will daemonize itself and set persistence mechanisms. These
persistence mechanisms are primarily based on setting symbolic links to
specific directories in which the presence of those symbolic links implies file
execution on boot time. These mechanisms are predominant among all discovered
samples.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig8.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;We have observed that across the discovered implants the name of the persistent
binary will be set differently. The name used to label NewManager was &amp;rsquo;new
manager&amp;rsquo;, therefore its name:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig9.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The malware will then execute a series of functions that will initialize the
communication with the CNC to start receiving commands.&lt;/p&gt;
&lt;p&gt;The client will collect interface information from &lt;code&gt;/proc/net/dev&lt;/code&gt; and cpu
information from &lt;code&gt;/proc/stat&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig10.jpeg" title="Functions executed prior to CNC command handling" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Functions executed prior to CNC command handling&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;This collected information serves to inform the operator of the network
interface and cpu performance of the compromised machine.&lt;/p&gt;
&lt;p&gt;After this information is collected, the client will craft the beaconing packet
that will be sent periodically to send interface and cpu statistics to the CNC.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig11.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;After analyzing the network protocol we observed that packets are crafted in a
similar manner, although they will differ depending on the payload based on the
command type sent. In order to show the packet&amp;rsquo;s structure, the following
diagram shows the beaconing packet:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig12.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;After this specific information is configured to be sent in intervals to the
CNC, the backdoor will send its own handshake packet.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig13.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;This packet transfers the kernel version to the backdoor operator. Once this
command is sent, the operator will be able to see the compromised machine on
its panel:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig14.jpeg" title="NewManager CNC panel" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;NewManager CNC panel&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;NewManager supports three commands. They are the following:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Specification&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Execute command&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x11000011&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Executes an arbitrary bash command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Create file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x11000002&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates a file on an arbitrary path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x11000003&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads a file on an arbitrary path&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The command ID after packet parsing is fairly straightforward on the backdoor’s
side.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig15.jpeg" title="Command selection implementation in NewManager" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Command selection implementation in NewManager&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;AmpManager&lt;span class="hx:absolute hx:-mt-20" id="ampmanager"&gt;&lt;/span&gt;
&lt;a href="#ampmanager" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The second piece of malware we were able to analyze is AmpManager.&lt;/p&gt;
&lt;p&gt;The reason we named this malware AmpManager is due to its resemblance to
NewManager, however, it appears that the spectrum of supported commands is
wider, implementing more functionalities along with a range of DDoS attack
methodologies.&lt;/p&gt;
&lt;p&gt;Although AmpManager and NewManager share most of their code base and CNC
communication protocol, there are more commands implemented in AmpManager and
some command IDs do not match with the command IDs implemented by NewManager.&lt;/p&gt;
&lt;p&gt;For that reason—although we see a high volume of code reuse—we consider
AmpManager to be a different malware, although it’s clear that NewManager is
AmpManager’s predecessor.&lt;/p&gt;
&lt;p&gt;The name AmpManager chooses to persist in a given system is shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig16.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The following is an overview of the command implementation code:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig17.jpeg" title="Command selection implementation in AmpManager" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Command selection implementation in AmpManager&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;As we can see, the command implementation code is broader than the one
NewManager implements. One of the main differences between AmpManager and
NewManager is AmpManager introduces DDoS attacks among other features.&lt;/p&gt;
&lt;p&gt;There are three different DDoS attack methodologies implemented: SSDP, DNS, and
NTP amplifications.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig18.jpeg" title="SSDP flood UDP header" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;SSDP flood UDP header&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;These floods have some configurations set under the &lt;code&gt;/etc/&lt;/code&gt; directory that will
impact the number of iterations that each flood will run for.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig19.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The following table shows the supported commands implemented in AmpManager:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Specification&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;NTP amplification&lt;/td&gt;
&lt;td&gt;0x11000002&lt;/td&gt;
&lt;td&gt;Executes a NTP amplification flood against a target IP address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Send flood configurations&lt;/td&gt;
&lt;td&gt;0x11000003&lt;/td&gt;
&lt;td&gt;Send the established configurations for each flood to the CNC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SSDP amplification&lt;/td&gt;
&lt;td&gt;0x11000006&lt;/td&gt;
&lt;td&gt;Executes a SSDP amplification flood against a target IP address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All amplifications&lt;/td&gt;
&lt;td&gt;0x11000007&lt;/td&gt;
&lt;td&gt;Executes all implemented amplification floods against a target IP address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DNS amplification&lt;/td&gt;
&lt;td&gt;0x11000008&lt;/td&gt;
&lt;td&gt;Executes a DNS amplification flood against a target IP address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Download HTTP&lt;/td&gt;
&lt;td&gt;0x11000009&lt;/td&gt;
&lt;td&gt;Downloads a given file to a target path via HTTP GET&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Execute command&lt;/td&gt;
&lt;td&gt;0x11000011&lt;/td&gt;
&lt;td&gt;Executes a target bash command in the target machine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update current time&lt;/td&gt;
&lt;td&gt;0x11000012&lt;/td&gt;
&lt;td&gt;Saves the time via gettimeofday&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apply flood configurations&lt;/td&gt;
&lt;td&gt;0x11000023&lt;/td&gt;
&lt;td&gt;Applies flood configurations for each respective DDoS methodology&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;DDoSManager&lt;span class="hx:absolute hx:-mt-20" id="ddosmanager"&gt;&lt;/span&gt;
&lt;a href="#ddosmanager" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;In contrast to the two previously reported malware samples, DDoSManager seems
to be based on a completely different code base and network protocol.&lt;/p&gt;
&lt;p&gt;Although its overall functionality is similar to AmpManager due to the fact
that it’s also a DDoS bot, uses the same persistence mechanisms and overall
preliminary functionality before CNC communication, it’s important to highlight
that DDoSManager uses different DDoS attack methodologies than AmpManager.&lt;/p&gt;
&lt;p&gt;In addition, we noticed that this sample contains known Elknot/BillGates
artifacts, which are some of the most popular malware families leveraged by
ChinaZ.&lt;/p&gt;
&lt;p&gt;The following is a small write up from a
&lt;a href="https://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf"target="_blank" rel="noopener"&gt;report by Novetta&lt;/a&gt;
covering in detail the internals of BillGates malware.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig20.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;If we take a closer look, we can see that these two C++ classes are also used
in DDoSManager:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig21.jpeg" alt="" loading="lazy" /&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig22.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;This reinforces the connection between these malware samples and the developers
of Elknot/BillGates, and with respect to the ChinaZ umbrella, in addition to
the connections explained previously.&lt;/p&gt;
&lt;p&gt;As is the case with the previous samples, DDoSManager commences by setting
persistence mechanisms. The techniques applied are the same ones covered in
NewManager and AmpManager as previously mentioned. DDoSManager will use the
name SingTool to masquerade itself:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig23.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Interface and performance information will be collected as with the previous
samples. However, an additional thread will be launched.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig24.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;This thread is in charge of listening for packets to then decode and parse them
for CNC communication.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig25.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;When we intercepted the network traffic we noticed that the traffic was
encoded:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig26.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;After analysis we observed that packets were encoded and decoded with a simple
sub/xor algorithm. This algorithm is the following:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig27.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;After applying this algorithm to each given packet, we can retrieve their plain
text version. The following is the structure of each packet after decoding:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig28.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Furthermore, the command ID will be extracted from each packet in order to
execute the desired task.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig29.jpeg" title="Command selection implementation in DDoSManager" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Command selection implementation in DDoSManager&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;DDoSManager supports a total of seven commands. These are the following:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Specification&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Read configuration&lt;/td&gt;
&lt;td&gt;0x64&lt;/td&gt;
&lt;td&gt;Configuration is retrieved to the&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CNC Write configuration entry&lt;/td&gt;
&lt;td&gt;0x65&lt;/td&gt;
&lt;td&gt;Entry is added to the configuration file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HeartBeat&lt;/td&gt;
&lt;td&gt;0x66&lt;/td&gt;
&lt;td&gt;Beaconing command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not implemented&lt;/td&gt;
&lt;td&gt;0x67&lt;/td&gt;
&lt;td&gt;Not implemented&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Execute Manager Function&lt;/td&gt;
&lt;td&gt;0x68&lt;/td&gt;
&lt;td&gt;Invoke internal manager function&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stop command&lt;/td&gt;
&lt;td&gt;0x69&lt;/td&gt;
&lt;td&gt;Stop an ongoing command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Execute DDoS attack&lt;/td&gt;
&lt;td&gt;0x6a, 0x6b, 0x6c&lt;/td&gt;
&lt;td&gt;Execute a DDoS flood on a target IP address&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The malware sets a configuration file for the targets it will attempt to DDoS.
This configuration file is located at /tmp/Cfg.9:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig30.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;When a DDoS command is executed, a series of fields will be provided from the
CNC packet in order to execute the command. These fields are clearly shown on a
debug message in the binary:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig31.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;There are three different DDoS amplification algorithms supported. These are
SYN, UDP, and DNS amplifications. Interestingly, in the analyzed samples of
DDoSManager we found that the DNS amplification algorithm was not implemented.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2019/12/chinaz-updates-toolkit-by-introducing-new-undetected-malware/images/fig32.jpeg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;span class="hx:absolute hx:-mt-20" id="conclusion"&gt;&lt;/span&gt;
&lt;a href="#conclusion" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;We have analyzed three new malware variants in which we have named NewManager,
AmpManager, and DDoSManager.&lt;/p&gt;
&lt;p&gt;These three variants were found to be hosted together, sharing the same CNC
address, and are nearly identical in terms of overall preliminary
functionality.&lt;/p&gt;
&lt;p&gt;Some of the servers where the malware is hosted are also serving Windows DDoS
bots based on modified versions of Chinese RATs such as Gh0st and ServStart. It
is well-known that ChinaZ has utilized these malware families in previous
campaigns.&lt;/p&gt;
&lt;p&gt;In addition, we presented evidence that the Windows implants were infected with
common PE file infectors, also resembling a known pattern of ChinaZ Windows
malware samples seen in the past.&lt;/p&gt;
&lt;p&gt;Furthermore, we highlighted the use of a common compiler/toolchain used to
generate the discovered binaries which seems to be shared across a high number
of samples belonging to the ChinaZ umbrella. We also found artifact
similarities between the BillGates malware and DDoSManager, specifically the
name of two core C++ classes used by the malware.&lt;/p&gt;
&lt;p&gt;A technical analysis of the overall functionality and network protocol for each
of the discovered samples was provided explaining their main features and
capabilities.&lt;/p&gt;
&lt;p&gt;We believe these findings indicate the need by some ChinaZ threat actors to
update their malware toolsets, since they have not conducted a major retooling
process in years, and the majority of the older malware utilized by this group
is largely detected by Anti-Virus engines.&lt;/p&gt;
&lt;p&gt;The code from these samples are now indexed in Intezer Analyze so users can
detect and classify NewManager, AmpManager, DDoSManager, and other threats that
share code with these malware. We have also generated a
&lt;a href="https://github.com/intezer/yara-rules/blob/master/ChinaZ_Managers.yar"target="_blank" rel="noopener"&gt;YARA rule&lt;/a&gt;
which can be used by organizations to hunt for additional samples of these
threats.&lt;/p&gt;
&lt;h2&gt;IOCs&lt;span class="hx:absolute hx:-mt-20" id="iocs"&gt;&lt;/span&gt;
&lt;a href="#iocs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;syn.l11l1[.]com
ccyk.l11l1[.]com
yk.l11l1[.]com
fd.l11l1[.]com
1bfa8af4b51d9fc54d4baa49df27116f44ce269da9123625c1f2ba17289ea2cd
625c57c7090e63472f2bd4d12bf5c821ac821327ee4274a728846fa0bb967b00
F0a2b4c223d6c0c537d9e75b38a2d9b4031485bcfc0c03da96a2b49d7f91591e
B79af4e394cbc8c19fc9b5410fa69b10325fd23f58bec330954caae135239a1f
Dda419d145d4ec7f0eec74ee6cf14ab0b35f22a1af7f39ffbe914c66c445bdf5
3be01b2b27a2cb7b7a852c6305f7a26f35d60fa80ab0050643d97486feaf09dd
33d44642d47488ca0e9fba1935944433e618ec212c5a24969aed406e7b50c611
E3e979d00006fb102279f1033d02bfb8d2ceb6b92c1377195ccb8daa36093c8b
4f5cfb805feb7576e594f1bb3b773ba0ca80e09e49bfb7e3507f815f774ac62d
8ad95b128ab477cc80cba9e4ddccc9d74d423415c17d2837d537c406e6ac81cd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Evidence Aurora Operation Still Active Part 2: More Ties Uncovered Between CCleaner Hack &amp; Chinese Hackers</title><link>https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/</link><pubDate>Mon, 02 Oct 2017 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/</guid><description>
&lt;p&gt;Since my
&lt;a href="../../../2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/"&gt;last post&lt;/a&gt;,
we have found new evidence in the next stage payloads of the CCleaner supply
chain attack that provide a stronger link between this attack and the Axiom
group.&lt;/p&gt;
&lt;p&gt;First of all, our researchers would like to thank the entire team at Cisco
Talos for their excellent work on this attack (their post regarding stage 2 can
be found
&lt;a href="http://blog.talosintelligence.com/2017/09/ccleaner-c2-concern.html"target="_blank" rel="noopener"&gt;here&lt;/a&gt;) as
well as their cooperation by allowing us access to the stage 2 payload. Also,
we would like to give a special thanks to Kaspersky Labs for their
collaboration.&lt;/p&gt;
&lt;h2&gt;The Next Connection&lt;span class="hx:absolute hx:-mt-20" id="the-next-connection"&gt;&lt;/span&gt;
&lt;a href="#the-next-connection" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Starting from the stage 2 payload, I reverse engineered the module, extracting
other hidden shellcode and binaries within. After uploading the different
binaries to Intezer Analyze™, the final payload (that I have access to) had a
match with a binary relating to the Axiom group.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;At first glance, I believed it was going to be the same custom base64 function
as mentioned in my
&lt;a href="../../../2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/"&gt;previous blog post&lt;/a&gt;.
A deeper look in the shared code proved otherwise.&lt;/p&gt;
&lt;p&gt;Binary in screenshot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;f0d1f88c59a005312faad902528d60acbf9cd5a7b36093db8ca811f763e1292a&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related APT17 samples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;07f93e49c7015b68e2542fc591ad2b4a1bc01349f79d48db67c53938ad4b525d&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0375b4216334c85a4b29441a3d37e61d7797c2e1cb94b14cf6292449fb25c7b2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;20cd49fd0f244944a8f5ba1d7656af3026e67d170133c1b3546c8b2de38d4f27&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ee362a8161bd442073775363bf5fa1305abac2ce39b903d63df0d7121ba60550&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig2.jpg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Not only did the first payload have shared code between the Axiom group and
CCBkdr, but the second did as well. The above photo shows the same function
between two binaries. Let me put this into better context for you: out of all
the billions and billions of pieces of code (both trusted and malicious)
contained in the Intezer Code Genome Database, we found this code in only these
APTs. It is also worth noting that this isn’t a standard method one would use
to call an API. The attacker used the simple technique of employing an array to
hide a string from being in clear sight of those analyzing the binary (although
to those who are more experienced, it is obvious) and remain undetected from
antivirus signatures. The author probably copied and pasted the code, which is
what often happens to avoid duplicative efforts: rewriting the same code for
the same functionality twice.&lt;/p&gt;
&lt;p&gt;Due to the uniqueness of the shared code, we strongly concluded that the code
was written by the same attacker.&lt;/p&gt;
&lt;h2&gt;Technical Analysis&lt;span class="hx:absolute hx:-mt-20" id="technical-analysis"&gt;&lt;/span&gt;
&lt;a href="#technical-analysis" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The stage two payload that was analyzed in this report (dc9b5e8aa6ec86db8af0a7aa897ca61db3e5f3d2e0942e319074db1aaccfdc83), after launching the infected version of CCleaner, was dropped to only a selective group of targets, as reported by Talos. Although there is an x64 version, the following analysis will only include the x86 version because they are nearly identical. I will not be going too far in depth as full comprehension of the technical analysis will require an understanding of reverse engineering.&lt;/p&gt;
&lt;p&gt;Instead of using the typical API (VirtualAlloc) to allocate memory, the attackers allocated memory on the heap using LocalAlloc, and then copied a compressed payload to the allocated memory.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig3.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;It looks like the attackers used version 1.1.4 of zlib to decompress the payload into this allocated memory region.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig4.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Depending on if you’re running x86 or x64 Windows, it will drop a different module. (32-bit &lt;code&gt;07fb252d2e853a9b1b32f30ede411f2efbb9f01e4a7782db5eacf3f55cf34902&lt;/code&gt;, 64-bit &lt;code&gt;128aca58be325174f0220bd7ca6030e4e206b4378796e82da460055733bb6f4f&lt;/code&gt;) Both modules are actually legitimate software with additional code and a modified execution flow.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig5.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig6.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The last modified time on the modules is changed to match that of the msvcrt.dll that is located in your system32 folder–a technique to stay under the radar by not being able to check last modified files.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig7.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Some shellcode and another module are written to the registry.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig8.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;After the module is successfully dropped, a service is created under the name Spooler or SessionEnv, depending upon your environment, which then loads the newly dropped module.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig9.png" alt="" loading="lazy" /&gt;
The new module being run by the service allocates memory, reads the registry where the other payload is located, and then copies it to memory
&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig10.png" alt="" loading="lazy" /&gt;
&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig11.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The next payload is executed, which decrypts another module and loads it. If we look at the memory of the next decrypted payload, we can see something that looks like a PE header without the MZ signature. From here, it is as simple as modifying the first two bytes to represent MZ and we have a valid PE file. (&lt;code&gt;f0d1f88c59a005312faad902528d60acbf9cd5a7b36093db8ca811f763e1292a&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig12.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The next module is a essentially another backdoor that connects to a few domains; before revealing the true IP, it will connect to for the next stage payload.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig13.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;It starts by ensuring it receives the correct response from &lt;a href="https://www.microsoft.com"target="_blank" rel="noopener"&gt;https://www.microsoft.com&lt;/a&gt; and &lt;a href="https://update.microsoft.com"target="_blank" rel="noopener"&gt;https://update.microsoft.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig14.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The malware proceeds to decrypt two more URLs.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig15.png" alt="" loading="lazy" /&gt;
&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig16.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The malware authors used steganography to store the IP address in a ptoken field of the HTML.&lt;/p&gt;
&lt;p&gt;Here you can see the GitHub page with the ptoken field.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig17.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The value is then XOR decrypted by &lt;code&gt;0x31415926&lt;/code&gt; which gives you &lt;code&gt;0x5A093B0D&lt;/code&gt; or the IP address: &lt;code&gt;13.59.9.90&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/images/fig18.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;span class="hx:absolute hx:-mt-20" id="conclusion"&gt;&lt;/span&gt;
&lt;a href="#conclusion" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The complexity and quality of this particular attack has led our team to conclude that it was most likely state-sponsored. Considering this new evidence, the malware can be attributed to the Axiom group due to both the nature of the attack itself and the specific code reuse throughout that our technology was able to uncover.&lt;/p&gt;
&lt;h2&gt;IOCs&lt;span class="hx:absolute hx:-mt-20" id="iocs"&gt;&lt;/span&gt;
&lt;a href="#iocs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Stage 2 Payload: dc9b5e8aa6ec86db8af0a7aa897ca61db3e5f3d2e0942e319074db1aaccfdc83
x86 Trojanized Binary: 07fb252d2e853a9b1b32f30ede411f2efbb9f01e4a7782db5eacf3f55cf34902
x86 Registry Payload: f0d1f88c59a005312faad902528d60acbf9cd5a7b36093db8ca811f763e1292a
x64 Trojanized Binary: 128aca58be325174f0220bd7ca6030e4e206b4378796e82da460055733bb6f4f
x64 Registry Payload: 75eaa1889dbc93f11544cf3e40e3b9342b81b1678af5d83026496ee6a1b2ef79
Registry Keys:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Wbem\Perf\�01
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Wbem\Perf\�02
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Wbem\Perf\�03
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Wbem\Perf\�04
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Wbem\Perf\HBP&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Evidence Aurora Operation Still Active: Supply Chain Attack Through CCleaner</title><link>https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/</link><pubDate>Wed, 20 Sep 2017 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/</guid><description>
&lt;p&gt;Recently, there have been a few attacks with a supply chain infection, such as
&lt;a href="https://securelist.com/shadowpad-in-corporate-networks/81432/"target="_blank" rel="noopener"&gt;Shadowpad&lt;/a&gt;
being implanted in many of Netsarang’s products, affecting millions of people.
You may have the most up to date cyber security software, but when the software
you are trusting to keep you protected gets infected there is a problem. A
backdoor, inserted into legitimate code by a third party with malicious intent,
leads to millions of people being hacked and their information stolen.&lt;/p&gt;
&lt;p&gt;Avast’s CCleaner software had a backdoor encoded into it by someone who had
access to the supply chain. Through somewhere that had access to the source
code of CCleaner, the main executable in v5.33.6162 had been modified to
include a backdoor. The official statement from Avast can be found
&lt;a href="https://blog.avast.com/update-to-the-ccleaner-5.33.6162-security-incident"target="_blank" rel="noopener"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;The Big Connection&lt;span class="hx:absolute hx:-mt-20" id="the-big-connection"&gt;&lt;/span&gt;
&lt;a href="#the-big-connection" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Costin Raiu, director of Global Research and Analysis Team at Kaspersky Lab,
was the first to find a code connection between APT17 and the backdoor in the
infected CCleaner:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The malware injected into #CCleaner has shared code with several tools used
by one of the APT groups from the #Axiom APT &amp;lsquo;umbrella&amp;rsquo;.&lt;/p&gt;
&lt;p&gt;— Costin Raiu (@craiu)
&lt;a href="https://x.com/craiu/status/910059453948579840?ref_src=twsrc%5Etfw"target="_blank" rel="noopener"&gt;September 19, 2017&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using Intezer Analyze™, we were able to verify the shared code between the
backdoor implanted in CCleaner and earlier APT17 samples. The photo below is
the result of uploading the CCBkdr module to Intezer Analyze™, where the
results show there is an overlap in code. With our technology, we can compare
code to a huge database of malicious and trusted software — that’s how we can
prove that this code has never been seen before in any other software.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;A deeper analysis leads us to the functions shown below. The code in question
is a unique implementation of base64 only previously seen in APT17 and not in
any public repository, which makes a strong case about attribution to the same
threat actor.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig2.jpg" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;This code connection is huge news. APT17, also known as
&lt;a href="../../../2017/10/evidence-aurora-operation-still-active-part-2-more-ties-uncovered-between-ccleaner-hack-chinese-hackers/"&gt;Operation Aurora&lt;/a&gt;,
is one of the most sophisticated cyber attacks ever conducted and they
specialize in supply chain attacks. In this case, they probably were able to
hack CCleaner’s build server in order to plant this malware. Operation Aurora
started in 2009 and to see the same threat actor still active in 2017 could
possibly mean there are many other supply chain attacks by the same group that
we are not aware of. The previous attacks are attributed to a Chinese group
called PLA Unit 61398.&lt;/p&gt;
&lt;h2&gt;Technical Analysis&lt;span class="hx:absolute hx:-mt-20" id="technical-analysis"&gt;&lt;/span&gt;
&lt;a href="#technical-analysis" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The infected CCleaner file that begins the analysis is from
&lt;code&gt;6f7840c77f99049d788155c1351e1560b62b8ad18ad0e9adda8218b9f432f0a9&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A technical analysis was posted by Talos
&lt;a href="http://blog.talosintelligence.com/2017/09/avast-distributes-malware.html"target="_blank" rel="noopener"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The flow-graph of the malicious CCleaner is as follows (taken from the Talos
report):&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig3.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Infected function:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig4.png" title="Infected function" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Infected function&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Load and execute the payload code:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig5.png" title="Load and execute the payload code" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Load and execute the payload code&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After the embedded code is decrypted and executed, the next step is a PE
(portable executable) file loader. A PE file loader basically emulates the
process of what happens when you load an executable file on Windows. Data is
read from the PE header, from a module created by the malware author.&lt;/p&gt;
&lt;p&gt;The PE loader first begins by resolving the addresses of imports commonly used
by loaders and calling them. GetProcAddress to get the addresses of external
necessary functions, LoadLibraryA to load necessary modules into memory and get
the address of the location of the module in memory, VirtualAlloc to create
memory for somewhere to copy the memory, and in some cases, when not
implemented, and memcpy to copy the buffer to the newly allocated memory
region.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2017/09/evidence-aurora-operation-still-active-supply-chain-attack-through-ccleaner/images/fig6.png" title="The PE loader" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;The PE loader&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;After the module is copied to memory, to load it properly, the proper loading
procedure is executed. The relocation table is read to adjust the module to the
base address of the allocated memory region, the import table is read, the
necessary libraries are loaded, and the import address table is filled with the
correct addresses of the imports. Next, the entire PE header is overwritten
with 0’s, a mechanism to destroy the PE header tricking security software into
not realizing this module is malicious, and after the malicious code begins
execution.&lt;/p&gt;
&lt;p&gt;The main module does the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tries an anti-debug technique using time and IcmpSendEcho to wait&lt;/li&gt;
&lt;li&gt;Collect data about the computer (Operating system, computer name, DNS
domain, running processes, etc)&lt;/li&gt;
&lt;li&gt;Allocates memory for payload to retrieve from C&amp;amp;C server&lt;/li&gt;
&lt;li&gt;Contacts C&amp;amp;C server at IP address &lt;code&gt;216.126.225.148&lt;/code&gt;. If this IP address is
unreachable, uses a domain generation algorithm and uses a different domain
depending on the month and year&lt;/li&gt;
&lt;li&gt;Executes code sent by C&amp;amp;C&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;By the time of the analysis, we were unable to get our hands on the code sent
by the C&amp;amp;Cs.&lt;/p&gt;
&lt;p&gt;If you would like to analyze the malware yourself, you may refer to my tweet.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#ccleaner malware DLL w/ IAT fix &lt;a href="https://t.co/FprmtmkV64"target="_blank" rel="noopener"&gt;https://t.co/FprmtmkV64&lt;/a&gt;
&lt;a href="https://t.co/dgWiQVd31k"target="_blank" rel="noopener"&gt;https://t.co/dgWiQVd31k&lt;/a&gt; @TalosSecurity @malwrhunterteam
pic.twitter.com/TxsbveFoHJ&lt;/p&gt;
&lt;p&gt;— Jay Rosenberg (@jaytezer) September 18, 2017&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>