Voltage glitch campaign
A laboratory tried to bypass a microcontroller's read-out protection (RDP) with voltage glitching. The campaign log is campaign.csv: offset_ns,width_ns,result,response_hex, with one glitch attempt per line. Results: normal, reset, mute and DUMP. Only in the DUMP lines is response_hex = addr (4 bayt, big-endian) | len (1 bayt) | data — the memory fragment that came out when the protection was bypassed.
Problems: because of the glitch, some bytes have a single corrupted bit; some fragments are completely corrupted; in some the data length does not match len; fragments overlap; and unprotected flash (0x08000000, 2 KiB) and uninteresting addresses were also read. The SRAM protected by RDP, 0x20000000..0x20000FFF (4096 bytes), is the image you need.
SRAM structures: KEYS = 'KEYS'(4) | slot(1) | state(1; 1 = active, 0 = revoked) | key(16) | crc32(key) u32 LE. SECB = 'SECB'(4) | key_slot(1) | text_length u16 LE | IV(8) | ct_length u16 LE | ct. SECB: XTEA-CBC (8-byte block, 32 rounds, delta 0x9E3779B9, key of 4 u32 LE, block of 2 u32 LE, PKCS#7), whose key is the matching slot in KEYS. Find the flag inside it: BAYROQ{GLITCH_KAMPANIYA_...}. (Note: the last 16 characters of the flag are lowercase hexadecimal digits.)