<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Intezer Research – China</title><link>https://research.intezer.com/tags/china/</link><description>Recent content in China on Intezer Research</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 10 Sep 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://research.intezer.com/tags/china/index.xml" rel="self" type="application/rss+xml"/><item><title>Frankenstein Variant of the ToneShell Backdoor Targeting Myanmar</title><link>https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/</link><pubDate>Wed, 10 Sep 2025 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/</guid><description>
&lt;p&gt;ToneShell is a lightweight backdoor tied to the China-nexus group Mustang
Panda. Typically delivered via DLL sideloading inside compressed archives with
legitimate signed executables and often spread through cloud-hosted lures.
&lt;a href="https://www.zscaler.com/blogs/security-research/latest-mustang-panda-arsenal-toneshell-and-starproxy-p1"target="_blank" rel="noopener"&gt;Zscaler’s&lt;/a&gt;
2025 analysis described updates to its FakeTLS C2 (shifting from TLS 1.2- to
1.3-style headers), use of GUID-based host IDs, a rolling-XOR scheme, and a
minimal command set for file staging and interactive shell access. Notably,
some of this activity was observed in Myanmar, a region of strategic importance
to China. Targeting Myanmar is particularly interesting as it reflects China’s
broader geopolitical interests, spanning border security, infrastructure
projects, and political developments, and highlights how cyber operations are
leveraged to maintain influence in neighboring states.&lt;/p&gt;
&lt;p&gt;This blog is a technical analysis of another variant of the backdoor. While
this variant does not introduce major new features, it is worth highlighting
the anti-analysis techniques it employs and the new indicators that can support
threat hunting and detection. In addition, the continued targeting of Myanmar
underscores China’s sustained use of cyber operations to maintain its interests
abroad.&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;As previously documented, ToneShell is a dll that is sideloded by a legitimate
executable, usually bundled in the archive file. In this case it is a ZIP file,
named: TNLA နှင့် အခြားတော်လှန်ရေးအင်အားစုမျာ. Which translate to: TNLA and
other revolutionary forces.&lt;/p&gt;
&lt;p&gt;sha256: &lt;code&gt;1272a0853651069ed4dc505007e8525f99e1454f9e033bcc2e58d60fdafa4f0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The backdoor is a DLL named: SkinH.dll, compiled on 2025-07-14 22:38:08.&lt;/p&gt;
&lt;p&gt;sha256:
&lt;a href="https://analyze.intezer.com/files/e7b29611c789a6225aebbc9fee3710a57b51537693cb2ec16e2177c22392b546?utm_campaign=research-blog&amp;amp;utm_content=frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;e7b29611c789a6225aebbc9fee3710a57b51537693cb2ec16e2177c22392b546&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig1.png" title="Code reuse with ToneShell" alt="Showing amount shared code with other ToneShell samples" loading="lazy" /&gt;
&lt;figcaption&gt;Code reuse with ToneShell&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The backdoor first checks the current module path for the string
&lt;code&gt;Google\DriveFS\Scratch&lt;/code&gt;. If not found, it enumerates processes to identify
the parent process, retrieves its image path, and verifies whether it contains
&lt;strong&gt;GoogleDrive&lt;/strong&gt;. If found, the backdoor will terminate its execution. This
check might be an attempt by the threat actor to prevent infecting themselves.
If this validation fails, the code enforces a single-instance policy using a
named mutex, &lt;code&gt;Global\SingleCorporation12AD8B&lt;/code&gt;. It attempts to create the
mutex, storing the handle globally and setting a flag to indicate success or
failure. If creation fails or the mutex already exists, it releases any handles
and marks it as not created. Next, the backdoor checks its persistence
location. It compares its module path with the user profile directory
(CSIDL_APPDATA, 0x1A). If the binary is not under the user profile, it copies
itself and the following files: msvcr100.dll, msvcp100.dll, mfc100.dll to a new
folder it creates. The new directory name consists of a 6-character random
uppercase folder name (e.g., &lt;code&gt;C:\Users\&amp;lt;user&amp;gt;\AppData\&amp;lt;random-6-chars&amp;gt;&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig2.png" title="The function that copies the DLLs to a new folder in AppData" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;The function that copies the DLLs to a new folder in AppData&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Once installed, it attempts to spin up the Task Scheduler COM service, connect
to the local scheduler, open the root folder (&lt;code&gt;&amp;quot;\&amp;quot;&lt;/code&gt;) and obtain an
IRegisteredTask for a task named dokanctl. If the task doesn’t exist, it will
create it using RegisterTaskDefinition. The task is set to execute every
minute, it sets the execution path to the folder in AppData created earlier:
&lt;code&gt;%APPDATA%\&amp;lt;random-6-chars&amp;gt;\svchosts.exe&lt;/code&gt;, and sets it as the action Path. The
task is registered in the root folder with the name &lt;code&gt;dokanctl&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig3.png" title="Task creation" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Task creation&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;If the backdoor is already under the user profile, it performs junk arithmetic
before entering its C2 loop, followed by a bounded timing/zero-check loop that
appears to serve as anti-analysis noise without affecting the main flow.&lt;/p&gt;
&lt;h3&gt;API Function Hashing&lt;span class="hx:absolute hx:-mt-20" id="api-function-hashing"&gt;&lt;/span&gt;
&lt;a href="#api-function-hashing" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware uses a custom API-resolving scheme based on a simple rolling hash,
applying it to module and function names instead of storing them in cleartext.
This technique, previously analyzed in previous blogs, is a common evasion
method seen in different malware types. With the
&lt;a href="https://github.com/OALabs/hashdb/blob/main/algorithms/tonepipeshell.py"target="_blank" rel="noopener"&gt;HashDB project&lt;/a&gt;,
resolving these hashes back to the original imported functions is
straightforward, making analysis and detection easier.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig4.png" title="Hash calculation" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Hash calculation&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig5.png" title="Resolved Windows API functions" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Resolved Windows API functions&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Anti-Analysis and Anti-Sandboxing&lt;span class="hx:absolute hx:-mt-20" id="anti-analysis-and-anti-sandboxing"&gt;&lt;/span&gt;
&lt;a href="#anti-analysis-and-anti-sandboxing" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;This ToolShell variant employs several stalling and anti-sandboxing tricks
designed to waste time, confuse automated analysis, and evade lightweight
sandboxes. These include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Repeated file churn: creating, writing, closing, and deleting a temporary
file in a loop with Sleep(100) delays, which burns execution time and
stresses filesystem emulation.&lt;/li&gt;
&lt;li&gt;Randomized sleep loops: several loops sleep for pseudo-random intervals
ranging from ~800 ms to over a second per iteration, accumulating 20+ seconds
of startup delay before meaningful behavior begins.&lt;/li&gt;
&lt;li&gt;Tick count checks: uses GetTickCount64() combined with jittered sleeps,
waiting until at least 10 seconds of wall-clock time has elapsed. This
ensures that emulators that don’t advance the system clock realistically can
get stuck.&lt;/li&gt;
&lt;li&gt;Opaque string comparisons: slides across a large embedded wide-string buffer,
repeatedly calling lstrcmpW() between overlapping substrings until a break
condition. The comparison results are discarded; the loop simply consumes
cycles and obfuscates control flow.&lt;/li&gt;
&lt;li&gt;Nonsense randomization: calculates values like 0xBABE or 0xCAFE via contrived
branches using rand(). These values are not security checks, but serve as
junk arithmetic to make the code harder to follow.&lt;/li&gt;
&lt;li&gt;Decoy API use: occasionally calls APIs such as OutputDebugStringA and sets
LastError to unusual constants (0xBADF00D), further muddying behavior without
altering core logic.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig6.png" title="File creation loops" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;File creation loops&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Notably, the large embedded string buffers used in the comparison loop contain
text copied from
&lt;a href="https://openai.com/index/introducing-4o-image-generation/#:~:text=From%20the%20first%20cave%20paintings%20to%20modern%20infographics%2C%20humans%20have%20used%20visual%20imagery%20to%20communicate%2C%20persuade%2C%20and%20analyze%E2%80%94not%20just%20to%20decorate."target="_blank" rel="noopener"&gt;OpenAI’s blog&lt;/a&gt;
on image generation and from &lt;a href="https://www.pega.com/ai-innovation"target="_blank" rel="noopener"&gt;Pega AI’s&lt;/a&gt;
website. Pega AI refers to the artificial intelligence features integrated into
the Pega platform, a software suite for workflow automation and customer
relationship management. The backdoor does not use this content functionally;
instead, it serves as filler to inflate the binary and supply meaningless
strings for comparison.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig7.png" title="Text taken from PegaAI’s website" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Text taken from PegaAI’s website&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/09/frankenstein-variant-of-the-toneshell-backdoor-targeting-myanmar/images/fig8.png" title="Text taken from OpenAI’s website" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Text taken from OpenAI’s website&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Together, these techniques do not detect debuggers directly; instead, they
stall execution, pollute control flow with junk work, and frustrate automated
sandboxing systems that expect short-lived, straightforward malware runs.&lt;/p&gt;
&lt;h3&gt;GUID Creation&lt;span class="hx:absolute hx:-mt-20" id="guid-creation"&gt;&lt;/span&gt;
&lt;a href="#guid-creation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Similar to earlier versions, this variant of ToneShell generates a unique
identifier for each infected machine. It first attempts to check if one was
already created by reading 16 bytes from &lt;code&gt;C:\ProgramData\SystemRuntimeLag.inc&lt;/code&gt;.
The malware creates a new seed if the file is missing, unreadable, or does not
provide exactly 16 bytes. The primary method is to generate a GUID via
CoCreateGuid and use it as the seed. If that fails, it falls back to producing
16 bytes using an internal linear congruential generator (LCG) seeded from the
current PRNG state. Once a new seed is generated, it is written back to the
designated file path to ensure persistence across executions.&lt;/p&gt;
&lt;p&gt;This logic is similar to Zscelar’s blog about the second backdoor variant.&lt;/p&gt;
&lt;h3&gt;Networking&lt;span class="hx:absolute hx:-mt-20" id="networking"&gt;&lt;/span&gt;
&lt;a href="#networking" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The malware sets up a socket with a C2 at the address:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;146.70.29[.]229:443&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The malware’s network protocol wraps its messages in a TLS-like record header
to blend in with legitimate traffic. Each packet begins with the fixed bytes 17
03 03 (TLS 1.2 Application Data) followed by a two-byte length field, but only
the low byte is honored, effectively capping payloads at 255 bytes. The 5-byte
header is read into a temporary stack buffer and discarded; only the payload
bytes are stored in the context structure’s receive buffer starting at offset
0.&lt;/p&gt;
&lt;p&gt;Once the payload is received, the malware XOR-decodes it in place with a
256-byte rolling key. The first decoded byte is treated as a “type/status”
field, the second as an additional code, and the remainder (len-2 bytes) as the
message body. The decoded buffer pointer is then saved in the structure for
later use. This design produces a simple packet format: [TLS-like
header][XOR-obfuscated type | code | body…], with the header stripped before
the data is available to the rest of the malware.&lt;/p&gt;
&lt;p&gt;Interestingly, while the GUID generation logic in this sample aligns with the
first version of ToneShell described by Zscaler, the communication protocol
remains identical to the second version. Combined with the anti-analysis
techniques and the use of text copied from AI platforms, this sample stands out
as a hybrid variant.&lt;/p&gt;
&lt;h3&gt;Pivoting on The C2 Address&lt;span class="hx:absolute hx:-mt-20" id="pivoting-on-the-c2-address"&gt;&lt;/span&gt;
&lt;a href="#pivoting-on-the-c2-address" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Pivoting on the C2 address, we were also able to find another variant:&lt;/p&gt;
&lt;p&gt;sha256: &lt;code&gt;a58868b3d50b775de99278eeb14da8b7409b165aa45313c6d9fa35ac30d2cda2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This variant was compiled on 2025-03-23 22:42:42, named node.dll. It was part
of an archive named: update.zip with the sha256:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;543024edc9f160cc1cedcffc3de52bfa656daa0ec9ed351331d97faaa67d0d99&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This variant reuses the same C2 commands and anti-analysis techniques described
above, and it stores the GUID under the same file name.&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;In summary, this analysis of a new ToneShell backdoor variant highlights the
evolving tactics of the Mustang Panda group, particularly their sustained
targeting of Myanmar. While not introducing revolutionary features, this
variant employs anti-analysis techniques, including elaborate stalling
mechanisms and obfuscated code. The blend of old and new elements, such as the
consistent communication protocol alongside updated GUID generation and the use
of seemingly random, copied text for filler, underscores the adaptive nature of
this threat. The continuous refinement of these evasion methods, coupled with
the geopolitical significance of the targeted region, reinforces the need for
ongoing research and threat hunting to counter cyber operations.&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;ToneShell variants:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;a58868b3d50b775de99278eeb14da8b7409b165aa45313c6d9fa35ac30d2cda2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;e7b29611c789a6225aebbc9fee3710a57b51537693cb2ec16e2177c22392b546&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Archive files:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;543024edc9f160cc1cedcffc3de52bfa656daa0ec9ed351331d97faaa67d0d99&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;1272a0853651069ed4dc505007e8525f99e1454f9e033bcc2e58d60fdafa4f0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;C2:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;146.70.29[.]229:443&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Threat Bulletin: Fire in the Woods – A New Variant of FireWood</title><link>https://research.intezer.com/blog/2025/08/threat-bulletin-firewood/</link><pubDate>Wed, 13 Aug 2025 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2025/08/threat-bulletin-firewood/</guid><description>
&lt;p&gt;&lt;em&gt;A new and low-detected variant of the FireWood backdoor was discovered by
Intezer’s Research Team, with some changes in the implementation and the
configuration of the backdoor.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;FireWood is a Linux backdoor
&lt;a href="https://www.welivesecurity.com/en/eset-research/unveiling-wolfsbane-gelsemiums-linux-counterpart-to-gelsevirine/"target="_blank" rel="noopener"&gt;discovered&lt;/a&gt;
by ESET’s research team. They linked it to the long‑running &amp;ldquo;Project Wood&amp;rdquo;
malware lineage, which dates back to at least 2005 and includes usage in the
earlier Operation TooHash campaign. It functions as a remote access trojan
(RAT) on Linux systems, employing kernel‑level rootkit modules (e.g.,
usbdev.ko) and TEA‑based encryption to hide its presence, maintain persistence,
and communicate covertly with its command‑and‑control infrastructure. Once
deployed, likely via web shells left on compromised Linux desktops, it enables
attackers to execute commands, exfiltrate sensitive data such as system
information and credentials, and operate stealthily over prolonged espionage
operations. The backdoor has low confidence connections to the China-aligned
Gelsemium APT group, as the overlaps may be coincidental or reflect shared
tools across multiple groups.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;We found a new and low-detected variant of the FireWood backdoor&lt;/strong&gt;. The core
functionality of the backdoor remains the same but we did notice some changes
in the implementation and the configuration of the backdoor. It is unclear if
the kernel module was also updated as we were not able to collect it.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/08/threat-bulletin-firewood/images/fig1.png" title="Code analysis of the new version in Intezer." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Code analysis of the new version in Intezer.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/08/threat-bulletin-firewood/images/fig2.png" title="SHA256: 898a5bd86c5d99eb70088a90f1d8f90b03bd38c15a232200538d0601c888acb6" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;SHA256: 898a5bd86c5d99eb70088a90f1d8f90b03bd38c15a232200538d0601c888acb6&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;Technical Analysis of New Firewood Variant&lt;span class="hx:absolute hx:-mt-20" id="technical-analysis-of-new-firewood-variant"&gt;&lt;/span&gt;
&lt;a href="#technical-analysis-of-new-firewood-variant" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In the older variant, execution began with an explicit permission gate, calling
&lt;code&gt;CUser::IsSuc()&lt;/code&gt;, and the process would exit if this check failed. In the newer
build, that early check is removed entirely. The new version defers any
root‑or‑kernel gating until after it daemonizes and saves its PID. To achieve
this, the code splits the former &lt;code&gt;SavePidAndCheckKernel()&lt;/code&gt; helper into two
discrete steps: an early &lt;code&gt;SavePid(pid)&lt;/code&gt;, followed later by
&lt;code&gt;CModuleControl::AutoLoad()&lt;/code&gt; and &lt;code&gt;CheckLkmLoad()&lt;/code&gt;. This separation clarifies
the startup sequence and enhances the hide‑via‑kernel‑module logic.
Additionally, rather than simply sending a stripped‑down identifier, the
updated version builds a larger buffer containing the process name,
hex‑formatted port, PID, a hardcoded “kde‑tra” process name, and a configurable
flag (or the literal “nothing”). That extra metadata is passed through
&lt;code&gt;CHideProcess::NetLinkInit()&lt;/code&gt;,
&lt;code&gt;CHideProcess::SendProcessName(&amp;amp;CHideProcess::mInstance)&lt;/code&gt;, and
&lt;code&gt;CHideProcess::Destroy()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note the typo in the method name &amp;ldquo;Destroy&amp;rdquo;, this error also appears in the
older Firewood variant. Another typo persists in both versions in the following
error message: &amp;ldquo;Get Memory Faile&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2025/08/threat-bulletin-firewood/images/fig3.png" title="New evasion implementation and comparison of main functions" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;New evasion implementation and comparison of main functions&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;On the networking side, the older version read configuration settings that
defined both the number of days between beaconing and a &lt;code&gt;delayTime&lt;/code&gt; specifying
the interval between packets. It also used a randomized time‑window algorithm
to stagger connections. The new build collapses all of this into a
straightforward &lt;code&gt;while (true)&lt;/code&gt; loop. After waiting for the configured startup
delay, it continuously calls &lt;code&gt;ConnectToSvr()&lt;/code&gt;, sleeping briefly on failure,
until success or until the overall timer expires, then cleans up and exits. By
removing the multi‑stage scheduling and random timing logic, the connection
routine becomes more predictable and maintainable, trading temporal obfuscation
for reliable C2 reachability.&lt;/p&gt;
&lt;p&gt;Overall, the communication protocol and C2 setup remain the same; the only
significant change is that the new version no longer relies on timeouts from
the configuration.&lt;/p&gt;
&lt;p&gt;Both Firewood versions collect information about the user and the infected
machine. The new variant adds a fallback for OS detection: whereas the older
version reads distribution data from &lt;code&gt;/etc/issue&lt;/code&gt;, the new version falls back
to &lt;code&gt;/etc/issue.ne&lt;/code&gt;t if &lt;code&gt;/etc/issue&lt;/code&gt; is unavailable, parsing the data in the
same way.&lt;/p&gt;
&lt;p&gt;The backdoor defines file paths used by both itself and its kernel module. The
new variant sets paths for root users as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/usr/lib/.kde-root/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/usr/lib/.kde-root/lib/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/usr/lib/.kde-root/data/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/usr/lib/.kde-root/kdeinit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/usr/lib/.kde-root/pid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d/rc.local&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For non-root users, it uses:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$HOME/.kde-root/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$HOME/.kde-root/lib/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$HOME/.kde-root/data/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$HOME/.kde-root/kdeinit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$HOME/.kde-root/pid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$HOME/.bashrc&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By contrast, the older variant for root users used:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d/rc.local&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/rc.d/rc.local&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d/boot.local&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And for non-root users:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$HOME/.bashrc&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The FireWood backdoor supports a number of commands documented by ESET. The new
variant removes some commands and adds others. It drops commands for changing
beacon intervals and delay times (command IDs &lt;code&gt;0x111&lt;/code&gt;, &lt;code&gt;0x113&lt;/code&gt;, &lt;code&gt;0x114&lt;/code&gt;), as these
settings are no longer used. It also removes the file-read command (ID &lt;code&gt;0x201&lt;/code&gt;).
The process‑hiding command has moved to ID &lt;code&gt;0x202&lt;/code&gt; (from &lt;code&gt;0x112&lt;/code&gt;), and the
&lt;code&gt;HideModule&lt;/code&gt; function was removed. A new command (&lt;code&gt;SetAutoKillEl&lt;/code&gt;, ID &lt;code&gt;0x160&lt;/code&gt;)
toggles or sets an “auto‑kill” feature in the agent.&lt;/p&gt;
&lt;p&gt;Besides these commands, there are also three commands that appear in both
versions and were not previously documented:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Command id &lt;code&gt;0x109&lt;/code&gt;: A command that indicates a change in the connection
configuration.&lt;/li&gt;
&lt;li&gt;Command id &lt;code&gt;0x192&lt;/code&gt;: Gets a file from the C2 and execute it using the system
function. Unlike the previously documented command id &lt;code&gt;0x185&lt;/code&gt;, this command
calls first &lt;code&gt;CFileControl::FileUp&lt;/code&gt; to receive the file from the C2.&lt;/li&gt;
&lt;li&gt;Command id &lt;code&gt;0x195&lt;/code&gt;: Exfiltration of files with the following extensions: &lt;code&gt;.v2&lt;/code&gt;,
&lt;code&gt;.k2&lt;/code&gt;, &lt;code&gt;.W2&lt;/code&gt;, and &lt;code&gt;drive.C2&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We also located an older sample submitted to VirusTotal from Iran on February
5, 2025:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;4c293309a7541edb89e3ec99c4074584328a21309e75a46d0ddb4373652ee0d6&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Additionally, we found a sample from the Philippines submitted on May 7, 2022;
its code is identical to the one we analyzed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;d7be3494b3e1722eb28f317f3b85ee68bf7ea5508aa2d5782392619e078b78af&lt;/code&gt;&lt;/li&gt;
&lt;/ul&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;New Firewood Version&lt;span class="hx:absolute hx:-mt-20" id="new-firewood-version"&gt;&lt;/span&gt;
&lt;a href="#new-firewood-version" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;898a5bd86c5d99eb70088a90f1d8f90b03bd38c15a232200538d0601c888acb6&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;d7be3494b3e1722eb28f317f3b85ee68bf7ea5508aa2d5782392619e078b78af&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Old Firewood Version&lt;span class="hx:absolute hx:-mt-20" id="old-firewood-version"&gt;&lt;/span&gt;
&lt;a href="#old-firewood-version" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cff20753e36a4c942dc4dab5a91fd621a42330e17a89185a5b7262280bcd9263&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;4c293309a7541edb89e3ec99c4074584328a21309e75a46d0ddb4373652ee0d6&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><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></channel></rss>