Intro
Ever wondered how malware conceals itself? Me too! In this one I'm taking apart one of the oldest tricks on Windows, from the textbook version every EDR catches to the "stealthy" version that's supposed to get past them, and showing you what Blackbird sees of both.
Fair warning, this goes deep into Windows internals. Handles and access rights, virtual memory and page protections, the loader, and how a syscall actually reaches the kernel. I'll explain as I go, but if NtWriteVirtualMemory means nothing to you yet, grab a coffee and go slow.
Also, Blackbird is still in alpha. Everything below comes from my own lab builds, so the UI, rule names and detections will probably look a bit different by the time you get your hands on it.
Why does malware do this in the first place? Well, take malicious.exe. We know that's malicious; it probably isn't signed, and we have no idea what it is. But what about brave.exe, or Discord.exe? We know those processes, we trust them. Now what if I told you malware can, quite easily, load itself into those trusted processes?
That's process injection. Commodity loaders, RATs, and the stuff APTs ship all do some version of it, and once the code is running inside something you trust, the process list stops telling you much.
Both samples below come from my Adversary Emulation Suite (AES, and its harder sibling AES-X), run offline in my lab.
The Simple Version
The basic versions of process injection are extremely simple, and therefore easily detectable. Take loading a DLL for example. Malware might follow steps similar to these:
- Open a handle to the target process
- Allocate memory in the target process, often RWX
- Write the path of the DLL it wants to load into that memory
- Create a thread in the remote process
- Point that thread at
LoadLibraryWwith the path, which loads the DLL and runs itsDllMain
This works, assuming you're not crossing an integrity level upwards and have the permissions. It's also very noisy. A high-access handle is an indicator in itself, and an RWX allocation is a big tell. Creating a remote thread seals the detection, and just to be sure, the image-load callback on the module will most definitely give it away.
In Blackbird, catching that is one rule. Open the process, allocate, write (or map), then create a thread (or queue an APC), all against a remote target:

