Newshot

Developer makes a single ZIP file serve three purposes: normal extraction, Multiboot, and BIOS booting

AI summary

Developer David Oberhollenzer (known online as Goliath) created a special ZIP file, boot.zip. It can be read and extracted normally by standard archiving software, can also serve as an operating system boot image to start legacy PCs via traditional BIOS, and supports loading by Multiboot-compliant bootloaders such as GRUB and QEMU. Rather than simply placing a boot program inside an archive, Goliath carefully arranged the ZIP file structure so that the same set of bytes satisfies both the archive format and computer boot specifications. The key is exploitable byte overlap between the ZIP file format and x86 processor instructions. ZIP files typically begin with PK and 03 04, followed by header fields such as version, flags, compression method, and modification time. The developer stored the first file, ZIPHEAD.COM, uncompressed and placed the boot code directly in its data area. For Multiboot, the specification requires a valid image to contain the magic number 0x1BADB002 within the first 8 KiB, along with the corresponding flags and checksum. The developer embedded this information in the contents of ZIPHEAD.COM so that Multiboot-compatible loaders such as GRUB and QEMU can recogn

Translation(model translation, not the source's own text)

Developer makes a single ZIP file serve three purposes: supports extraction, Multiboot, and BIOS boot

IT之家, November 17: developer David Oberhollenzer (online alias Goliath) created a special ZIP file, boot.zip.

The file can be read and extracted normally by standard decompression software, can also serve as an operating system boot image to boot legacy PCs compatible with traditional BIOS, and can also be loaded by bootloaders compatible with the Multiboot specification, such as GRUB and QEMU.

Goliath did not simply put a boot program into the archive; instead, by carefully arranging the ZIP file structure, he made the same set of bytes simultaneously satisfy the requirements of the archive file format and computer boot specifications.

The key to achieving this effect is that there is exploitable byte overlap between the ZIP file format and x86 processor instructions. ZIP files usually start with PK and 03 04, followed by file header information such as version number, flag bits, compression method, and modification time. The developer set the first file, ZIPHEAD.COM, to be stored uncompressed and put the boot code directly in its data area.

For Multiboot booting, the specification requires a valid image to contain the magic number 0x1BADB002 within the first 8 KiB, along with the corresponding flags and checksum. The developer embedded this information in the contents of ZIPHEAD.COM so that it can be recognized by Multiboot-compatible loaders such as GRUB and QEMU.

Traditional BIOS booting requires meeting another requirement: the BIOS reads the first 512-byte sector of the disk and checks whether bytes 510 and 511 are 0x55AA. The developer placed this boot signature at the corresponding position in the ZIP file and adjusted fields in the file header so that it both conforms to the ZIP format and can be executed by the processor as x86 instructions.

Among them, the modification time field in the ZIP file header played a key role. The developer used the bytes corresponding to this field to encode an x86 relative jump instruction, so that after the processor executes the content at the beginning of the file, it can skip the ZIP file header and go directly to the subsequent boot code. Fields such as the version number and flag bits were also carefully designed to avoid destructive operations during execution.

The developer also explained the subsequent boot process on his blog: the program first runs in 16-bit real mode, performing processor detection, memory probing, disk parameter reading, and enabling the A20 address line, then loads the remaining contents of the archive, switches to 32-bit protected mode, and jumps to the Multiboot entry point. The entire boot code, together with the related file headers, totals 817 bytes.

In actual testing, David Oberhollenzer said that after writing boot.zip to a floppy disk, he conducted boot tests on legacy PCs such as Pentium MMX, i486 DX2, and Am386DX-40.

After a successful boot, the screen displays the text from the boot / MESSAGE.TXT file inside the archive, proving that the program can not only complete the boot but also read files from its own ZIP archive.

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by IT之家
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