Distribution Method
The packer is distributed via fraudulent download websites that achieve visibility through aggressive malvertising and SEO manipulation. These sites are designed to closely resemble legitimate software distribution portals, enticing users searching for common utilities to download malicious installers. Importantly, no evidence suggests compromise of upstream vendors or repositories; the infection vector relies entirely on search-driven user interaction and visual trust abuse.
Detection Landscape
Current antivirus detections frequently classify pkr_mtsi samples under generic or payload-centric labels such as “oyster” or “shellcoderunner,” reflecting a focus on later-stage malware rather than the loader itself. A publicly available YARA rule named “TextShell” provides partial coverage but applies only to a subset of observed variants. A more comprehensive YARA rule capable of matching all identified samples is included in the full technical analysis as Appendix A.
Core Technical Characteristics
The first observable action during execution is memory allocation for the next-stage payload. Early samples perform this operation through a straightforward call to VirtualAlloc. Beginning in August 2025, newer variants transitioned to an obfuscated invocation of ZwAllocateVirtualMemory, incorporating randomized parameter ordering and junk instructions to complicate static and dynamic analysis.
Payload reconstruction follows a highly distinctive pattern. The embedded payload is divided into very small fragments, typically ranging from one to eight bytes, which are stored as immediate values within the loader code. These fragments are optionally passed through decoding routines in later variants before being written to precise offsets within the allocated memory region. This approach produces an unusually dense sequence of small write operations that stands out clearly in behavioral traces.
API resolution logic has also evolved over time. Early builds rely on plaintext string comparisons to resolve functions, whereas later samples implement hash-based resolution using PEB traversal. Across all generations, the packer consistently injects large volumes of nonfunctional GDI API calls, a tactic intended to disrupt heuristic analysis and slow reverse-engineering efforts.
File Format Variants
In executable form, pkr_mtsi follows a relatively direct execution path that quickly transfers control to a modified UPX unpacking stub. The DLL variant, however, introduces significantly more complexity. It supports multiple execution contexts, triggering unpacking logic during DLL load events and, in some cases, during unload processing. Additionally, the DLL exports DllRegisterServer, enabling execution via regsvr32.exe and facilitating registry-based COM persistence mechanisms.
Obfuscated UPX Module
The intermediate stage relies on recent versions of UPX that have been deliberately altered to resist identification and automated unpacking. These modifications include the removal of standard headers, magic values, and metadata while preserving sufficient structure to remain executable. In later variants, even UPX section identifiers and embedded text resources are stripped, further obscuring the packer’s lineage and frustrating static tooling. Image base selection has also diverged over time. Early samples retain default MSVC image bases, such as 0x140000000 for executables and 0x180000000 for DLLs. More recent builds adopt unusually high, non-standard image bases, such as 0x7ff662c10000, likely intended to resemble relocated system DLLs or ASLR-shifted modules.
Anti-Debugging Techniques
The packer employs two primary debugger detection mechanisms: IsDebuggerPresent and CheckRemoteDebuggerPresent. When debugging activity is detected, execution either terminates immediately or enters infinite loop traps implemented through self-referencing jump instructions. These traps are stable and distinctive enough to serve as reliable YARA indicators.
NTDLL Handle Resolution
Three distinct approaches to resolving the NTDLL handle have been observed. Some samples load the library directly via LoadLibraryA using a hardcoded string. Others implement a custom resolver that traverses the PEB via the TEB pointer located at gs:0x60. The most obfuscated variants compute the NTDLL address indirectly through stack manipulation and value-stomping techniques.
During PEB traversal, the loader retrieves the PEB pointer from the TEB, walks the InMemoryOrderModuleList, and compares module names using either direct string comparison or hashed values. In one notable implementation detail, module names are copied onto the stack with non-ASCII characters replaced by the ? character, producing repeated 0x3f immediate values that are highly detectable.
An additional anti-analysis check examines module name length, terminating execution if a 64-character name is encountered. This behavior is intended to detect SHA256-named sandbox binaries. While effective for executable samples, it often fails for DLLs because the initial module list entry typically corresponds to rundll32.exe or regsvr32.exe rather than the malicious DLL itself.
API Function Resolution
Function resolution is performed through a hash-based mechanism that begins by validating the DOS header MZ signature, parsing the export directory, and hashing each exported function name. The resulting hash is compared against hardcoded values embedded in the loader. The hash algorithm uses multiplication by fixed constants, such as 0x101, combined with signed addition, resembling known HashDB techniques while varying constants across builds. Hash computation may be implemented inline or delegated to dedicated subroutines.
Later variants further obscure memory allocation behavior by calculating allocation sizes across multiple instructions rather than loading a single immediate value, complicating static analysis and hindering automated unpacking.
Generic DLL Resolver
For all libraries other than ntdll.dll, pkr_mtsi uses a generic resolver driven by hardcoded numeric keys rather than hashes. This resolver accepts pointers to RtlInitUnicodeString, LdrGetDllHandle, and LdrLoadDll, then performs a series of conditional comparisons against stack-based, obfuscated DLL name strings. Observed targets include ADVAPI32.dll, KERNEL32.DLL, msvcrt.dll, NETAPI32.dll, and WS2_32.dll.
Stack string obfuscation is achieved through partial overwrites and value-stomping operations, with additional decode calculations applied to individual bytes. These strings can be recovered through emulation, for example using Binary Refinery’s vstack unit. Conversion from ASCII to Unicode is performed using SIMD instructions, producing a strong and repeatable YARA signature.
The resolver first attempts to obtain a handle via LdrGetDllHandle and falls back to LdrLoadDll if the library is not already loaded, ultimately returning the resolved handle to the caller.
UPX Module Fixups
In DLL variants, the loader performs TLS callback fixups by adding the allocated memory base address to relative offsets within the UPX module. This includes writing virtual addresses into the UPX TLS directory and constructing a callback array that points to the PETLSC2 function within the UPX stub.
Import resolution proceeds sequentially. The loader first resolves essential NTDLL functions, then uses the generic DLL resolver to load additional libraries. API function hashes are resolved from these handles, and the resulting pointers are written into the UPX module’s import table, compensating for its non-standard loading process.
Critical Programming Flaw
A particularly high-signal detection opportunity arises from a programming error present across observed variants. The loader issues three consecutive calls to NtProtectVirtualMemory using an invalid protection constant, 0x6, which combines PAGE_READONLY and PAGE_READWRITE. Each call returns STATUS_INVALID_PAGE_PROTECTION (0xC0000045), generating a distinctive sequence of failures that is well suited for EDR telemetry-based detection.
DLL Execution Paths
When executing through the DLL entry point, the loader inspects the fdwReason parameter and invokes the UPX stub only when the reason corresponds to DLL_PROCESS_ATTACH. This prevents redundant unpacking during other lifecycle events and ensures controlled execution. Three parameters are passed through the UPX stub to the payload entry point.
The exported DllRegisterServer function follows a similar pattern but passes four parameters instead. In observed payloads, these parameters are immediately overwritten, suggesting that the packer is designed to accommodate multiple payload families with differing expectations.
Behavioral Patterns
Early-stage execution is characterized by a rapid sequence of attacker-controlled function calls that begins with deterministic memory allocation. This is followed by a dense cluster of small write operations, each depositing one to eight bytes into a contiguous memory region. Control flow and computation are minimal during this phase, and the behavior occurs entirely before any payload logic is invoked.
Although obfuscation has increased over time, the fundamental allocation-then-reconstruction model has remained intact. In earlier builds, the absence of payload encoding allows these reconstruction patterns to stand out even more clearly, making them particularly valuable for detection.
Defensive Recommendations
Preventive controls should emphasize behavioral detection of early execution stages, with particular focus on the allocation-and-write sequence and the invalid memory protection errors. These signals are stable across variants and difficult for the attacker to remove without fundamentally redesigning the loader. For DFIR practitioners, understanding the staged architecture, the modified UPX intermediary, and the alternate DLL execution paths enables faster triage, more reliable unpacking, and clearer separation between the packer and its delivered payloads.
Defensive Recommendations