What Blackbird Saw
To see it for real, I ran the loadlibrary_remote_thread case from AES. It does exactly those five steps, injecting a test DLL, bb_unsigned_plugin.dll, from one process (PID 2140) into another (PID 5888).
Blackbird caught every one of them; the handle, the allocation for the path (read/write here, it's only holding a string), the 0x7A-byte write, the new thread 8308 in the target, and the DLL loading on that thread. Then it tied it all together into one finding, REMOTE_THREAD_DLL_INJECTION_CONFIRMED. Easy mode.

Making It Quieter
So, we've covered very simple malware. What about advanced, or dare I say, specialized malware? There's a ton of different ways to perform process injection, but the concept is the same across all of them: get the target process to execute your code. That usually means opening a handle, mapping memory, and creating a thread or queuing an APC. How do we make it less noisy?
Tragically, there's not much you can do about the handle's access rights. Windows needs them to let one process touch another, and the memory alloc and write kind of have to happen too. But the DLL load, usually the biggest IoC, that we can get rid of.
Enter manual mapping. You reimplement a large chunk of the Windows loader yourself (LdrpLoadDllInternal and friends); lay out the sections, apply relocations, resolve imports, set protections. Instead of loading the DLL with LoadLibrary, you reconstruct it in memory yourself, then queue an APC, create a thread, or hijack an existing one to execute it. No image-load event, no entry in the module list. Wipe the PE header afterwards and there's no MZ left to find either.
Against a normal AV or EDR that's a lot stealthier. Against Blackbird, not so much.
Running A Manual Mapper
For this one I ran TheCruZ's Simple Manual Map Injector through AES-X, with its header wipe turned on. Injector-x64.exe (9328) spawns aesx_map_target.exe (5604), maps an inert test DLL into it, and clears the header. 20-second capture, usermode and kernel hooks both on.
02:49:11.649Z ProcessTelemetry creator=9328 process=5604
02:49:11.979Z PE_INJECTION_WRITE actor=9328 target=5604
base=0x267CDD40000 size=0x1000
02:49:12.026Z REMOTE_THREAD_CREATE_NTAPI
actor=9328 target=5604
start=0x267CDD80000 tid=5116
02:49:12.055Z INJECTION_CHAIN_COMPLETE
actor=9328 target=5604
stages=allocate,write,protect,thread
02:49:12.680Z MANUAL_MAP_CONFIRMED_PRIVATE_EXEC_PE
base=0x267CDD40000 size=0x7000
structuralPe=1 preWipeStructuralPe=1
currentHeaderPresent=0
Read it top to bottom. 9328 creates 5604, writes into it, flips the protection, starts thread 5116, and Blackbird joins all of that into one chain: allocate, write, protect, thread.
The screenshots below are from a second run of the same test, so the PIDs are different; Injector-x64 is 1976, aesx_map_target is 2064.

Then the memory. Allocate, write, allocate, flip protection, write again, all from thread 5788 into 2064. The flip at 0x22F838A1000 goes from PAGE_EXECUTE_READWRITE to PAGE_EXECUTE_READ, that's the mapper setting a section's final protection.

And everything Blackbird flagged along the way:

Then the bit I like, MANUAL_MAP_CONFIRMED_PRIVATE_EXEC_PE. A 0x7000-byte private executable region at 0x267CDD40000. preWipeStructuralPe=1, it was a PE when it landed. currentHeaderPresent=0, the header's gone now. The wipe worked fine, Blackbird just saw what was there before it happened.
The write itself came through the kernel lane: NtWriteVirtualMemory, 0x1000 of 0x1000 bytes into the target. Remember that one, it comes back in a second.
You'll notice thread 5116 doesn't start inside the mapped region, it starts on its own page at 0x267CDD80000. Same in the second run, the thread starts at 0x22F838E0000, which is one of those standalone RWX allocations in the list above. That's the injector's loader stub, which is how TheCruZ's mapper works; the stub finishes the job and calls into the DLL. And it did, my lab marker in the test DLL's entry point fired.


I ran two controls through the same set; a normal loader-based DLL load, and a private RW-to-RX region that isn't a PE. Neither tripped the manual-map finding.
OXCART, which reviews the captures, summed it up:
The most important finding is a complete cross-process injection: Injector-x64 (PID 9328) created aesx_map_target (PID 5604), wrote and protected executable memory in it, started a remote thread, and Blackbird confirmed a manually mapped PE with a wiped header in the target.
"But Direct Syscalls!"
But I hear you saying, direct syscalls! Or indirect, stack-spoofing, register clobbering, whatever you wanna do. Yeah, it doesn't matter.
Every one of those is a way around a usermode hook. They change how you get to the kernel, not whether you get there. NtWriteVirtualMemory still has to write into the target, the thread still has to be created, and the memory still has to become executable. Blackbird watches that from the kernel, through the hypervisor, where your stub doesn't get a say.
That's what the kernel-lane write above was. Same for the NtCreateThreadEx in the Inspector, look at the source line: Blackbird Hypervisor, post-syscall, ntoskrnl. It doesn't care if the call came through ntdll, a SysWhispers stub, or a gate you wrote last night. Spoof the stack all you want, the actor and target are on the operation itself.
I ran the syscall families through anyway. SysWhispers2 and SysWhispers3 each made all 64 of their calls under full instrumentation, and Blackbird threw 256 NTDLL_DIRECT_SYSCALL_EXTRACTION hits across the two. A Hell's Gate derivative ran kernel-only, made all 64 calls, and every Nt API call and memory change it made was sitting in the capture.
Same goes for the rule from earlier. Every stage is an Nt operation against a remote target, and none of them care how you got into the kernel.
Conclusion
Here's the thing about injectors; they all have to do the same job. Get a handle, get memory in someone else's process, put code in it, make it executable, make something run it. LoadLibrary, manual mapping, module stomping, APC queuing, thread hijacking, whatever. They're all different ways of doing those five things.
Manual mappers sell themselves on what they skip. No image load, no module list entry, wipe the header and there's no MZ either. All true, and none of it matters when you're watching the five things instead. The header was the easiest part to hide, and it was never the evidence in the first place.
So no, your injector isn't stealthy. It's just quiet in the places nobody worth worrying about was looking.
Also, watch Blackbird.