Spectra Assure Free Trial
Get your 14-day free trial of Spectra Assure for Software Supply Chain Security
Get Free TrialMore about Spectra Assure Free TrialThe prologue in the entry point patch is obfuscated. The first two instructions, mov and add are a non-standard alternative for push rbp. These are followed by a push pop that together form a junk code nop. The next image shows this obfuscated prologue. This screenshot is of the sample with SHA256: 4987af027009d572c26f6d009c5e53e237cb2e3ab9d52094c14dc0b8b6f40b14.

Figure 1: Obfuscated prologue of BubbleLoader entry point patch
The first function call to sub_40160c is used to collect the actual virtual address of the function's return. This is a form of position independent code, specifically GetPC. The subtraction at address 0x401531 of 0x152e is a relative address offset. The result of this calculation is the image base even if the address space has been adjusted by ASLR. The called function and the image base calculation after it are shown in the following figure.

Figure 2: Function call to calculate actual image base using a position independent code technique
The actual image base address stored in rbx is subsequently used with the base relative offsets of the imports and of the next stage PNG. The adversary is almost certainly using a patch template and replacing these values to tailor the patch to the particular locations of these components in the host PE used. The contents of rbx after this calculation as seen in the debugger is shown in the next figure. In this case, the image base is 0x400000.

Figure 3: Actual image base calculation result in rbx using a position independent code technique: GetPC
Once the image base is stored in rbx, the next instruction is a call, but this is not a real function call. It never returns. It is a shellcode technique to load a pointer to a null terminated string located immediately after the call instruction. The way this works is to abuse how a call instruction operates. This instruction normally copies the value of the instruction pointer to the top of the stack. The instruction pointer in this case contains the address of the next instruction right after the call instruction. This is the return address for that function. When that function returns, the instruction pointer changes to that return address and execution continues from there. However, since this shellcode call abuse technique never returns, it effectively leaves a pointer to the next instruction after the call on the top of the stack where it can be moved or popped for use. And in this case, there is no next instruction, just a null terminated string. The call pushes the return address onto the stack then sets the instruction pointer to the address of the byte immediately following the null terminator of the string, and execution continues from there. The following figure shows these instructions with the pointer to the string "kernel32" being moved to the register rcx which is the location of the first parameter in an x64 fastcall function call. This is a call/mov technique.

Figure 4: Pointer to "kernel32" string "called" onto the stack and readied as a function call parameter.
The above is the first part in constructing an obfuscated execution of the api function GetModuleHandleW. This is the equivalent of making a function call without using the call instruction. Rather, the function call is constructed from other instructions that perform parts of what the call instruction does, and ultimately using jump to execute the imported function. This is a type of anti-analysis and detection evasion. Each prerequisite that a call needs and performs is fabricated in an obfuscated way and combined with a jump instruction to result in the equivalent of a call. The parts are highlighted in the next figure.
In the next figure, in yellow, we see the pointer to the string "kernel32" moved into rcx which is the first parameter of the GetModuleHandleW function. The add and sub instructions are essentially a nop since the second instruction reverses the first.
Then the address of the instruction right after the GetModuleHandleW jump is moved to the top of the stack, becoming the fabricated return address of the function. Since the instruction to execute the api function is a jump, it doesn't put a return address on the stack as part of the instruction. So, this combination of instructions serves that purpose.
Finally, the value of rbx containing the calculated image base from earlier is added to the offset of the import address table entry for GetModuleHandleW in the host PE. This is essentially piggybacking on imports that were resolved for the host PE.

Figure 5: Collection of components which form an obfuscated function call but using a jump instruction for execution.
Interestingly, this is not the only execution of GetModuleHandleW. Because the string passed here is ASCII rather than the wide string required by GetModuleHandleW, this first obfuscated call fails when observed in a debugger. Execution then fails the test rax, rax / jne 0x40158e check and falls through to a second, more standard call/pop sequence that passes a wide "kernel32" string to the same IAT offset. Trying an ASCII string first and falling back to a wide string allows the threat actor to keep the shellcode snippet static across different host PEs, regardless of whether the host imports GetModuleHandleA or GetModuleHandleW, and simply patch in the corresponding IAT offset. This second call is shown in the next figure.

Figure 6: Second call to GetModuleHandle with a wide string "kernel32".
Next to run is an obfuscated execution of GetProcAddress that has the same construction as the first call to GetModuleHandleW. This is shown in the next figure.

Figure 7: Obfuscated call to GetProcAddress
The final instructions in the patch execute an indirect call to VirtualAlloc. If the memory is successfully allocated, the next stage contained in the two BubbleLoader PNGs is copied into the allocated memory. This memory being allocated as executable is suspicious and is a detection opportunity. Finally, execution is passed to the next stage at a specific offset in the second of the two PNGs. These steps are shown in the next figure.

