Decrypt PIC24FJ128GA106 Locked MCU Firmware

A battery-test equipment builder asked us to decrypt the locked MCU firmware of its own bench instrument, built on the PIC24FJ128GA106: 128 KB of program flash, 16 KB of SRAM, 64-pin package, up to 16 MIPS. This part belongs to the later GA1 generation rather than the older GA0 family, and the generation shows in two places that matter to recovery: SRAM doubles to 16 KB, and the peripheral set grows to four UARTs and three SPI modules, which multiplies the surfaces a recovery can work with.

Configuration words and the GA1 layout

The two-wire ICSP entry and the configuration-word read ran first, as they do on every part of this family. FBS reported boot segment security in the standard mode: the boot segment returned zeros, the general segment stayed readable. The 128 KB array divided cleanly, and the readable general segment covered the test-engine application, the calibration engine and the communication stack. What the generation changes is not the protection model, which is the same configuration-word scheme, but the traffic around it: four UARTs and remappable pins mean the firmware may place its diagnostic surfaces anywhere, so the PPS registers inside the recovered image, not the schematic, told us where to listen.

The 16 KB SRAM effect on reconstruction

SRAM contents are not recoverable after power cycles, but the 16 KB budget shaped the recovery anyway: the application buffered full calibration sweeps in RAM, and the firmware’s error handler printed a region dump when a self-test failed. Triggering controlled self-test failures produced structured RAM snapshots that documented the sweep format, and that format was the key to interpreting the flash-resident calibration tables. This indirect path, using RAM behaviour to decode flash data regions, appears across families; the partial program-data recovery on an RX62T report and the program data recovered from a GD32F303RI write-up both turn runtime state into the missing decoder for stored data.

The boot region and the verification chain

The protected boot segment verified application images before handing over. Its logic was reconstructed by the observation-matrix method, feeding deliberately varied images and recording accept and reject outcomes until the checksum polynomial and length rules were pinned down. Two bench sessions sufficed, and the reconstruction was validated by generating a synthetic image that the original boot accepted and ran. The same validation standard, making the reconstructed code accept a crafted input, is described in the reverse engineering a chip workflow and was met here on the second attempt.

Instrument-specific verification

The bench instrument’s own acceptance test was the final arbiter: a reflashed unit ran the customer’s calibration verification sequence and matched a reference instrument’s measurements across the range. The delivered package included the verified general-segment image, the reconstructed boot logic, the decoded calibration-table format, and the RAM-snapshot documentation that made the format auditable. Teams working the PIC24FJ128GA106 generation should expect the four-UART surface to shorten the diagnostic phase compared with GA0 parts, and the an STM32F411VET6 and an RX62N network part notes show how a rich communication surface generally translates into a shorter, better-evidenced recovery.

The controlled-failure matrix

Triggering the instrument’s self-test failures deliberately, rather than waiting for organic ones, produced the structured RAM snapshots in a disciplined sequence: each failure class was induced under logged conditions, its snapshot captured, and the class retired. Twenty-two failure classes later, the sweep format was documented with every field traced to its producer in the disassembly. The matrix approach matters because organic failures cluster: real instruments fail in the few ways their usage stresses them, so waiting for failures under-samples the format. Inducing them costs bench time but buys coverage, and the resulting documentation covered failure classes the customer’s service history had never once recorded.

What the four UARTs were actually doing

Mapping the GA1 generation’s four UART surfaces produced a finding the maker had not asked for and immediately valued: one UART, believed unused since an old firmware revision, still carried an active handler that responded to a legacy vendor tool’s handshake. The handler was harmless but undocumented, and its presence explained intermittent traffic the customer’s IT team had blamed on wiring for years. Recovered firmware routinely documents what the vendor’s own records have forgotten, and in security terms the finding cut both ways: a dormant handler is a liability, and this one was disabled in the delivered build’s recommendations before the customer redeployed the units.


Tags: ,,,,,,,,,,,