Why a 6-byte write can read 512 bytes (animated)
This is finding F2 from the bluetooth scan. One packet, one wrong number, and the phone reads memory it was never sent. Press Play.
what the attacker sends (6 bytes)
the secret the attacker never sent
other memory on the device
The strip is the phone's receive buffer: cells 0..5 are the attacker's 6 bytes,
cells 12.. show a mock secret, everything else is device memory. The exact numbers
(6, 12, 512) are the ones in the vulnerable code: len -= 12 turns a 6-byte
write into a huge length, which is then clamped to 512 before the copy. So the copy pulls
512 bytes instead of 6, and the secret rides along.