Figure 8: Allocate memory for the next stage in fake PNG and jump to shellcode offset.
The whole entry point patch is fairly small. The following figure shows a diff comparing the benign host PE's original entry point on the left to the patched entry point on the right.

Figure 9: Diff showing original host PE on the left and patched entry point on the right.
The next stage is contained in a pair of PNG files that are added to the host PE along with the entry point patch and the PE header adjustments. The first PNG is a valid PNG, and is a variably sized red to blue gradient image. This PNG is the XOR key used to decrypt the next stage contained in the fake second PNG. A set of three examples of this key PNG are shown in the next figure.

Figure 10: Three examples of the key PNG from different BubbleLoader samples.
The second PNG is not a valid PNG. It has the correct magic bytes at the start of the file followed by an incomplete IHDR chunk. This incomplete chunk is cut off where the width field would have been located. Instead this is where the encrypted next stage data starts. The next figure shows the start of a valid PNG compared to a BubbleLoader fake PNG. The valid width field is highlighted in green. On the left is the fake PNG with the start of the encrypted data highlighted in red. This is where the width field should be and should begin with 0x00 as seen on the right in the next figure, rather than 0x55. For the width to have any data in this most significant byte, the width of the image would be unusually wide for an image embedded as a PE resource. This is a simple check for detecting this invalid PNG.

Figure 11: Comparison of the starting bytes between a BubbleLoader fake PNG and a valid one.
The second stage shellcode is embedded in the fake PNG and it uses a similar technique to the patch to determine the rip value via copying the function return address off the top of the stack. This trick is used because the allocated memory where this shellcode is running can have any base address, so this makes the shellcode position independent. This function, however, doesn't have any anti-analysis instructions. This function is shown in the next figure.

Figure 12: Determine rip value from the function return address.
The return value of that function is stored in rbx where it is used in subsequent rbx relative instructions.
After setting up the offsets of the key PNG and fake PNG, the first action the shellcode executes is to compare the magic bytes of both of these PNGs. If the magic bytes are the same, the outcome of the XOR calculation is zero and then the decryption starts. If the XOR check fails, execution falls through to a last ditch attempt at executing the next stage without decryption. This XOR check is shown in the next figure.

Figure 13: XOR check to determine if both PNGs have identical magic numbers.
The decryption algorithm literally uses the bytes of the first PNG as a rolling XOR key to decrypt the next stage from the fake PNG. There is a set of opaque predicates inserted into the decryption loop for anti-analysis. These jumps always occur. The instruction that they jump over, in, is junk code followed by several bytes of anti-disassembly garbage. In user mode on Windows, executing in immediately raises a privileged-instruction exception. One of these opaque predicates is shown in the next figure. The test that always jumps is highlighted in red, and the junk instruction is highlighted in yellow.

Figure 14: Opaque predicates as anti-analysis inserted into PNG decryption loop.
Once the opaque predicates are patched out, the remaining XOR decryption loop is straightforward after decompilation. The next figure shows the graph of the decryption loop with the XOR block highlighted in red and the execution of the decrypted next stage highlighted in yellow.

Figure 15: Graph representation of the decompiled decryption loop.
When looking closely at the key PNG, we see that the gradient image results in sparse data in the PNG file. The effect of this sparse data with long stretches of null bytes is that the PNG serves as a poor XOR key, as it leaves stretches of the next stage unencrypted. In the next figure, these stretches of null bytes are highlighted in red. The interface between the end of the key and the start of the fake PNG is highlighted in green, and an unencrypted third-stage loader shellcode string is shown in yellow.

Figure 16: Unencrypted third-stage loader shellcode strings due to using a sparse PNG image as XOR key.
Once the XOR decryption using the PNG key is complete, the entry point of the next stage is called. This stage has a check after its prologue that is looking for the saved value of the payload's entry point. The first time this shellcode runs, that location is null. However, during the loading process, the entry point of the payload is recorded in this location. This serves as a reentry guard in case the payload is a DLL and therefore the entry point can be called multiple times. If the check finds the entry point value in this location, the full set of loading steps is skipped. The reentry guard check is shown in the next figure.

