Firmware implant
MoonBounce UEFI Firmware Implant: Traces and Checks
MoonBounce patched CORE_DXE in a board's SPI flash and ran from memory. What Kaspersky and Binarly reported, why disk checks miss it, and how to check firmware.
- Kind
- Firmware implant · Firmware layer
- Platforms
- Firmware, Windows
- First seen
- 2021
- Status
- In the wild
- Checked by
- None: no module reads its traces
Overview
MoonBounce is a UEFI firmware implant that Kaspersky made public on 20 January 2022. Its code sat inside the CORE_DXE module, the DXE Foundation of a motherboard's firmware, in the SPI flash chip on the board. Nothing of it was on the disk. Kaspersky learned of the compromise at the end of 2021 from the logs of its firmware scanner; the implant had been detected in spring 2021, on a single machine. Kaspersky called it the third publicly reported firmware implant found in the wild, after LoJax and MosaicRegressor.
Kaspersky attributes MoonBounce to APT41, or an actor closely tied to it, with medium to high confidence. The case rests on the ScrambleCross (SideWalk) implant found on other machines of the same network, a loading scheme shared with the clusters known as Earth Baku and SparklingGoblin, and a certificate seen on servers that the FBI had reported as APT41 infrastructure. Kaspersky saw a further, low-confidence link to the Microcin backdoor. Other tools on the network included Mimikat_ssp, which Kaspersky also saw with GhostEmperor (see Demodex).
A day after the report, Binarly compared the infected CORE_DXE with the vendor's original. The module carries the firmware name E7846IMS.M30, which Binarly matched to an MSI firmware image of 2014, and the diff showed no change other than the three hooked services described below. How the flash was written is unknown: Kaspersky assumes remote access, and Binarly lists physical access or SPI flash left without write protection as possibilities. Answering a reader under its report, Kaspersky said the affected machine supported neither Intel Boot Guard nor a TPM.
How it loads and hides
Kaspersky's technical note describes a chain that runs at every boot and never touches a file:
- Firmware. The attackers appended a payload (shellcode plus a Windows driver) to
CORE_DXE, in an unnamed section after.reloc. Inline hooks at the start of three Boot Services,AllocatePool,CreateEventExandExitBootServices, divert execution to it. TheCreateEventExhook also registers a callback on the legacy boot event, so the chain can run when the machine boots through the Compatibility Support Module. - Windows OS loader. When the loader calls
ExitBootServices, the hook patches the end ofOslArchTransferToKernelin the loader's memory image. Thewinload.efifile on the EFI system partition is not changed. - Kernel. That patch then hooks
ExAllocatePoolin the in-memoryntoskrnl.exe. On its first call, shellcode maps the embedded driver into kernel memory and runs it. The driver has no file and no service key. - User mode. The driver registers an image-load callback and, when
kernel32.dllloads into thesvchost.exe -k netsvcsservice host, injects a user-mode stager through an asynchronous procedure call. The stager, an MPRESS-packed DLL, requests a PE from a hard-coded URL and maps it in memory. Kaspersky lists the stager's host asmb.glbaitech[.]comand could not retrieve the next stage.
Kaspersky states that the infection chain "does not leave any traces on the hard drive". Reinstalling Windows or replacing the disk leaves the implant in place, and it rebuilds the chain at the next boot. Secure Boot does not help here: as ESET noted for LoJax, it checks the boot applications the firmware loads, not the firmware's own modules. A hardware root of trust such as Intel Boot Guard is what verifies the firmware image itself.
Traces on disk
There are none from the implant chain. The traces are in the flash chip, in memory and on the network:
| Location | What | Source |
|---|---|---|
SPI flash, DXE Core (CORE_DXE, GUID {5AE3F37E-4EAE-41AE-8240-35465B5E81EB} in Binarly's diff) | Larger than the vendor's module; extra unnamed section after .reloc with shellcode and a driver; 5-byte call hooks at the start of AllocatePool, CreateEventEx, ExitBootServices | Kaspersky technical note, Binarly |
CORE_DXE strings and header | Firmware name E7846IMS.M30; PE time stamp 18 July 2014, the vendor's build | Binarly |
| Memory, OS loader and kernel | Patched end of OslArchTransferToKernel; ExAllocatePool hook, removed after first use; a driver mapped without a file | Kaspersky technical note |
Memory, svchost.exe -k netsvcs | A PE stager mapped without a file | Kaspersky technical note |
| Network | Requests to mb.glbaitech[.]com | Kaspersky |
Kaspersky lists the malicious CORE_DXE as MD5 D94962550B90DDB3F80F62BD96BD9858 (report), SHA-256 74B75B1A1375BA58A51436C02EB94D5ADCD49F284744CF2015E03DA036C2CF1A (technical note). It matches that one image only; the same implant built into another board's firmware would hash differently.
The other malware on the same network did write to disk, and is how most responders would find this intrusion. Kaspersky reports a patched wbemcomn.dll in %SYSTEM%\wbem that loads wmiwk.dll (the StealthVector loader), a service named iscsiwmi whose ServiceDll is %windir%\Microsoft.NET\Framework64\v4.0.30319\System.Mail.Service.dll (StealthMutant), a scheduled task \Microsoft\Windows\UNP\UNPRefreshListTask, and a Microcin configuration file at %WINDIR%\debug\netlogon.cfg. These are covered on windowspersistence.com and windowsforensics.app.
How to check a host
The firmware
The only place to see MoonBounce at rest is a dump of the SPI flash, compared with the vendor's image.
-
Dump the flash from a trusted environment. CHIPSEC can read it:
chipsec_util spi dump rom.bin. On Windows its driver needs driver signature checks turned off (installation guide), so run it from a clean Linux live medium instead of weakening the suspect host. A hardware programmer on the chip avoids trusting the running firmware at all. -
Compare with the vendor's image for the same board and version. Decode both with
chipsec_util decode rom.binor UEFITool and compare the modules, not the whole files: NVRAM, the Management Engine region and serial numbers differ between machines. CHIPSEC can do the module comparison:chipsec_main -i -n -m tools.uefi.scan_image -a generate,efilist.json,vendor.rom chipsec_main -i -n -m tools.uefi.scan_image -a check,efilist.json,rom.binA DXE Core that differs from the vendor's at the same version is a finding by itself: nothing but a firmware update should change it.
-
Check the flash protections.
chipsec_main -m common.bios_wpandchipsec_main -m common.spi_lockreport whether the BIOS region can be written from the operating system; on Linux,fwupdmgr securityshows the same bits and the Boot Guard state. Open protections do not prove an infection, but they mean a write from the OS was possible.
The running system
Firmware code runs before Windows and every security product, so a clean live result proves little. What a live check can add:
Confirm-SecureBootUEFI
Get-CimInstance Win32_BIOS | Select-Object Manufacturer, SMBIOSBIOSVersion, ReleaseDate
Get-Tpm
Get-CimInstance Win32_Process -Filter "Name='svchost.exe'" | Select-Object ProcessId, CommandLine
The BIOS version and date let you fetch the right vendor image. The stager lives in a -k netsvcs service host: a memory image examined with Volatility 3 (vol -f mem.raw windows.malfind --pid <pid>) shows executable private memory holding a PE header, which the memory forensics guide on windowsforensics.app covers. Search DNS and proxy logs for the domain above.
What the checker looks for
None of the checker's modules can see MoonBounce, so checks is empty for this family. The implant lives in SPI flash, which is not a file in any collection, and the rest of the chain exists only in memory.
esp: the Windows boot files on the EFI system partition are untouched; the loader is patched in memory after it is read, so there is nothing for the module to flag.windrivers: the kernel driver has no.sysfile, no service key and no install event. Theiscsiwmiservice of the companion malware is a service DLL, not a driver, and the module lists only driver services.measuredboot: PCR 0 records the platform firmware's executable code (Microsoft). The module lists each log's events, but it does not compare firmware (PCR 0) measurements between boots and holds no vendor reference values; its own note says a firmware implant that does not change the measured boot path leaves no trace in its findings. To compare the PCR 0 events of two saved logs, decode them with a TCG log tool, as in reading Measured Boot logs. Kaspersky's case had no TPM, so no such log existed.bootsector: not involved; MoonBounce does not touch the MBR or VBR.
A clean report from the checker does not clear a host of a firmware implant. See what an offline rootkit check can and cannot prove.
Removal and recovery
- Preserve first. Keep the flash dump and a memory image; they are the only evidence of the implant.
- Reflash the whole BIOS region with the vendor's image, from a trusted environment, then dump the flash again and compare it with the vendor's image to confirm the change took. Kaspersky's guidance is to keep firmware updated and use Boot Guard and a TPM where the hardware supports them; on a board that offers neither, as here, the honest fallback is to replace the motherboard.
- Reinstall Windows. Kernel code ran at every boot, so nothing on the disk can be trusted, even though the implant wrote nothing there.
- Treat the network as compromised. Kaspersky saw
ntdsutilused to dump Active Directory, credential theft with Mimikat_ssp, and PsExec and WMI for lateral movement. Hunt for the StealthVector, StealthMutant and Microcin traces listed above on other machines, and reset domain credentials, including thekrbtgtaccount, once the attacker is out. - Prevent a repeat. Enable BIOS write protection and Boot Guard where the platform supports them, keep firmware current, and keep TPM-backed Measured Boot logs so that a later firmware change at least leaves a record.
Sources
Primary public reports, newest first.
- 2022-01-21A deeper UEFI dive into MoonBounceBinarly
- 2022-01-20MoonBounce: the dark side of UEFI firmwareKaspersky
- 2022-01-20Technical details of MoonBounce's implementationKaspersky
See also
Related families
- CosmicStrandFirmware implant
- LoJaxFirmware implant
- BlackLotusUEFI bootkit