Shade Core is a BIOS malware attack technique that bypasses Hypervisor-Based Security (HBS) enforced by arbitrary hypervisors. This technique bypasses HBS by creating a CPU core that escapes hypervisor control on the target system, without tampering with or hooking any components such as the hypervisor or bootloader.
This work is presented at CODE BLUE 2026, and please refer the slides for explanation of the inner workings. This repository contains the stripped PoC code of Shade Core for security purpose. If you require the full source code, please contact us via email (research-feedback@ffri.jp). Once your identity is verified, we will send it to you directly.
- ShadeCoreDxe (DXE driver): Main DXE module which implements Shade Core
- ShadeCoreLoaderApp (UEFI app): This is for ESP infection. Loads ShadeCoreDxe and executes bootmgfw.efi/grubx64.efi afterwards
- Prepare EDK2
- Copy ShadeCorePkg to
edk2/ - Setup
edk2/Conf/target.txtACTIVE_PLATFORM = ShadeCorePkg/ShadeCorePkg.dscTARGET_ARCH = X64TOOL_CHAIN_TAG = GCC5- VS cannot use inline assembly so only GCC is supported
- Modify source code for your test environment
- Fill
SHADE_CORE_PROCESSOR_IDandSHADE_CORE_APIC_ID
- Fill
source edksetup.sh&build=> ShadeCoreDxe.efi & ShadeCoreLoaderApp.efi is created- Run this DXE module (Flash it in SPI flash, include in OROM, infect ESP...)
Note: When executing ShadeCoreDxe.efi before MAT construction (prior to EndOfDxe), the MAT tampering (ModifyMAT()) must be removed from the source code
Note: The sections of ShadeCoreDxe.efi must be aligned on 0x1000-byte boundaries. In addition, the current implementation assumes that only .text and .data sections are present
There are several ways to execute ShadeCore.efi. For research purposes, the following usage using USB stick is recommended.
- Get UEFI Shell binary, rename it to
bootx64.efi, and place it inEFI/BOOT/bootx64.efiin USB stick - Copy ShadeCoreDxe.efi & ShadeCoreLoaderApp.efi to USB root
- Create a folder named
EFILOAD/in USB root because ShadeCoreLoaderApp.efi locates USB partition using this folder name - Insert the USB stick into the PC on which you want to execute Shade Core, boot the system, and open the boot options menu
- Since the boot key differs depending on the system, please look up the correct boot key for the target machine
- Selecting the USB stick as the boot target will start the UEFI Shell
- Specifically,
/EFI/BOOT/bootx64.efion the USB stick is executed, and since a UEFI Shell binary is placed there in this case, the shell is launched
- Specifically,
- In the UEFI Shell, move to the filesystem where ShadeCoreDxe.efi and related files are located, and execute it with
.\ShadeCoreLoaderApp.efi- You can switch filesystems using commands such as
fs0:\, and by runninglsto list the files in the root, you can identify which filesystem corresponds to the USB stick
- You can switch filesystems using commands such as
- ShadeCoreLoaderApp.efi will load ShadeCoreDxe.efi and executes bootmgfw.efi/grubx64.efi afterwards
Shade Core can be activated in one of the following two ways:
- By writing a specific value,
WAKEUP_SHADE_CORE_SIGNAL, to a specific memory address,gShadeCoreStartupSignalBuffer, from a runtime DXE driver or a kernel driver - By operating autonomously without external triggers, where Shade Core performs malicious behavior on its own—for example, assuming that the OS has booted after 3 minutes post-boot and autonomously read/writing to physical memory
In order to execute the runtime DXE module after OS boot, ShadeCoreDxe.efi hooks the UEFI runtime service gRT->SetVariable(), triggering Shade Core–specific tasks only when a write targets the specific variable name MAGIC_VAR_NAME.
Writing to the UEFI variable can be done from userland executable (require admin priv) calling such OS apis like SetFirmwareEnvironmentVariableExA.
If you refer to the presentation materials, you can find a detailed explanation of the mechanism. Here, I will introduce the key events that occur in chronological order to assist you with debugging or reading source code. Operations executed by Shade Core are prefixed with [SC], while those executed on other cores are left unmarked. Important legitimate operations affected by the processing of ShadeCoreDxe.efi are marked with [L] (for "Legitimate"), although they are not part of the ShadeCoreDxe.efi processing itself. While Shade Core is not limited to Windows VBS, the following example focuses on the Windows VBS case for clarity.
- DriverEntry
- Check mutex to ensure ShadeCoreDxe.efi is executed only once
- Create identity map page tables to use in Shade Core
- Create SetVirtualAddressMap event which most runtime DXE modules do
- Hook
gBS->GetMemoryMap,gRT->SetVariable,gBS->ExitBootServices - Initialize ACPI PM Timer (because we want to use a timer equivalent to
gBS->Stall()also during runtime) - Initialize communication buffer between VTL0 and Shade Core
- Modify MADT to hide Shade Core from OS loader
- Find MADT table by
AcpiSdtProtocol->GetAcpiTable - Remove the entry of core with the specified processor ID from MADT
- Install the modified MADT table
- Find MADT table by
- Modify MAT to add ShadeCoreDxe.efi memory attribute information (avoiding EPT violation BSOD)
- Get .text and .data section base address and size for ShadeCoreDxe.efi by LoadedImageProtocol
- Register .text with the attributes
RUNTIME | ROand .data withRUNTIME | XPin the MAT- Since MAT entries must be sorted in ascending order of
PhysicalStart, the descriptor encompassing the entire ShadeCoreDxe.efi is divided, and separate descriptors for the .text and .data memory regions are inserted between them
- Since MAT entries must be sorted in ascending order of
- ExitBootServices Hook (called by
winload.efi!OslFwpKernelSetupPhase1)- Prepare a "scan map" that represents the memory regions of non-BIOS components (OS, hypervisors, ...), which Shade Core uses when read/writing physical memory
- Create SIPI vector and locate it at physical address
gVector - Call original ExitBootServices (Most BIOS will reset APs at this point)
- Send INIT-SIPI-SIPI to Shade Core and let it execute the SIPI vector
- [SC] Start executing the SIPI vector (sipi-vector.nasm) in real mode (16-bit)
- [SC] Load GDT and transition to protected mode (32-bit)
- [SC] Enable paging and transition to long mode (64-bit)
- [SC] Jump to SipiEntry function in Processor.h
- [SC] Set IDT used in the boot time and run either of the followings
- [SC] Poll for gShadeCoreStartupSignalBuffer to have
WAKEUP_SHADE_CORE_SIGNALas value - [SC] Wait for about 3 minutes until the OS boots up
- [SC] Poll for gShadeCoreStartupSignalBuffer to have
- GetMemoryMap Hook (called multiple times by
winload.efi)- Modify the attributes of EFI memory map entry which includes ShadeCoreDxe.efi to
EFI_MEMORY_RUNTIME
- Modify the attributes of EFI memory map entry which includes ShadeCoreDxe.efi to
- SetVirtualAddressMapEvent (called by
winload.efi)- Convert global pointers that contains physical addresses to virtual address
- gShadeCoreStartupSignalBufferVirAddr (VTL0 GPA) corresponds to gShadeCoreStartupSignalBuffer (HPA)
- Convert global pointers that contains physical addresses to virtual address
- [L] winload!OslFwMapRuntimeRanges
- [L] Compare EFI memory map and MAT, and trigger BSOD if the memory type for the same memory region does not match
- [L] OR the attributes from both and save the resulting memory map
- [L] hvix64.exe
- [L] Enters VMX operation by VMXON
- [L] Runtime DXE modules including ShadeCoreDxe.efi are now mapped to VTL0
- [L] Parses the "resulting memory map" created by winload and construct EPT
- [L] vmlaunch ntoskrnl.exe in VTL0
- ntoskrnl.exe executes as usual, but runs with one fewer CPU core
- [SC] About 3 minutes after ExitBootServices, ShadeCore starts executing
ShadeCoreMain()- [SC] Scan physical memory by referencing the scan map of non-BIOS component memory regions prepared by PrepareScanMap()
- [SC] Locate binaries such as securekernel.exe and tamper with them to arbitrarily modify memory belonging to VTL1 or hypervisors
- Execute an .exe file with admin privileges that calls
SetFirmwareEnvironmentVariableExAwithMAGIC_VAR_NAME - ntoskrnl.exe will call
gRT->SetVariable() - SetVariableHook
- Write
WAKEUP_SHADE_CORE_SIGNALto gShadeCoreStartupSignalBufferVirAddr - [SC] ShadeCore starts executing
ShadeCoreMain()- [SC] Scan physical memory by referencing the scan map of non-BIOS component memory regions prepared by PrepareScanMap()
- [SC] Locate binaries such as securekernel.exe and tamper with them to arbitrarily modify memory belonging to VTL1 or hypervisors
- Write
Kazuki Matsuo. © FFRI Security, Inc. 2026
Apache version 2.0