Figure 17: Reentry guard check after third stage shellcode prologue.
The presence of a reentry guard in this third stage when the payload of this particular sample is an EXE, not a DLL, shows that this loader is used in more than one context. This is similar to the observation earlier that both the wide and ascii versions of the string “kernel32” were attempted during the first stage entry point patch. BubbleLoader is designed to be used in multiple types of host binaries and to load multiple types of payloads using a single code base.
Next, the image base address is read from the process environment block (PEB). This is another position independent code trick for determining the actual image base to be used with relative offsets to then be able to call or jump to the same import locations and piggy back off the host's import table similar to how the first stage did the same. The next figure shows the PEB access from gs:0x60 highlighted in red and stored in r15 to be used with relative offsets as highlighted in yellow.

Figure 18: Getting and using the image base from the PEB.
Contrast this PEB-sourced image base with the technique used in the first stage patch which was a type of GetPC. The reason this technique needs to be used here is that GetPC determines the address in the allocated memory address space where the PNGs were written to. The relative offset of the host PE's import table cannot be calculated from anywhere in this address space. The PEB however stores the image base of the host PE and that is usable with the relative offset of GetModuleHandleW as shown in the screenshot as 0x326c8. Note that this is the same offset used in the patch to reach the same imported function as shown in figure 6 earlier.
Next, the api addresses of both LoadLibraryA and GetProcAddress are stored for later use in the api resolver function. This is shown in the next figure.

Figure 19: Store LoadLibraryA and GetProcAddress for use in the api resolver function.
Storing those two function pointers bootstraps the api resolver function. Before they are written, the locations contain a placeholder, 0xfafafafafafafafa. The bootstrap overwrites these placeholder immediate values in the instruction right before where the api functions are called. One example of this placeholder as seen in the disassembler is shown in the next figure.

Figure 20: API placeholder immediate value.
In the next figure, those same placeholders have been overwritten as seen in the debugger.

Figure 21: API resolver function as seen in the debugger.
This particular third stage loader shellcode has five functions that it needs to run. But the resolver function is generic and operates on a structured import table of any size that is located in the shellcode. The five functions that it resolves are: ExitProcess, RtlAddFunctionTable, RtlPcToFileHeader, VirtualAlloc, and VirtualProtect.
Next, the loader function is called. The call is to the address immediately after the bytes that comprise the XOR key used in the payload decryption process. This is another example of the call/pop technique that leaves the pointer to the XOR key in a register for later use. The XOR key along with the instructions where the key is used for decryption are shown in the next figure.

Figure 22: XOR key and decryption location in the loader function.
Inside the decryption loop is a very interesting anti-forensics feature. There is a check that searches for compiler padding bytes between functions. When a block of padding of sufficient size is located, the CPU timestamp is read using rdtsc. Then each byte of compiler padding is overwritten with a single byte of randomness from the timestamp except for the very leftmost 0xcc byte which remains untouched. A new timestamp is retrieved for each byte of padding that is overwritten. This two-step process can be seen in the next figure.

Figure 23: Overwriting compiler padding with randomness from the CPU timestamp.
The effect of this loop is runtime polymorphism in whatever payload BubbleLoader is delivering as long as it contains 0xcc padding. Specifically, the hash of the payload binary after the loader is finished will be different every single time BubbleLoader executes. The next figure highlights specifically what the before and after look like in the debugger. The compiler padding is highlighted in red and the last byte of the previous function is highlighted in blue. At the bottom of the figure is how it looks after the write has occurred. The new, random timestamp data is highlighted in green.

Figure 24: Compiler padding before and after runtime polymorphism anti-forensics.
To prevent this change from happening, the anti-forensics loop needs to be patched out. Then the resulting payload will have its original hash value.
Once the payload has been decrypted and the compiler padding modified, the actual PE loader steps are taken. These are each of the standard loader phases including parsing the PE headers, allocating memory for the payload via VirtualAlloc, copying headers using memcpy, walking section headers and copying each section's raw data, performing base relocation fixups, executing any TLS callbacks, resolving imports, and finally setting section protections with VirtualProtect.
However, there are two steps taken by the loader that are more interesting than the standard loader phases. The two imports that were mentioned earlier, RtlPcToFileHeader and RtlAddFunctionTable are components in this phase which has the purpose of setting up proper structured exception handling (SEH) in the reflectively loaded payload. The next figure shows where RtlAddFunctionTable is called followed by changing protection on RtlPcToFileHeader and finally, where the inline hook is installed.

Figure 25: Install inline hook over top of RtlPcToFileHeader in the loaded ntdll.dll image.
The call to RtlAddFunctionTable at the top of the last figure registers the payload's exception directory (.pdata) with the runtime, dividing the directory size by 0xC (12 bytes per RUNTIME_FUNCTION entry) to get the count. Then VirtualProtect is called to allow the address range in ntdll where RtlPcToFileHeader is located to be modified. The actual image base of the payload is then written into the stub. That stub is shown in the next figure. The bytes highlighted in red are overwritten with the payload's actual image base.

