text
stringlengths
0
1.99k
Initially, I used LDZX_DSZ64_ASZ64_SC8_DR(TMP1, RDI, 0x08) to read the
first 64-bit value. The testing environment was a 32-bit Windows 10
KVM/QEMU virtual machine. While the backdoored cmps instruction functioned
correctly during the Windows login process, issues arose during the early
boot stage after a system reboot. To resolve this, I switched to using
LDZX_DSZ32_ASZ32_SC1_DR(TMP1, RDI, 0x08) | MOD1, as previously described. A
likely reason for this behavior is that DSZ64/ASZ64 instructions are
incompatible with the real-mode execution environment present during early
boot stages.
The implementation is hardcoded to hook at U3cc8, where the original triad
is copied to be executed before branching to the next triad. This microcode
is specific to the Intel N4200 (family 06, model 92) stepping 10, as CPUs
of the same model with different steppings may have MSROM variations due to
accumulated microcode patches.
--[ 3.4.4 Installing Microcode Backdoors via Coreboot
As introduced earlier, the attack scenario assumes that the CPU vendor
implants a backdoor in the silicon during production. In the context of
microcode, the vendor could either embed malicious microcode in the MSROM
at the factory or distribute a harmful microcode patch to update all CPUs
of the same model. This patch would load every time the system boots,
placing the malicious code in the MSRAM. To validate this concept and
closely emulate the vendor's actions, the most feasible approach is to
embed the backdoor code in the BIOS and patch the microcode during each
system boot.
When Mark Ermolov, Dmitry Sklyarov, and Maxim Goryachy achieved the "Red
Unlock" on an Intel Goldmont microarchitecture CPU, they used a Gigabyte
NUC (model GB-BPCE-3350C) as their test machine. Later, KaKaRoTo continued
this work on a Beelink-M1 NUC[28]. Subsequently, Alexander Krog and
Alexander Skovsende released the lib-micro project, rewriting the exploit
for their own machine, which I believe was an UP Squared Pro N4200.
If you want to replicate this, you will likely need an Intel Silicon View
Technology Closed Chassis Adapter (SVTCCA) to debug the Management Engine
(ME) code. Otherwise, the best option is to find the exact same hardware
and use the existing exploit.
For my setup, I got Red Unlock working using their pre-built firmware.
Although lib-micro's coreboot image did not boot on my UP Squared (Pro)
board, but their exploit worked. As a workaround, I recompiled Coreboot
with extracted modules.
My Coreboot fork, including the CPU backdoor, is available at:
https://github.com/whensungoesdown/coreboot
It also provides a Coreboot pre-built image that enables Red Unlock, loads
the CPU backdoor microcode, and fixes the VGA driver. I tested it on an UP
Squared Pro N4200 (the 4GB RAM/32GB storage version). The coreboot and red
unlock part should work fine on both UPSquared and UPSquared Pro boards,
since there is not much difference between them. That said, if you've got a
UPSquared board, you're probably looking at an N4200 stepping 9 CPU.
Welcome to the 0x0 Bytes Left Club, see section 3.4.5.
The microcode part is unchanged from the previous test project. The
firmware implementation now requires loading this microcode on all CPU
cores. One optimal place appears to be cpu_initialize() in arch/x86/cpu.c,
as this is where coreboot applies the official microcode updates. The
backdoor microcode patch should then be applied afterward.
For simplicity, the CPU backdoor only compromises the CMPS instruction as
previously described. But there is one issue. When attempting to install a
newer version of Windows 10 (22H2, far more recent than the Intel N4200's
release), the installer crashes with a MICROCODE_REVISION_MISMATCH
bluescreen. Nice one, Microsoft.
In contrast, Ubuntu 24.04 silently installs the microcode patch and removes
the backdoor hooks without any warning.
For CPU vendors, this should not be a concern as they control all microcode
updates. For others, there is a solution: hooking the CPUID instruction and
altering the stepping number, tricking the OS into believing the CPU is
much newer, thus avoiding microcode updates.
For example, testing on an older Windows 10 version (2016 release) works
flawlessly: no installation errors, and the backdoor remains intact.
However, altering the stepping number leaves a detectable trace. But
seriously, who pays attention to that?
--[ 3.4.5 The 0x0 Bytes Left Club
During implementation and testing, two Intel N4200 processors were used,
stepping 9 and 10. Clearly, the stepping 9 is an earlier iteration. It uses
all available microcode RAM and takes 28 out of the 32 match/patch
registers, as listed below.
idx p src dst
00: 0 0x0000 0x0000
01: 1 0x1434 0x06c6
02: 1 0x4c04 0x7c0a
03: 1 0x61e6 0x7cae
04: 1 0x757a 0x7cb0
05: 1 0x244a 0x7cdc
06: 1 0x065c 0x7c5c
07: 1 0x29ca 0x7c2e