Posts Tagged ‘ic firmware discover’

PostHeaderIcon Public Channels First: Update Packages and Certification Filings

A recovery engagement usually starts with the device on a bench. It should start with a browser, because a surprising amount of what the bench would establish is already published, and because the published version is free.

This is not a suggestion to avoid the technical work. It is a sequencing rule: the public record determines what the technical work needs to establish, and starting without it means solving problems that have already been solved by someone else.

Source one: the vendor’s update package

Products that can be updated have update files, and update files are distributed.

A firmware file downloaded from a support page is, in many cases, the firmware. It may be compressed, it may be wrapped in a container, and it may be encrypted — but on a large fraction of consumer and industrial products it is a plain image with a header, and extracting it takes minutes.

Package form What is needed to use it
Raw image Nothing
Image with a header Strip the header
Compressed image Decompress
Encrypted container The key, usually in the bootloader

The fourth row is the case in decrypting a firmware update package, and even then the package establishes the container format, which is the harder half of the problem.

Source two: certification filings

Radio equipment must be certified, and certification filings are public. In several jurisdictions the filing includes internal photographs of the device with the shields removed.

The photographs are the single most valuable public artefact in this field. They show the chip markings, the crystal, the connectors, the test points and the antenna. A marking read from a photograph identifies the microcontroller without opening anything, which is the entire content of the identification work described in attacking a custom IC.

Filing element What it yields
Internal photographs Chip markings, layout, test points
User manual Interface behaviour, feature list
Block diagram Architecture, sometimes part numbers
Test report Frequencies, power levels, modes
Schematics, when filed Everything

The last row is rare and decisive. Some filings include schematics, and a schematic converts a reverse engineering problem into a reading problem.

Source three: SDKs and open source

A product built on a vendor’s platform often has a public SDK, and the SDK contains the parts of the firmware that the vendor considered generic: the bootloader, the protocol stack, the drivers.

This is valuable for two reasons. It identifies the components, which tells you what to look for in the image. And it gives you labelled code for the parts that would otherwise be anonymous library blocks, which is exactly the obstacle described in MCU break.

SDK artefact Use
Bootloader source Recognise the bootloader in the image
Protocol stack Identify the state machine
Driver code Identify peripheral initialisation
Build scripts Infer the toolchain and the memory layout

The fourth row is underappreciated. A build script tells you the linker configuration, which tells you the memory layout, which is the answer to the completeness question in extracting MCU firmware.

Source four: teardown communities

A device that has been sold in volume has probably been opened by someone who published photographs.

Teardown sites and forums provide board photographs, chip identifications, connector pinouts and sometimes dumped firmware. The quality varies enormously and the provenance is usually unknown, which matters if the result is going to be used as evidence.

Artefact Reliability Use
Board photographs High Identification
Chip markings High, if legible Identification
Pinouts Medium Probing
Claimed dumps Unknown Cross-check only
Repair procedures Medium Access to test points

The fourth row should never be the primary source. A dump of unknown provenance is useful for cross-checking a read and useless as a deliverable, because it cannot be tied to a device.

Source five: patents and datasheets

The manufacturer’s own documentation is public even when the product is not. A patent describes the method, and a datasheet describes the part.

Document What it gives
Patent The algorithm, in detail, with the constants sometimes included
Application note The reference implementation of the same algorithm
Datasheet The memory map, the protection model, the programming interface
Errata The bugs, and therefore the workarounds visible in the code

The fourth row is the one that saves the most time in analysis. An erratum that says a peripheral must be reinitialised after a specific sequence explains a code pattern that would otherwise look like nonsense, and it explains a difference between two firmware versions that would otherwise look like damage.

Why the order matters

Doing the public work first changes the questions asked of the hardware.

Without it, the hardware work begins with identification, proceeds to the memory map, and then to the interface. With it, identification is done, the memory map is known from the datasheet, and the interface is described in the user manual. The hardware work starts at the point where the public record is silent, which is usually the protection state and the actual contents.

Question Answered by public sources Requires hardware
What chip is it Certification photos, teardowns When unmarked
What is the memory map Datasheet Never
What protocol does it speak User manual, SDK Confirmation
What is the protection state No Always
What is in the memory Sometimes a dump exists Usually

The fourth row is the boundary, and it is worth stating because it is where the engagement actually begins. Everything above it is preparation, and preparation is cheap.

What the service does with this

The first phase of a recovery engagement is a public-source review, and its output is a one-page brief: the part, the memory map, the interface, the container format if a package exists, and the questions that remain.

That brief is what the hardware phase is planned against, and it frequently shortens the work by a week. It also produces something less obvious: a list of what the customer already knew and did not realise was public, which sometimes ends the engagement because the answer was available all along.

Finding Effect on the engagement
Update package is a plain image The work is a download
Certification photo shows the part Identification is done
SDK contains the bootloader Half the analysis is done
Package is encrypted with a key in the bootloader The work narrows to the bootloader

The routes that follow are the extraction in extracting MCU firmware and, where the public record is silent about the protection, the surface analysis in MCU attack surfaces. Where the public record gives a protocol but not the implementation, the next step is protocol reverse engineering.

What we will not do is begin with a decapsulation. Opening a device is irreversible, and it is occasionally done on a product whose firmware was downloadable.