Figure 26: Hook stub.
Memcpy is then used to write the stub into the first bytes of RtlPcToFileHeader in ntdll. The result of this hook being installed and the registration of the payload's exception directory is that the loaded image has full exception handling support. SEH is often abused for control flow obfuscation, exception-based anti-analysis, or SEH chains for API unhooking. These malware capabilities in the payload would fail if BubbleLoader did not provide full SEH support in this manner.
Finally, payload execution reads AddressOfEntryPoint from the optional header, adds the loaded image base, saves both the entry point and base address, then calls the entry point with DLL_PROCESS_ATTACH semantics. After it returns, it calls ExitProcess.
To defend against BubbleLoader, organizations should enforce strict application allowlisting and code-signing verification to flag tampered binaries, particularly common third-party utilities like WinRAR whose entry points have been altered. Endpoint detection and response (EDR) platforms should actively alert on suspicious memory allocation behaviors, specifically memory allocated with read-write-execute permissions via VirtualAlloc and runtime memory-protection changes via VirtualProtect aimed at hooking internal ntdll.dll exception-handling routines like RtlPcToFileHeader. Additionally, security teams can deploy static detection rules targeting structural anomalies in embedded image assets, flagging invalid PNGs that truncate IHDR chunk headers to hide shellcode. Finally, because BubbleLoader uses runtime polymorphism to randomize compiler padding bytes with CPU timestamps and alter the payload’s post-unpacking hash, incident responders should pivot toward behavioral memory analysis and entry-point integrity checks rather than relying solely on static payload signatures.
4987af027009d572c26f6d009c5e53e237cb2e3ab9d52094c14dc0b8b6f40b14
3bde84b2ba4c53ace15695770779383ff788d850cea38d21cb0c6d80e650d710
a347e678626686a9bb27120df1e92ce98561f60f0f54e2501bcb4648cc41566a
053066c7764e8c5c35ef3b44e7c51f0cad0d287adab41966d393c78357c1c917
d5c8c4e528c659f6b772e16e0e26529c02faf21e46402ec0e97b25d99f801626
df11dd7bb354f4b020c8e3bd09f7751fc89d0b764519d7ea2bdc2f5e4d3b15be
f88891995c61bb349c772e8864a4d408d5ed605b59b7b7db581a58601f820029
e39a78e433f1704f2f5776ef389ec802beb628350691614bfc581d49842aae56
07784d651f8d049356a98a433eeb08b4168429f1c4a8bc8d0e597381e57249e8
08c98eb05a9b95a4f934ba67310ff670af63fc057c0c53879592b450b8848cfd
8e01f550789617de4605dc5e3288ff51795e88462126dd71ef3ec85f3e318b37
1e61e1842792d3f790820b3b9268edd22e68e0f43eaedfaf1015f6eaf9ef7c2d
ad70a492aef847553f771d6fb717541d11e242a83de63f3c0100de76a5ecdff5
c0974e323cb96b77a98c28f7dbc3f00bf8fe421890b2cbfb11b43a7b64fa6c3b
aa71f94a01b82617fbc44f6d1727c93cfc9d39727c332681f850bcbce96dc2ae
70ece0d830302898af0df01137b4042b6a039d2ef34f77abbac48a9e73f7674a
776e778dfe8c5c19f1433da60b7f9d0de86a84723e9bfc66bb2b2fd0f98f04bf
fd00db1f4e95aea21083a4eaed555091e39ea3c4200ea79bc856b45f1c2ebb3a
d14c71d924e965af4e98ab8f93b7ffbeb561c7fb37d5280f7146a900a7a0da6f
17a34146fef39ec6a403546364249a574f8add6d40dfc09ee30f8ad478226f15
ce86d243904e31d815713351b99e251ce4b415b3df7bb204a9f8b695e9c4b333
184f90da785a868dc1439b0796cc2081efc133040f2c4f79cfcc45acfa50089c
e4b6699c56fe9d3bb1f6492c9c42b0497e546155ac0f81b4994612142f5cb03f
da84d6ea16251c912e9603ab1f642df2b7178d07db053588f7c1f7ab3df8d4c3


As an early participant in Anthropic's Cyber Verification Program, ReversingLabs is helping advance a new approach to AI-powered cyber defense—combining frontier AI capabilities with deep file and software intelligence.

New ReversingLabs data finds that LLM API references in malicious files remain uncommon even as their counts rise. The clearest signals are in specific attack steps—not an autonomous cybercrime takeover.

Updated November 4, 2026: Binance’s disclosed intrusion chain mapped to ATT&CK, the FBI attribution, and what RL data confirms, contradicts or adds.