Posts Tagged ‘cpld mcu attack’
MCU Attack Surfaces: Five Doors and How to Choose One
A request to attack a microcontroller arrives with an implicit assumption about method, and the assumption is usually wrong. Engineers who work with software assume the debug port. Engineers who have read about fault injection assume a glitch. Engineers who have seen a decapsulation assume the optical route. Each of them is right about one fifth of the time.
The five surfaces are not alternatives to be ranked by preference. They are doors, and only some of them are open on any given part. Which ones are open is decided by where the protection is enforced, which is a property of the design that can be established before any equipment is chosen.
The five surfaces
The debug port is the first and the most productive. It is a documented interface with memory access, register access and core control, and it exists so that the part can be developed. When it is open, everything is open.
The bootloader is the second. It is a ROM or flash routine that accepts an image over a serial interface, and it exists so that the product can be updated in the field. Its permission model is usually narrower than the debug port’s but is frequently weaker in practice, because it was written for convenience rather than for security.
The flash read command is the third. Many parts expose a command that reads the array without any debug session, guarded only by the protection bit. It is the narrowest of the three electrical doors and the easiest to check.
The side channel is the fourth. It does not enter the device; it observes it while the device does something. Its power is that it works even when every door is locked, and its limitation is that it needs a measurement budget that the board may not permit.
The physical route is the fifth. It removes the package and reads the array, or injects a fault into the die. It works when nothing else does and it is the most expensive by a wide margin.
| Surface | Requires | Destructive | Information available |
|---|---|---|---|
| Debug port | An open port | No | Everything |
| Bootloader | A command and a valid image | No | Program memory, sometimes read |
| Flash read command | Protection bit clear | No | Program memory |
| Side channel | A measurable board | No | Function of the secret |
| Physical | Decapsulation | Usually yes | The array |
Where the protection is enforced
The decision tree starts with one question: what does the protection actually do when a prohibited operation is attempted?
If the answer is “the port does not respond”, the protection is at the interface level. The debug port is disabled, the bootloader refuses the command, and the read command returns nothing. On these parts the interface is the boundary, and the question becomes whether the disable is complete — which is where undocumented test modes and boundary scan become relevant, as described in programming port permissions.
If the answer is “the part resets and the array is erased”, the protection is at the erase level. The interface is available, the command is accepted, and the consequence is destruction. That is the coupling described in breaking IC flash, and it means the interface is a door that leads to a shredder.
If the answer is “the operation succeeds but returns wrong data”, the protection is at the data level. Something is intercepting reads and substituting values. This is the most interesting case, because a substitution implies a decision, and a decision implies a branch that a fault can corrupt.
If the answer is “the operation succeeds and returns nothing at all”, the memory may be genuinely absent — a part that ships with the array unpopulated, or a masked part whose contents are not in a readable form.
| Protection response | Enforcement layer | Surface |
|---|---|---|
| No response | Interface | Undocumented interfaces, physical |
| Reset plus erase | Erase | Fault injection or physical |
| Correct-looking wrong data | Data | Fault injection on the branch |
| No data, no error | Absent | None; the contents are elsewhere |
The decision tree in practice
The tree has four steps and each one eliminates surfaces rather than selecting them.
Step one: is the debug port alive? Attach a programmer and see whether the device ID reads. A device that returns an ID has a working debug interface, and the protection is above it. That immediately makes the debug port the first surface to examine, and it costs a minute.
Step two: if the debug port is dead, does the bootloader answer? Many parts have a ROM bootloader that is independent of the debug port and that responds to a synchronisation pattern at power-up. A bootloader that answers has its own permission model, and that model is frequently less strict.
Step three: if neither answers, does the protection erase or refuse? A read command that triggers a mass erase tells you the protection is at the erase layer, and that no electrical route will read the array without also destroying it.
Step four: if the answer to step three is “refuse”, establish whether the refusal is a branch. A refusal that takes a consistent amount of time, and that changes when the input changes, is a branch — and a branch is the target for fault injection.
| Step | Question | If yes | If no |
|---|---|---|---|
| 1 | Debug port responds | Examine its permissions | Step 2 |
| 2 | Bootloader responds | Examine its permissions | Step 3 |
| 3 | Read causes erase | Fault injection or physical | Step 4 |
| 4 | Refusal is a branch | Fault injection | Physical |
Why choosing the surface first is expensive
The failure mode this page exists to prevent is a project that buys the instrument before establishing the door.
A glitch rig costs a five-figure sum and takes weeks to characterise. A decapsulation capability costs more and takes longer. If either is purchased in response to a request rather than in response to a finding, the probability that it is the right tool for that particular part is about one in five, and the remaining four cases consume the budget without producing a result.
The reverse order costs almost nothing. A programmer, a bench supply, a logic analyser and a day of patience establish which of the five surfaces is open on a specific part. That is a few thousand in equipment and it converts an uncertain project into a quoted one.
What each surface costs when it is the right one
Where the debug port is open, the work is hours and the deliverable is a complete image. Where the bootloader is the door, the work is days and the deliverable depends on what the bootloader will read. Where the flash command is the door, the work is minutes.
Where fault injection is the only route, the cost is the characterisation described in glitch attacks as a search problem, which is a week to a month depending on how well the target behaves. Where the physical route is the only one, the cost is set by the package and the process node, and the device usually does not survive; the three routes and their costs are in cracking IC flash.
| Surface | Typical duration | Device survives |
|---|---|---|
| Flash read command | Minutes | Yes |
| Debug port | Hours | Yes |
| Bootloader | Days | Yes |
| Fault injection | Weeks | Yes, usually |
| Physical | Weeks to months | No |
When more than one door is open
A well-designed part often presents several surfaces at once, and the choice between them is made on cost rather than on capability.
A device may have a live debug port, a bootloader that answers, and a flash command that works. All three reach the same array, and the cheapest is the flash command: a few minutes, one programmer, no protocol. The debug port is the fallback if the command is refused, and the bootloader is the fallback if the port is disabled.
The ordering is not a preference. It follows from what each surface costs to use and what each one risks.
| Open surfaces | Use first | Why | Keep as fallback |
|---|---|---|---|
| Flash command plus debug | Flash command | Minutes, no session state | Debug |
| Debug plus bootloader | Debug | Full memory and register access | Bootloader |
| Bootloader only | Bootloader | The only electrical route | None |
| Side channel plus physical | Side channel | Device survives | Physical |
The fourth row is worth thinking about before committing. A side-channel route leaves the device working, which matters when the customer needs it back; the physical route does not, which matters when the side channel’s measurement budget does not close. Deciding in that order means the device is only destroyed after the cheaper route has been tried and failed.
There is one situation where the cheapest surface is the wrong choice: when it is also destructive. A bootloader whose only read path is a command that triggers a mass erase is not a cheap door, it is a shredder with a handle, and the analysis in breaking IC flash applies before it is used.
What the assessment produces
The deliverable at this layer is a surface map for one specific part: which of the five doors is open, what each one would yield, what each would cost, and which one to use.
That map is produced in a day from a programmer, a supply and a logic analyser, and it is the difference between a quote and a guess. Where the map shows more than one open door, we use the cheapest and keep the others as fallbacks. Where it shows none, the honest answer is that the part requires the physical route, and the customer is told before a decapsulation is scheduled.
The one thing this page does not do is rank the surfaces by sophistication. The cheapest open door is always the right one, and a project that uses fault injection where a read command would have worked has wasted a month for the sake of technique.