Cracking Freescale MC9S08DZ60ACLC Locked MCU Memory

Sixty kilobytes of flash, four kilobytes of RAM, two kilobytes of EEPROM and a CAN controller, all inside a 32-pin LQFP. The MC9S08DZ60ACLC is the member of the family that packs the most array into the fewest pins, and that imbalance defines both how the firmware is written and how it can be recovered: with only thirty-two pins, almost everything the device knows about the outside world travels on the bus.

An array that fills the address space

Sixty kilobytes is one hundred and twenty pages of five hundred and twelve bytes, and it occupies the space from 0x1000 to 0xFFFF with the control bytes tucked into the last page. There is no paging on this part, which is a relief during recovery: a dump is a flat image and the addresses in the file are the addresses in the device. The price of that simplicity is that the array cannot grow further without a paging scheme, which is why the larger members of the family read differently.

Where the control bytes are, and why that is a hazard

NVOPT at 0xFFBF and NVPROT at 0xFFBD sit immediately below the vector table at 0xFFC0, in the same page as the application’s interrupt vectors. An update that rewrites the top page therefore rewrites the security setting in the same erase cycle. The firmware has to program the option byte deliberately, and it has to know what value to write: 0xFE leaves the device unsecured with the key enabled, while 0xFF leaves it secured. A bootloader written without that step will lock a device on its second update, and the symptom is a board that worked before it was serviced.

EEPROM as the real payload

Two kilobytes of EEPROM with a sector measured in bytes is where the configuration lives: injector scaling, temperature offsets, odometer-style counters, variant coding. On an automotive node those values are specific to the machine the board came from, and a replacement without them is a working board that behaves like a different machine. Extracting the flash and leaving the EEPROM behind is a half job, and it is the half that customers notice first.

What the bus tells you for free

With thirty-two pins, the CAN port is the only wide interface the device has. Capturing traffic on a live node yields the identifier map, the transmission periods and the payload layout, and it does so without opening anything. That capture is also a check on the firmware version: two boards with different cycle times on the same identifier are running different code, which is useful when a fleet has been serviced unevenly.

Getting the image off a locked device

If the key was left enabled and the application accepts it, the array can be read through the debug interface after the comparison. If the key was disabled, the debug interface will only offer a mass erase, which removes the evidence along with the code. Between those two outcomes there is no third software option, and it is worth saying so plainly to anyone who expects a register sequence to defeat the lock. The physical route is the remaining one, and IC decapsulation service describes it; the reconstruction afterwards is firmware extraction service.

The EEPROM sector in practice

Two kilobytes with a byte-level sector is a different kind of memory from flash, and the difference shows up in how often it is written. A counter that increments every ignition cycle would destroy a five-hundred-and-twelve-byte page within weeks, but it costs almost nothing in EEPROM. That is why the odometer-style values on this part are so often the only record of how the machine was used, and why they are worth reading even when the flash image is already in hand.

Comparison across the family

The same mechanism, with different page counts, appears on the MC9S08DZ32AMLH locked processor flash memory and the MC9S08DZ96CLL microprocessor flash memory, and on the older HC08 parts described in the notes on MC68HC08AZ60 eeprom memory recovery. The constant across all of them is the position of the control bytes: the last sixteen bytes before the vectors. Learn that layout once and the family stops being a set of separate devices.

One practical note on the 32-pin package: the reset and background debug pins are close together and easy to load accidentally with a probe. A capacitor left on the debug line will make a healthy device look unresponsive, which has caused more than one unnecessary decapsulation.


Tags: ,,,