security-research icon indicating copy to clipboard operation
security-research copied to clipboard

zentool intro example reboots the system on loading ucode

Open ivan2kh opened this issue 8 months ago • 3 comments

debian:~/zentool$ ./zentool --output template.bin edit --hdr-autorun false --nop all --match all=0 data/cpu00A70F41_ver0A704104_2023-07-13_3C8FAC0D.bin
debian:~/zentool$ ./zentool edit --nop all --match all=0 --hdr-revlow 0xff --match 0=@fpatan --seq 0=7 --insn q0i0="add rax, rax, 0x1337" template.bin
debian:~/zentool$ ./zentool verify template.bin
template.bin: BAD
use `resign` command to adjust the hash of edited files
debian:~/zentool$ ./zentool resign template.bin
debian:~/zentool$ sudo rdmsr -a 0x8b
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
a704104
debian:~/zentool$ sudo ./zentool load --cpu=2 template.bin
old ucode patch on cpu 2: 0xa704104
client_loop: send disconnect: Broken pipe #reboots  here #ssh session terminated

ivan2kh avatar Apr 08 '25 20:04 ivan2kh

@ivan2kh the step by step example worked for me but not the all in one command line example Does it resolve if you put the op into --insn q1i0 instead of --insn q0i0?

jschoen483 avatar Apr 09 '25 16:04 jschoen483

@jschoen483 thanks but it didn't make any difference. It produces the same reboot

ivan2kh avatar Apr 09 '25 18:04 ivan2kh

What CPU did you test this on? Clearing the update (setting all quads to nop and all match register to 0) works on some CPUs but it's entirely possible that on some other models the microcode update contains a patch that makes the system unstable when you remove it. I would instead try to modify an existing update for your CPU and add the custom patch to an unused match register/quad.

matrizzo avatar May 27 '25 08:05 matrizzo