Posts Tagged ‘smartcard flash crack’
Three Physical Routes Into Flash, Ranked by Cost
Three routes reach a flash array when the ordinary interfaces will not. They are not alternatives on a price list; they are ordered by equipment threshold and by whether the device is expected back.
The ordering is stable across device types, which makes it useful as a planning tool: the first route is almost always worth attempting before the second is purchased.
Route one: through a debug or DMA path
The cheapest physical route is the one that is not physical at all. It is a debug or DMA path that the design left available despite the read protection.
The mechanism varies. A debug unit that can perform memory transfers on behalf of the core, a DMA controller that can be programmed to read flash into a buffer that is then transmitted, a peripheral that has bus-master capability — all of them move data without going through the read-protection check, because the check is applied to the read command rather than to every bus transaction.
| Mechanism | Requires | Data path |
|---|---|---|
| Debug memory transfer | A live debug port | Direct to the debugger |
| DMA to a serial peripheral | A way to start a transfer | Through the peripheral |
| Bus-master peripheral | Control of the peripheral | Through the peripheral |
| Core executing a loader | Any code execution | Indirect |
The fourth row is the general case and the most powerful: if any code can be made to run, that code can read the flash, because the core is not subject to the read-protection check that the external interface is.
Route two: fault injection
The second route is to make the device accept a read it would normally refuse, by corrupting the decision rather than by bypassing the check.
The equipment is a glitch rig: a programmable pulse generator, a means of injecting into the supply or the clock, and a trigger. The cost is in the five figures, the duration is weeks, and the device usually survives.
| Parameter | Typical requirement | Why it costs |
|---|---|---|
| Pulse resolution | Sub-nanosecond | Fast electronics |
| Trigger accuracy | A few nanoseconds | Characterisation |
| Fixture | Device-specific | Custom hardware |
| Campaign duration | Weeks | Parameter space |
The fourth row is the one that dominates the schedule. The search space described in glitch attacks as a search problem is thousands of points, and each attempt costs a device reboot.
Route three: reading the array directly
The third route removes the package and reads the array with an instrument. The device does not survive, and the reading must be complete on the first attempt.
The equipment is a decapsulation station, a microscope with a suitable camera, and the analysis software to convert an image into bit values. The duration is weeks to months depending on the array size and the feature size.
| Element | Requirement | Cost driver |
|---|---|---|
| Decapsulation | Wet or plasma, selective | Per device, and skill |
| Imaging | Resolution below the feature size | Optics and camera |
| Positioning | Sub-micron stage | Mechanics |
| Analysis | Bit extraction from the image | Software and time |
The first row is where devices are lost. A decapsulation that goes slightly too far removes the layer that carries the state, and the array becomes unreadable at the same moment it becomes visible.
Ranking by the deciding property
Cost is not the only axis. Two routes may cost the same and differ entirely in whether the customer gets the device back.
| Route | Equipment threshold | Duration | Device survives |
|---|---|---|---|
| Debug or DMA | Existing tools | A day to a week | Yes |
| Fault injection | Five figures | Two to six weeks | Yes, usually |
| Direct array read | Six figures | Four to twelve weeks | No |
The fourth column is the one that decides the route in most real engagements. A customer with one unit of a discontinued product cannot accept a destructive route, and a customer with a failed unit has nothing to lose.
| Customer situation | Acceptable route |
|---|---|
| One working unit, must be returned | Route one, then two |
| One working unit, no return needed | Any route |
| Many units | The cheapest route that works |
| Dead unit, array intact | Route three |
What makes route three fail
The direct read fails for four reasons, and knowing them prevents an expensive attempt.
The array may be covered by a layer that cannot be removed without destroying it: a shield, a conformal coating, or a mould compound that bonds to the passivation.
| Failure cause | Detectable before | Recovery |
|---|---|---|
| Shield or coating | Inspection, X-ray | None |
| Feature size below the optics | Part number and process | Higher magnification |
| Encrypted array | Entropy of any electrical read | None |
| Damaged during decapsulation | No | None |
The third row is the one worth checking first. If the device decrypts in the fetch path, a perfect image of the array yields ciphertext and the whole route is pointless; the test for that is the entropy measurement in instruction-fetch decryption.
Choosing between one and two
Routes one and two are both non-destructive and they are frequently considered together. The choice is made by what the device will accept.
Route one requires an interface that responds. If the device answers a debug request at all, even with a refusal, there is a path to explore.
| Observation | Route indicated |
|---|---|
| Debug port responds | One |
| Debug port silent, device runs | Two |
| Debug port silent, device dead | Three |
| Read command refused, timing varies | Two |
The second row is the common case on a modern protected part: the port is disabled and the device runs normally. That is the situation fault injection exists for, and it is why the technique is worth its cost.
What the service does
We assess the three routes against the specific device and report the cost of each, including the probability of success where it can be estimated.
| Assessment output | Content |
|---|---|
| Route one feasibility | Whether any interface responds |
| Route two feasibility | Whether a glitch window is reachable |
| Route three feasibility | Whether the die can be opened and imaged |
| Recommended route | The cheapest route with a non-trivial success chance |
The recommendation is not always the cheapest. A route with a ten percent success chance and a month of work is more expensive in expectation than the next route up, and the report says so.
The interface assessment that route one depends on is in read MCU code, and the block-level protection that determines whether route one is even needed is in block-level protection. Where route three is the answer and the array turns out to be encrypted, the limit is the one in bus encryption.