Posts Tagged ‘nvram firmware attack’

PostHeaderIcon Four Reasons to Attack Firmware and the Conflicts Between Them

A request to attack firmware names a technical action and hides a purpose. The purpose determines what evidence is needed, what counts as success, and — most importantly — what must not be done, because the four common purposes are not merely different. They are mutually destructive in specific pairs.

Understanding the conflicts is what allows a single engagement to satisfy more than one purpose, which is what most customers actually need.

The four purposes

Confidentiality is the simplest: obtain the contents so that the customer can see what is in their own product, or in a competitor’s.

Modification means changing behaviour: removing a limit, enabling a feature, fixing a defect that the original vendor will not fix.

Interoperability means making a second product work with the first: a replacement part, an aftermarket accessory, a compatible service. It requires the interface, not necessarily the code.

Forensics means establishing a fact for a dispute, an investigation or a regulatory process. It requires evidence rather than data.

Purpose Deliverable Success is
Confidentiality An image The image is correct
Modification A patched image plus a test The change works, nothing else changed
Interoperability An interface specification A second implementation interoperates
Forensics A report with a chain of custody An independent expert reaches the same conclusion

Conflict one: confidentiality versus modification

These two look compatible and are not, because modification changes the thing that confidentiality is supposed to preserve.

If the image is modified before it is archived, the archive no longer represents the device. If the modification is performed on the device before the image is taken, the image is of the modified device, and the question “what did it originally contain” becomes unanswerable.

The rule is therefore fixed: take the image first, archive it, verify the archive by reading it back, and only then modify anything. The archive is the artefact that satisfies the confidentiality purpose; everything else is downstream of it.

Order Confidence purpose Modification purpose
Archive then modify Satisfied Satisfied, from the archive
Modify then archive Failed Satisfied
Interleaved Both uncertain Both uncertain

Conflict two: modification versus forensics

This is the pair that causes real damage, because the forensic purpose requires the device to remain as it was found and the modification purpose requires it to change.

A forensic engagement needs the device in its original state, the image taken by a documented method, and a record that the device was not altered between the observation and the extraction. Any write to the device — even a read that changes a status bit, even a debug session that leaves a flag — weakens the record.

Action Modification value Forensic damage
Read only None None
Debug session that sets a flag None Small, but must be declared
Chip erase None Total
Write a patch The whole point Total

The third and fourth rows are why a device that might be evidence must never be used as a work unit. Two identical units, one preserved and one used, is the only arrangement that satisfies both purposes, and it requires buying a second unit before starting.

Conflict three: interoperability versus confidentiality

Interoperability can often be achieved without the code at all, and pursuing the code first is a common and expensive error.

An interface can be characterised from outside: drive the inputs, record the outputs, and build a model. That process yields a specification sufficient for a second implementation, and it does not require reading the firmware.

Route to interoperability Requires the image Time Legal exposure
Behavioural characterisation No Weeks Low
Protocol analysis No Days to weeks Low
Firmware read and analysis Yes Days Higher
Firmware read plus disassembly Yes Weeks Higher

The first two rows are frequently sufficient and are always cheaper in exposure. The third row becomes necessary when the interface is complex enough that black-box characterisation would take longer than reading the code, which happens with encrypted protocols and with state machines that have many hidden states.

Why the order is preserve, analyse, modify

The three conflicts resolve into one sequence, and it is the same sequence regardless of which purpose is primary.

Preserve first: read the device, archive the image, verify the archive, document the method, and if the device might be evidence, leave it untouched afterwards.

Analyse second: work on the archive, not on the device. Every question that can be answered from the archive should be, because analysis on the device costs access and sometimes costs state.

Modify last: only after the archive exists and the analysis is complete, and only on a unit that is not the preserved one.

Phase Object Reversible Evidence-safe
Preserve The device, read only Not needed Yes
Analyse The archive Yes Yes
Modify A work unit Yes, from the archive Yes, if a different unit

The sequence is not a suggestion. A modification performed before the archive exists destroys the ability to answer the confidentiality question, and a forensic engagement that begins after a modification has already occurred cannot recover the original state.

What each purpose needs in the report

The four reports differ in what they assert, and using one form for another is where disputes originate.

A confidentiality report asserts that this image is what the device contained. Its evidence is the archive, the read method and the verification.

Purpose Report asserts Weakest point
Confidentiality This is the content Method reliability
Modification This change does X and nothing else Regression coverage
Interoperability This interface behaves thus Coverage of the state space
Forensics This fact is established Chain of custody

The fourth row’s weakest point is procedural rather than technical, and it is the one most often neglected by engineers who are good at the technical part. A forensic conclusion that cannot be traced to an unaltered device is a conclusion that will not survive a challenge.

Where the service fits

We ask for the purpose before quoting, and we ask a second question that follows from it: is there more than one device.

Where there is one device and two purposes, we say which purpose will not be satisfiable and why. Where the purpose is interoperability, we propose the behavioural route first, because it is cheaper and because the firmware route is available afterwards if the first fails. Where the purpose is forensic, the work is documentary from the first minute, and the extraction method is chosen for its defensibility rather than its speed.

The extraction methods themselves are in extracting MCU firmware, and the modification work is in patching IC code. The interface route that avoids reading the firmware altogether is set out in protocol reverse engineering, and the evidence standard for the forensic case is the one in MCU crack acceptance.