Commit Graph

5 Commits (ef03cf007f26cb3fa19786de1e095d8ca65fc1dd)

Author SHA1 Message Date
Daniele Lacamera e0f271bfd5 F-4715: bound GPT partition-entry array size before CRC scan in disk_open
disk_open() computed bytes_left = n_part * array_sz from the GPT header and
scanned the whole declared partition-entry array (one disk_read per 512-byte
chunk) to compute its CRC32 *before* comparing against ptable.part_crc. Both
n_part and array_sz are taken verbatim from the GPT header, whose only gate is
a header CRC32 the attacker can freely recompute. A crafted header with e.g.
n_part=0xFFFFFFFF forces ~10^9 disk reads before the mismatch is detected: a
pre-auth denial of service that can trip a watchdog and block boot.

Reject the header when n_part * array_sz exceeds GPT_MAX_PART_ENTRIES (128, the
UEFI default) * GPT_PART_ENTRY_SIZE before entering the scan loop. The bound is
generous enough for any standard table (128 * 128 = 16 KiB) and for the
existing oversized-array test cases, but caps the scan at 64 sectors.

Add a regression test that crafts a header with a valid header CRC and an 8 MB
declared array and asserts disk_open performs no partition-array reads.
2026-06-10 21:01:16 +02:00
Daniele Lacamera dfc7656071 Validate GPT partition array CRC
F/3045
2026-04-29 12:10:02 +02:00
Daniele Lacamera 776378ca78 Preparing release v2.8.0 + update copyright 2026-04-16 13:11:56 +02:00
David Garske 0292da582b Refactor disk.c for generic use. Wired up uSD read for MBR/GPT 2025-12-24 18:31:55 +01:00
David Garske e055585942 Support for Microchip PolarFire SoC (MPFS250) 2025-12-24 18:31:55 +01:00