
Intel Atom 마이크로코드 업데이트를 복호화하고, 복구된 RC4 키로 XuCode를 언패킹하여 하드웨어 보안 연구를 위한 내부 CPU 마이크로코드 구조를 드러냅니다.
모든 정보는 교육 목적으로만 제공됩니다. 이 지침을 따르는 것은 사용자 본인의 책임입니다. 저자나 고용주는 이 페이지에 포함된 정보에 근거하여 행동하거나 행동하지 않은 개인 또는 조직에서 발생하는 직접적 또는 결과적 손해나 손실에 대해 책임을 지지 않습니다.
2020년 초, 우리는 Intel Atom Microcode를 추출할 수 있는 Red Unlock 기법을 발견했습니다. 우리는 마이크로코드의 내부 구조와 x86 명령어 구현을 조사할 수 있었습니다. 또한, 마이크로코드를 보호하는 데 사용되는 마이크로코드 업데이트 형식, 알고리즘 및 암호화 키를 복구했습니다 (RC4 참조).
아니요, 만들 수 없습니다. 무결성 보호를 위한 RSA 서명이 마이크로코드에 포함되어 있기 때문에 복호화만 지원됩니다.
마이크로코드 업데이트 복호화 키는 CPU 세대에 따라 다릅니다. 우리는 Intel Gemini Lake(Goldmont Plus 마이크로아키텍처) 및 Intel Apollo Lake(Goldmont 마이크로아키텍처) 세대의 키를 추출했습니다. 지원 CPU 목록을 참조하세요.
Intel TXE의 취약점을 이용하여 red unlock이라는 문서화되지 않은 디버깅 모드를 활성화하고 CPU에서 직접 마이크로코드 덤프를 추출했습니다. 그 안에서 키와 알고리즘을 찾았습니다.
OffensiveCon22에서 발표한 Chip Red Pill: How We Achived to Execute Arbitrary Microcode Inside Intel Atom CPUs를 참조하세요.
모든 스크립트는 Python으로 작성되었습니다. Python 3 사용을 권장합니다. 스크립트는 pycryptodome 패키지가 필요합니다. pycryptodome를 설치하려면 다음 명령을 실행하세요:
pip3 install pycryptodome
Apollo Lake CPU의 경우 dec_uUpd_Atom_apl.py 스크립트를 실행하세요:
C:\microcode>py -3 dec_uUpd_Atom_apl.py cpu506C9_plat03_ver00000040_2020-02-27_PRD_2FC3D618_.bin
Hash matched at length 0x3E00 (15872)
Data entropy: 6.898306
Gemini Lake CPU의 경우 dec_uUpd_xu_Atom_glp.py 스크립트를 실행하세요:
C:\microcode>py -3 dec_uUpd_xu_Atom_glp.py cpu706A8_plat01_ver00000018_2020-06-09_PRD_1D9A5DFE.bin
Patch hash matched: enc size: 0x3480
Patch data entropy: 6.438890
XuCode hash matched: size: 0xed40
XuCode data entropy: 7.752765
Goldmont Plus CPU의 경우 XuUnp.py 스크립트를 실행하세요:
C:\microcode>py -3 XuUnp.py cpu706A8_plat01_ver00000018_2020-06-09_PRD_1D9A5DFE.bin.xu.dec
Processing cpu706A8_plat01_ver00000018_2020-06-09_PRD_1D9A5DFE.bin.xu.dec
. ELF at 0x28
. Parking: 0xD58+944
. XuRT: 0x16EC+D404
. Decompressing 54276 -> 101448, be patient...
+ Unpacked OK

XuCode는 SGX 기술의 소프트웨어 부분이며, 마이크로코드 업데이트에 통합된 ELF 파일입니다.

참조: XuCode: An Innovative Technology for Implementing Complex Instruction Flows
다음 CPU에 대해 마이크로코드 업데이트를 복호화할 수 있습니다:
| 프로세서 모델 | 마이크로아키텍처 | SGX / XuCode 지원 |
|---|---|---|
| Pentium J4205 | Goldmont, Apollo Lake | - |
| Celeron J3455 | Goldmont, Apollo Lake | - |
| Celeron J3355 | Goldmont, Apollo Lake | - |
| Pentium N4200 | Goldmont, Apollo Lake | - |
| Celeron N3450 | Goldmont, Apollo Lake | - |
| Celeron N3350 | Goldmont, Apollo Lake | - |
| Atom x7 E3940 | Goldmont, Apollo Lake | - |
| Atom x5 E3930 | Goldmont, Apollo Lake | - |
| Atom x7 A3960 | Goldmont, Apollo Lake | - |
| Atom x7 A3950 | Goldmont, Apollo Lake | - |
| Atom x5 A3940 | Goldmont, Apollo Lake | - |
| Atom x5 A3930 | Goldmont, Apollo Lake | - |
| Atom C3958 | Goldmont, Denverton | - |
| Atom C3955 | Goldmont, Denverton | - |
| Atom C3858 | Goldmont, Denverton | - |
| Atom C3850 | Goldmont, Denverton | - |
| Atom C3830 | Goldmont, Denverton | - |
| Atom C3808 | Goldmont, Denverton | - |
| Atom C3758 | Goldmont, Denverton | - |
| Atom C3750 | Goldmont, Denverton | - |
| Atom C3708 | Goldmont, Denverton | - |
| Atom C3558 | Goldmont, Denverton | - |
| Atom C3538 | Goldmont, Denverton | - |
| Atom C3508 | Goldmont, Denverton | - |
| Atom C3338 | Goldmont, Denverton | - |
| Atom C3308 | Goldmont, Denverton | - |
| Pentium Silver J5005 | Goldmont Plus, Gemini Lake | + |
| Celeron J4105 | Goldmont Plus, Gemini Lake | + |
| Celeron J4005 | Goldmont Plus, Gemini Lake | + |
| Pentium Silver N5000 | Goldmont Plus, Gemini Lake | + |
| Celeron N4100 | Goldmont Plus, Gemini Lake | + |
| Celeron N4000 | Goldmont Plus, Gemini Lake | + |
| Pentium Silver N5030 | Goldmont Plus, Gemini Lake Refresh | + |
| Celeron N4120 | Goldmont Plus, Gemini Lake Refresh | + |
| Celeron N4020 | Goldmont Plus, Gemini Lake Refresh | + |
Mark Ermolov (@_markel___)
Maxim Goryachy (@h0t_max)
Dmitry Sklyarov (@_Dmit)