skip to content

A wiper overwrote a disk's first sector: why is the machine dead but the data is not?

level: middleimportance: nice to knowfreq 33%

answer

  1. the map, not the contents
  2. 512 bytes at the front of the disk
  3. four sixteen-byte partition entries
  4. GPT keeps a backup at the end
  5. damage per byte written

basics

~20 s

The first sector of an MBR disk holds boot code and the four-entry partition table — the map, not the contents. Overwrite it and nothing can find or start the volume, while every file cluster is still physically present.

solid answer

~50 s

Availability and data are separable, and destroying availability is far cheaper. On an MBR-partitioned disk, logical sector zero holds 446 bytes of boot code, a 64-byte four-entry partition table and a two-byte signature. Overwrite those 512 bytes and firmware has nothing to hand control to and the operating system has no map of where volumes begin, so the host will not start — yet the file clusters further into the disk are untouched. That is why fleet-wide destruction of this kind completes in seconds across hundreds of hosts: a few kilobytes written at the right offsets takes a machine off the network as effectively as overwriting a terabyte would. It also tells you what the loss actually is. A first-sector-only wipe costs re-imaging time and people; a variant that also overwrites filesystem metadata or streams a pattern across the whole device costs the data itself.

code

text · 14 lines
text
LBA 0 (MBR, 512 B)
  [ 440 B boot code ][ 4 B disk sig ][ 2 B ][ 4 x 16 B partition entries ][ 0x55AA ]
  after the overwrite: all 512 B replaced with a fixed pattern
      -> firmware has nothing to hand control to
      -> the OS enumerates a device with no partitions on it

first partition (e.g. LBA 2048 onward)
  filesystem metadata + every file cluster: UNTOUCHED
  ...

GPT layout, for contrast
  LBA 0  protective MBR
  LBA 1  primary GPT header, entry array follows
  last sectors of the disk: BACKUP header + entry array  <- second copy of the map

go deeper

for a junior

Know that a disk keeps a small map at its front describing where volumes start, and that destroying the map is not the same as destroying the files it points at.

for a middle

Be able to describe the 512-byte MBR layout, name GPT's backup header at the end of the disk, and rank boot code, filesystem metadata and bulk overwrite by what each costs the victim.

for a senior

Turn the observation into an outage estimate: a boot-path-only event costs re-imaging time across the fleet, while metadata destruction costs the information, and the two produce very different answers to how long we are down.

for a principal

Frame the exposure as reach rather than payload: the technique needs raw device writes plus a way to touch every host at once, so removing estate-wide simultaneous reach is what turns a catastrophe into an incident.

## Two different things are being destroyed A destructive payload can attack **the data** or **the machine's ability to start**, and they are not the same target. Confusing them leads to the two classic wrong answers: "the disk was wiped, everything is gone" when almost nothing is gone, and "it still boots from rescue media, so we are fine" when the file contents were shredded. ## What actually lives at the front of a disk On an MBR-partitioned disk, logical block address 0 is 512 bytes laid out as roughly 440 bytes of bootstrap code, a 4-byte disk signature, two null bytes, a 64-byte partition table of four 16-byte entries, and the two-byte `0x55AA` marker. That single sector is the entire map. Each 16-byte entry says where a partition starts and how long it is; without it, the operating system sees a device with no volumes on it, and legacy firmware has no code to jump to. GPT-partitioned disks are laid out differently and, importantly, redundantly: LBA 0 carries a protective MBR, LBA 1 the primary GPT header, the following sectors the partition entry array — and a **backup header and entry array live in the last sectors of the disk**. A payload that only stamps on the front of a GPT disk has destroyed one of two copies of the map. That redundancy is a real difference in outcome between two disks hit by the same code. ## Escalating levels of damage Roughly in increasing order of what it costs the victim: 1. **Boot code and partition table only.** The host will not start. Volumes are unreadable until the map is reconstructed. File contents are entirely intact. 2. **Filesystem metadata.** Overwriting or encrypting the structures that name files and list their clusters — the master file table on NTFS, inode tables and superblocks on ext-family filesystems — leaves the data blocks on the platter with nothing pointing at them. Carving fragments back is possible in principle and is not a plan for a fleet. 3. **Bulk overwrite of the device.** A pattern written across the whole disk. Now the data really is gone, and this is the slow option — which is exactly why a payload that wants an estate down within a minute of triggering does not choose it first. Mature destructive payloads often combine them: trash the boot path so the host is down immediately and cannot be interrupted, and grind through file contents in the background for as long as the host survives. ## Why the operator picks the cheap target A destroyer is buying downtime per second of execution. Writing a few kilobytes at fixed offsets on every reachable host is the highest damage-per-byte operation available, it needs no enumeration of what is valuable, it finishes before anyone can react, and it scales to an estate through whatever push mechanism the operator already has. Data destruction is the expensive follow-on. Reading the damage this way — cheap-first, then grind — also predicts what you will find on hosts that were powered off partway: a broken boot path and a mostly intact filesystem. ## What it means for the victim The loss on a boot-path-only wipe is **time and people**, not information: hundreds of endpoints that each need to be re-imaged, on an estate whose imaging infrastructure may itself be down. That is a materially different conversation from "our data is gone" and it is worth getting right early, because the two produce completely different outage estimates and completely different messages to the people waiting on the systems. The control class that removes what this technique depends on is also different from the one that answers data loss. This technique needs (a) code executing with raw device write access, which on a normal host means administrator or root, and (b) a way to reach every host at once. Take away the second and the payload stops being an estate-wide event even when it works perfectly on one machine. ## The boundary How you reconstruct a partition table, what firmware does before handing over control, and how a boot loader chain is repaired are operating-system topics with their own depth. What belongs here is the adversary's calculation: which structure to hit, in what order, for the most downtime per second of execution — and what each choice predicts about whether the bytes are still there.

  • The same payload ran on an MBR laptop and a GPT server. Why might the outcomes differ?
    GPT stores a backup header and partition entry array in the last sectors of the disk, so a payload that only stamps the front of the device has destroyed one of two copies of the map. An MBR disk has exactly one copy in the first 512 bytes. Same code, different redundancy, materially different recovery cost.
  • Why would a destructive payload hit the boot path before starting on file contents?
    Damage per second. A few kilobytes at fixed offsets takes a host down immediately, needs no decision about what is valuable, and completes before anyone can intervene. Overwriting file data is the slow follow-on, so it runs afterwards for as long as the host stays alive.
  • A host is unbootable after such an event. What can you not conclude?
    That the data is gone. Unbootable means the map or the boot code was destroyed, which is consistent with every file cluster still being present. Equally, a host that still boots from other media is not proof the contents survived, because filesystem metadata may have been shredded independently.

saying these in an interview costs you the question

  • An unbootable host means the data was destroyed
  • Overwriting a disk always means overwriting every sector
  • GPT and MBR disks fail identically under the same payload
  • Destroying availability requires destroying information
  • A rescue boot proves the filesystem is intact

context