| 1 | # Intel BootGuard bypass on Skylake/Kabylake |
| 2 | |
| 3 | Run `git clone "https://review.coreboot.org/deguard"` to get the deguard source code. |
| 4 | |
| 5 | ## How deguard works |
| 6 | |
| 7 | Deguard makes use of [CVE-2017-5705]. |
| 8 | |
| 9 | This vulnerability has been fixed by Intel in newer ME v11.x.x.x firmware releases, however ME |
| 10 | 11 hardware has no protection against downgrading the ME version by overwriting the SPI flash |
| 11 | physically, thus we can downgrade to a vulnerable version. |
| 12 | |
| 13 | After downgrade, we exploit the bring-up (BUP) module of the vulnerable firmware, overwriting |
| 14 | the copy of field programmable fuses (FPF) stored in SRAM, resulting in the fused BootGuard |
| 15 | configuration being replaced with our desired one (which has Bootguard disabled). |
| 16 | |
| 17 | ## Supported boards |
| 18 | |
| 19 | The list of supported boards can be seen by examining the degaurd repo: |
| 20 | |
| 21 | ls -l data/delta |
| 22 | |
| 23 | If your board is already supported, you can skip to `Generating a deguarded ME image` below. |
| 24 | |
| 25 | If not, then you need to generate the delta data for your board first. |
| 26 | |
| 27 | ## Adding a new board/target |
| 28 | |
| 29 | If your board is not yet supported, you will need to generate the delta data between the default |
| 30 | ME configuration and vendor-provided board-specific ME configuration. |
| 31 | |
| 32 | This data is located in the `data/delta/<target>` directory for each target. |
| 33 | |
| 34 | To generate the delta data, dump the vendor firmware from your board, and execute: |
| 35 | |
| 36 | ./generatedelta.py --input <dump> --output data/delta/<target> |
| 37 | |
| 38 | NOTE: |
| 39 | The delta generation process only takes your factory dump ME firmware as an input. This is |
| 40 | because an ME firmware image contains both the default and system specific configuration, which |
| 41 | are then compared by deguard. |
| 42 | |
| 43 | You *must discard* the `/home/secureboot` directory from the delta for the zero FPF config to work. |
| 44 | |
| 45 | You can optionally also discard `home/{amt,fwupdate,pavp,ptt}` from the delta. |
| 46 | |
| 47 | Please submit delta data for new boards to the deguard repo using the regular Gerrit review |
| 48 | process. |
| 49 | |
| 50 | ## Generating a deguarded ME image |
| 51 | |
| 52 | Once you have the delta data for your board, you will need to obtain a donor image for your |
| 53 | platform variant with a supported/vulnerable ME version (see URLs below). |
| 54 | |
| 55 | This can either be a full image with a flash descriptor or just a bare ME region. |
| 56 | |
| 57 | Afterwards, execute the following command and enjoy: |
| 58 | |
| 59 | ./finalimage.py --delta data/delta/<target> --version <donor version> --pch <H or LP PCH type> --sku <2M or 5M SKU> --fake-fpfs data/fpfs/zero --input <donor> --output <output> |
| 60 | |
| 61 | Example: `./finalimage.py --delta data/delta/thinkpad_t480 --version 11.6.0.1126 --pch LP --sku 2M --fake-fpfs data/fpfs/zero --input me_donor.bin --output me_deguarded.bin` |
| 62 | |
| 63 | NOTE: |
| 64 | The output will be a bare deguard-patched ME region which requires **the HAP bit to be enabled** |
| 65 | in your flash descriptor to work. |
| 66 | |
| 67 | If you do not enable the HAP bit, the deguard-patched ME will not load, and the system will not |
| 68 | boot. |
| 69 | |
| 70 | ## Note on field programmable fuses |
| 71 | |
| 72 | This document recommends faking a set of FPFs that are all zero as a BootGuard bypass strategy. |
| 73 | |
| 74 | This causes the platform to work in legacy mode, and does not require dumping the fuses from the |
| 75 | PCH. |
| 76 | |
| 77 | It is also possible to enable measured mode instead (there is some example FPF data for this). |
| 78 | |
| 79 | Theoretically it is possible to even re-enable BootGuard with a custom private key (with the |
| 80 | caveat that it is obviously insecure against physical access). |
| 81 | |
| 82 | ## Donor images |
| 83 | |
| 84 | This section lists some URLs to recommended and tested donor images. Any image with a supported |
| 85 | firmware version and variant ought to work, but the path of least resistance is for everyone to |
| 86 | use the same images. |
| 87 | |
| 88 | |Version|Variant|SKU|URL|Notes| |
| 89 | |-|-|-|-|-| |
| 90 | |11.6.0.1126|H (Desktop)|2M|[link](https://web.archive.org/web/20230822134231/https://download.asrock.com/BIOS/1151/H110M-DGS(7.30)ROM.zip)|Zipped flash image| |
| 91 | |11.6.0.1126|LP (Laptop)|2M|[link](https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe)|Dell BIOS update (use [Dell_PFS_Extract.py](https://github.com/vuquangtrong/Dell-PFS-BIOS-Assembler/blob/master/Dell_PFS_Extract.py))| |
| 92 | |
| 93 | ## Thanks |
| 94 | |
| 95 | Thanks goes to PT Research and Youness El Alaoui for previous work on exploiting Intel SA 00086. |
| 96 | |
| 97 | - [IntelTXE-PoC](https://github.com/kakaroto/IntelTXE-PoC) |
| 98 | - [MFSUtil](https://github.com/kakaroto/MFSUtil) |
| 99 | |
| 100 | [CVE-2017-5705]: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00086.html |