Archive for the ‘Break IC’ Category

PostHeaderIcon Attack ATmega Embedded Firmware: Lock Bits and Fuse Bits Are Different Locks

The AVR family carries two separate blocks of configuration bits, and both are frequently called fuses in conversation. They are not the same kind of thing, they do not do the same job, and a project that confuses them will choose the wrong approach before any hardware is touched.

One block controls what the device will let you do: whether program memory can be read back, whether the bootloader can write to itself, whether the debug interface stays enabled. The other controls how the device operates: which clock source it uses, how it starts up, whether brown-out detection is active. The first is a lock. The second is a configuration. A device with an awkward configuration is still readable; a device with a lock set is not, no matter how the configuration is set.

The two blocks compared

Property Lock bits Fuse bits
Purpose Access control Operating configuration
Effect on readback Blocks program and data reads None
Effect on execution None Determines clock, startup, brown-out
Reset behaviour Cleared by a chip erase Restored to default by a chip erase
Granularity A small number of modes Individual settings, many combinations

The third row is the one people miss. A device with every lock bit set still runs perfectly; protection does not stop the CPU. Conversely, a device with completely permissive locks and a wrong clock fuse will not run at all, and the resulting “it does not respond” is frequently misdiagnosed as protection.

Why the distinction changes the route

The route depends on which block is responsible for the observed behaviour.

Observation Responsible block Route
Device runs, reads return a fixed pattern Lock bits Physical, or an unlock that erases
Device does not run, does not respond to programming Fuse bits, usually clock Recover the clock, then proceed
Device runs, programming interface refused Lock bits, with debug disabled Physical, or a bootloader path
Device responds, memory reads are empty Already erased Nothing to recover from memory

The second row is where a lot of time is wasted. An AVR whose clock fuses have been set to an external source that is not present on the board will appear dead to a programmer that expects to synchronise with the internal oscillator. The device is not protected; it is waiting for a clock that never arrives. Supplying that clock, or using a programmer that can drive the clock line, restores access without any destructive step.

The lock bit modes

AVR lock bits are not individual booleans. They form a small set of modes, and the mode determines both readback and self-programming.

Mode Program memory readable Bootloader can write Typical use
Unlocked Yes Yes Development
Read protected No Yes, if boot section enabled Production
Read and write protected No No High-assurance production
Reserved or invalid Device dependent Device dependent Should not be used

The second row describes the ordinary production configuration: the code cannot be read out, but a bootloader in the device can still update it. That combination is normal and is often mistaken for a contradiction, since the bootloader has write access and no read access.

The self-programming subtlety

This is the detail that separates the AVR from devices with a simpler lock. The lock affects the device’s ability to read its own program memory, not just an external programmer’s ability to read it. A read-protected part cannot execute a self-read instruction over protected memory.

Operation Unlocked Read protected
External read of program memory Allowed Refused
Device reads its own program memory Allowed Refused
Device writes to program memory via bootloader Allowed Allowed, if boot section enabled
Device reads its own EEPROM Allowed Allowed

The third and fourth rows are what make a bootloader a viable update path on a protected device, and the fourth is why EEPROM is often the one thing that can still be read.

What a protected read returns

The failure mode is worth specifying because it is not uniform across families and programmers.

Behaviour Meaning
All zeros Read refused
All ones Read refused, or blank device
Correct device signature, blank program Protection active; the signature is not protected
Programmer reports a protocol error The device refuses the read command

The third row is the important one for assessment: the signature bytes are readable on a protected device, which means identity can be confirmed even when the code cannot be read.

The route that actually works

Since the lock cannot be removed without a chip erase, and a chip erase destroys the code, the routes that return firmware do not go through the lock.

Route Invasiveness Applies when
Physical readout of the flash array Destructive to the package Always, in principle
Bootloader exploitation None, if a bootloader with read ability exists Rare; most bootloaders do not read
Debug interface, if not disabled None Only if lock bits left it enabled
Side-channel read of the array Non-destructive Depends on the implementation

The fourth row is worth knowing about and is not a general solution: power analysis against a read-protected AVR has been demonstrated, and it depends on details of the implementation that vary by family and by firmware.

Where the adjacent problems are

Once the array is out, several AVR-specific issues follow. The word and byte addressing difference is treated in attacking ATmega firmware, and the fact that flash, EEPROM and configuration are three separate devices is in attacking ATmega AVR programs. Where a bootloader exists and remains enabled, it is worth considering as an entry point, and attacking ATmega embedded firmware through the bootloader covers that path. The historical evolution of protection on this family, from unprotectable mask ROMs to lock bits, is traced under AVR crack.

Services at this boundary

Work covers fuse and lock state determination, clock recovery on devices that appear dead, signature confirmation, physical readout where protection is active, and image validation. It does not cover clearing a read lock while keeping the program, because a chip erase is the only primitive that clears it.

The first question to ask about a non-responsive AVR is not whether it is protected but which fuse set the clock, because a device waiting for a missing clock looks exactly like a protected one.

PostHeaderIcon Microcontroller Break Categories: Choosing Between Invasive and Non-Invasive Methods

Every route into a protected microcontroller belongs to one of a small number of families, and choosing between them is rarely about which technique is cleverest. It is about what you are willing to lose. The published families of microcontroller break categories work as a sorting mechanism: given a part on the bench, which family applies, what does it cost in terms of the original device, and what state you reach when the attempt ends.

Where the line falls between families in microcontroller break categories

The attack literature groups physical attacks on an integrated circuit into three handling classes: invasive, semi-invasive and non-invasive. The class is decided by how much of the package a technique must remove. Inside the invasive class sit microprobing and structural reverse engineering.

A semi-invasive attack reaches the silicon without drilling through the package; a non-invasive one never opens it. That distinction is the heart of an invasive and non-invasive microcontroller break, because it decides whether the part survives the attempt.

Microprobing versus reverse engineering: two depths of the same commitment

Microprobing works on the chip surface, so once the package is opened the operator can observe, manipulate and interfere with the integrated circuit directly. Structural reverse engineering reproduces the internal structure of the semiconductor so that its functionality can be learned or emulated.

They are different depths of the same decision. Microprobing asks what is happening on a bus at this instant; reverse engineering asks how the machine was built, and it typically costs weeks in a dedicated laboratory. The MCU reverse engineering process and the die work after package decapsulation are worth reading first.

microcontroller break

microcontroller break

Software break and eavesdropping on supply and interface lines

Non-invasive techniques leave the package physically intact. A software attack uses the processor’s own communication interface and looks for a weakness in a protocol, in a cryptographic primitive, or in the way one is implemented. The attack surface is wherever the device already talks.

Eavesdropping takes the opposite approach to the same interface. It observes the analogue behaviour of the supply and interface lines and the electromagnetic radiation emitted while the device runs normally. Power traces are the classical target for differential and correlation analysis, and the same traces are what power glitch work perturbs.

Fault generation on a processor and the semi-invasive boundary

Fault generation deliberately creates abnormal environmental conditions so the processor misbehaves in a way that opens access to its internal state. On a modern microcontroller it is normally a voltage glitch, a clock glitch or an electromagnetic pulse, because instruction timing is what such a fault perturbs.

The borderline status of this family is not academic. A fault attack that needs the die exposed but does not penetrate it sits between the two classes: light or radiation reaches the silicon while the package stays intact. That makes a semi-invasive microcontroller attack its own category, because the part may still be returned to service.

Optical and laser fault injection need the exposed die, fixing them in the semi-invasive family, while front-side work is limited by the metal stack, so backside near-infrared illumination is higher-precision.

Scoring a target against the five families

Before committing, score the part against the five families. The columns are arranged for a decision, not a procedure: what you must touch, whether the part survives, and what you can reach. The middle column is most often misjudged, since a part can survive a fault campaign and still be unusable.

Family What you touch Does the part survive What you can reach
Microprobing Die surface after the package is opened No Internal pads and bus lines
Reverse engineering Full die structure No Complete logic and memory layout
Software attack The existing communication interface Yes Whatever the interface exposes
Eavesdropping Supply and interface waveforms, emitted radiation Yes Secrets in the data path
Fault generation Supply, clock, or an exposed die Usually State the protection would hide

Triage before commitment: what each family costs

The most valuable triage question in the whole taxonomy is simple: if the device still answers a serial interface, do not open it. A non-invasive approach that succeeds preserves the part, its readout path and the firmware.

Practitioners move up the taxonomy when non-invasive work stops paying, usually because of countermeasures rather than impatience. Clock and voltage supervision, glitch filtering, redundant execution paths and active tamper sensors make the non-invasive families expensive on modern silicon, and the locked state described for the ATmega328P fuse and lock bytes shows protection that pushes work sideways.

The taxonomy of microcontroller break categories is a decision aid, not a ranking of techniques. Sort the part, state what must be sacrificed to answer the question, and prefer the family that leaves the device working. Where evidence points to a part that must be opened, our engineers handle decapsulation and die-level readout on customer-owned silicon so the irreversible call is informed.

PostHeaderIcon Attack ATmega Firmware: The Word/Byte Trap in Intel HEX

A recovered AVR image is a file of bytes. The AVR’s program counter counts words. Between those two facts sits a conversion that every toolchain performs, most of them correctly, and a few of them in a way that produces an image which looks right and is displaced by a factor of two.

This is not an obscure edge case. It is the single most common format error in AVR work, and it is invisible until the disassembly starts at the wrong place or the vector table points into the middle of an instruction.

The two addressing schemes

Context Unit Example
Program counter Words, each 16 bits A jump to word address 0x100
Instruction encoding Words Two bytes per instruction, four for some
Byte-oriented access Bytes Load from program memory reads a byte
Intel HEX records Bytes A record’s address is a byte address
Debug symbols Words, usually Function addresses in a map file

The second row is why the factor of two exists at all: an AVR instruction is 16 bits wide in the base encoding, so a program counter value multiplied by two gives the byte offset. A jump to word 0x100 lands at byte 0x200.

Where the conversion happens

The conversion is performed by whatever tool moves data between the device and the file. There are four such points, and each is a chance to get it wrong.

Boundary Tool Failure mode
Device to programmer Programming protocol Raw read in words interpreted as bytes
Programmer to file Format writer Address field written in words
File to loader Format parser Address field read as words
Loader to device Programming protocol Double conversion, net no change

The fourth row describes a failure that cancels itself and is therefore harmless. The second and third rows are the dangerous ones, because each produces a file or a load that is wrong on its own.

How the error presents

A factor-of-two error is easy to recognise once it is suspected, and almost impossible to see otherwise.

Symptom Explanation
Disassembly is full of invalid opcodes Started at the wrong byte offset
Disassembly is valid but the program does not match behaviour Reading the right bytes at the wrong interpretation
Vector table entries point into the middle of instructions Vectors are word addresses, file is bytes
The first instruction is at 0x0000 but the reset jump lands oddly A doubled or halved vector
File length is exactly half the device size Word count written as byte count

The fifth row is the giveaway in practice. A device with 32 kilobytes of flash produces a file of 32 kilobytes. A file of 16 kilobytes from that device is either half-empty or wrong.

The vector table as a detector

The interrupt vector table is the best available check, because its structure is fixed and its content is meaningful.

Observation Conclusion
First word is a jump or a jump-to-self Consistent with a valid image
Vectors are evenly spaced by two bytes The spacing matches word-addressed vectors in bytes
Vectors are evenly spaced by four bytes Either a device with two-word vectors, or a doubled image
Vector targets point at instruction boundaries Correct alignment
Vector targets point at odd offsets Alignment error

The second and third rows are the key comparison. On a device whose vectors are one word apart, the byte spacing in the file is two; if it reads four, the image has been doubled somewhere.

Why the trap is specific to this family

Other architectures do not have this problem, and the reason is instructive.

Architecture Program memory unit Same trap
AVR 16-bit words Yes
PIC mid-range 14-bit words, byte-addressed files Yes, with a different factor
ARM Cortex-M Bytes No
8051 Bytes No
Most DSPs Words, with separate spaces Yes, and worse

The second row is worth noting because it produces the same class of error with a different ratio: a 14-bit instruction does not map cleanly onto bytes, and the packing convention is a property of the file format rather than of the architecture.

Recovering from a doubled image

If the error is suspected, the correction is mechanical and verifiable.

Step Check
Halve or double all addresses Does the vector table align
Re-run the length check against the device size Does the file fit
Disassemble from the corrected base Are opcodes valid
Compare the vector targets against the entry point Do they agree

The third step is the confirmation. An AVR disassembly of a correct image contains a high proportion of recognisable instructions and no long runs of undefined opcodes. A wrong offset produces the opposite.

The other half of the image

Correcting the addressing does not make the image complete. Program memory is only one of the three storage areas on the device, and the other two are separate.

Area Part of the program image Read separately
Flash Yes No, same read
EEPROM No Yes, different command
Fuse and lock bytes No Yes, different command

The distinction is treated in attacking ATmega AVR programs, and it matters here because a corrected program image still leaves the device’s calibration and configuration unaccounted for.

Where the rest of the chain is

The two configuration blocks and what each one locks are covered in attacking ATmega embedded firmware, and the identity check that should accompany any image is in reading Atmel AVR firmware. Both are worth doing before the addressing question, because they establish what device the image came from.

Services at this boundary

Work covers readout with explicit addressing conventions, offset error detection and correction, vector table validation, disassembly sanity checking, and recording of the convention used in the deliverable. It does not cover recovering an image that was written with the wrong convention and then partially overwritten, because the ambiguity is no longer resolvable from the file.

The practical rule is that every AVR deliverable should state whether its addresses are words or bytes, because the file itself does not.

PostHeaderIcon Attack ATmega AVR Program: Flash, EEPROM and Fuses Are Three Devices

A microcontroller that presents three separate non-volatile memories inside one package is a convenience for the designer and a trap for anyone recovering it. The three areas have different access commands, different lifetimes, different failure mechanisms, and different relationships to the protection bits. Treating them as one storage area produces a deliverable that is complete by one measure and missing the point by another.

The three are program flash, data EEPROM, and the configuration bytes that hold fuses, lock bits and calibration. Each is addressed differently, each can be locked differently, and each carries something the others do not.

The three areas

Area Typical size Written by Lifetime
Program flash Tens to hundreds of kilobytes Programmer, or bootloader Around ten thousand cycles
Data EEPROM Hundreds of bytes to a few kilobytes Application, at run time Around a hundred thousand cycles
Configuration bytes A handful of bytes Programmer only Hundreds of cycles, if that

The second row is the one that matters for recovery. The EEPROM is written by the application during normal operation, which means it contains state: serial numbers, calibration results, usage counters, user settings, and sometimes a copy of a key. None of that is in the flash image.

What lives in the EEPROM

Content Why it is there rather than in flash
Serial number or MAC address Written once at production, read at boot
Calibration offsets Measured per unit on the production line
Usage counters Must survive firmware updates
User settings Changed at run time
Crash or state logs Written during operation
Key material Occasionally, stored where the firmware can reach it

The second row is the most consequential on a clone. A device whose firmware is perfectly copied and whose calibration offsets are missing will run and produce wrong measurements, and the error will look like a hardware fault.

Why the areas lock independently

The lock bits on these devices do not protect all three areas identically, and the difference is a real feature rather than an oversight.

Lock state Flash EEPROM Configuration
Unlocked Readable Readable Readable
Read protected Not readable Readable Readable
Read and write protected Not readable Not readable Readable
Bootloader locked Readable via bootloader Depending on bits Depending on bits

The second row is the important one, and it is why EEPROM data is frequently recoverable from a device whose program memory is not. That inverts the usual assumption that the smaller memory is less accessible.

The calibration byte

Some AVR devices store a factory calibration value in a dedicated location, programmed during test and used to trim an internal oscillator. It is not part of the program and not part of the user EEPROM.

Location Content Consequence of losing it
Signature row Device identification Cannot confirm identity
Calibration row Oscillator trim Internal oscillator runs off-frequency
User signature Sometimes a serial Traceability lost
Fuse bytes Configuration Device may not start

The second row produces a specific and confusing symptom: a device with a copied program that communicates at the wrong baud rate. The UART is fine, the clock is slightly wrong, and the firmware is doing exactly what it was told with a clock that is not what it assumes.

Reading all three

The complete read is a sequence, and the order is chosen so that a failure partway through still leaves something usable.

Order Area Reason for the order
1 Signature Confirms the device before anything else
2 Configuration bytes Records the state that governs access
3 Program flash The largest area and the most likely to be blocked
4 EEPROM Often readable even when flash is not
5 Calibration Small, and decisive for behaviour

The fourth row is the one worth remembering when a device is protected: attempt it anyway, because the protection may not extend that far.

Reconstructing a device from three parts

A working clone needs all three, and the assembly is not a concatenation.

Component Where it goes If omitted
Program image Flash Nothing runs
Configuration Fuse and lock bytes Device may not start, or starts wrong
EEPROM contents Data area Runs, produces wrong results
Calibration Its own row Timing and measurement errors

The third row is the one that gets omitted in practice, because the flash read is the visible part of the job and the EEPROM read is a separate command that somebody has to remember to issue.

When an area cannot be read

Each area has its own obstacle, and each obstacle has its own answer.

Area blocked Obstacle Route
Flash Read lock Physical readout
EEPROM Read and write lock Physical, or infer from the application
Configuration Not readable on some devices Infer from behaviour
Calibration Not user accessible Measure the oscillator, or accept a default

The fourth row has a pragmatic answer that is worth knowing: the calibration value can be replaced by measuring the actual oscillator frequency and computing a suitable trim, which is what a production line does. It is a recalibration rather than a recovery.

Where this connects

The distinction between the two configuration blocks, and which of them is a lock, is in attacking ATmega embedded firmware. The byte and word addressing difference that affects the flash image is in attacking ATmega firmware. Where the EEPROM is the specific target, extracting AVR software data treats it as the separate device it is.

Services at this boundary

Work covers all three areas plus calibration, signature confirmation, assembly of the areas into a reprogrammable set, and recalibration where the factory value is unavailable. It does not cover reading an area that is locked with no physical route, and it does not cover reconstructing EEPROM contents that were written at run time and have since changed.

The framing worth using is that an AVR is three memories in one package, and a request to “read the chip” should always be answered with a question about which ones.

PostHeaderIcon Attack ATmega Embedded Firmware: The Bootloader Is Also a Door

A locked AVR is usually described as inaccessible. That is true of the program array and false of the device. The lock bits are designed to coexist with field firmware updates, which means the bootloader keeps write access to program memory even when the array cannot be read. That write access is an interface, and an interface can be examined.

The examination is worth doing before any physical step, because it costs a serial connection and an afternoon. What it yields depends on what the bootloader implements, and bootloaders vary enormously.

Why a bootloader exists on a locked device

The combination sounds contradictory and is not. A production device needs to be unreadable and updatable. The lock bits provide both: they block readback, and they leave the boot section able to write.

Requirement Mechanism
Firmware cannot be extracted Read lock
Firmware can still be updated Bootloader write access
Bootloader cannot be replaced Boot section lock bits
Update cannot be replayed by an attacker Application-level signature

The third row is a separate lock from the read lock, and it is frequently not set. A device with a read lock and an unprotected boot section has a writable, executable region that the application does not control.

What the bootloader exposes

The surface is small and varies by implementation.

Feature Common in Value to an assessment
Write page Almost all Can replace the application
Read page Rare Would read the array back
Verify page Some Compares, and leaks information through timing
Read configuration Common Confirms fuse and lock state
Write configuration Some Could clear locks, at the cost of an erase
Jump to application All Normal exit

The second row is the one that would end the project favourably, and it is rare precisely because it defeats the lock. When it exists, it is usually because the bootloader was written for a product that needed backup and restore, and the read command was left enabled.

The third row is the interesting one. A verify command compares supplied data against the array and reports whether it matches. That is not a read, but it is an oracle: an attacker who can test candidate bytes learns the contents one guess at a time. Exploiting it is slow and it works.

Finding the entry condition

A bootloader activates under a specific condition, and the condition is the first thing to establish.

Entry condition How to trigger
A pin held at a level during reset Pull the pin
A specific byte in EEPROM Requires EEPROM write access
A command received within a timeout Send it quickly after reset
A jump instruction in the application Requires application cooperation
An empty application Erase, then the bootloader waits

The fifth row is a design pattern worth knowing: a bootloader that waits indefinitely when the application area is blank. On such a device, a partially failed update leaves the bootloader permanently available.

What can be done with write access

Write access alone does not reveal the firmware, but it changes what is possible.

Capability Consequence
Replace the application A custom program can run on the device
Run code in the boot section’s context Access to whatever the bootloader can reach
Read EEPROM from a custom program If the lock permits
Read configuration from a custom program Usually permitted
Read flash from a custom program Blocked by the same lock

The second and fifth rows together define the limit. A custom program running on the device is subject to the same read restriction as the original firmware, so it cannot simply read the array. What it can do is everything else: characterise the device, read the EEPROM, dump the configuration, and observe the pins.

The extraction that write access enables

There is one technique that combines write access with the lock’s own behaviour, and it is worth understanding because it explains some results that otherwise seem impossible.

Approach Mechanism Side effect
Page-by-page overwrite and observe Write a page, observe the response Destroys the page
Exploit a verify oracle Test candidate contents Slow, non-destructive
Use the bootloader to load a reader Reader is subject to the lock Limited
Fault the lock check during boot Skip the read restriction Requires equipment

The fourth row is the general answer on many parts and it is not a bootloader technique at all; it is a fault injection against the check that enforces the lock. It belongs here only because the bootloader is often the code whose check is targeted.

When the bootloader is the whole story

On some products the bootloader is not a small update utility but a substantial program with its own protocol, its own state machine, and its own bugs.

Bootloader size Implication
A few hundred bytes Simple write-and-jump; little to exploit
A few kilobytes Protocol handling; worth examining for parsing errors
Tens of kilobytes Effectively an operating system; the interesting code

The third row changes the assessment completely, because a large bootloader may contain more functionality than the application, and its bugs are reachable without any lock being touched.

Where the rest of the picture is

The two configuration blocks, and which of them governs readback, are covered in attacking ATmega embedded firmware. What the EEPROM holds, and why it is often readable when flash is not, is in attacking ATmega AVR programs. The image that eventually comes out still needs its addressing convention resolved, which is the subject of attacking ATmega firmware.

Services at this boundary

Work covers bootloader identification and entry-condition discovery, protocol analysis, assessment of verify or read commands, custom program development for on-device characterisation, and EEPROM and configuration recovery through the bootloader path. It does not cover reading a locked array through a bootloader that respects the lock, because that is what the lock is for.

The practical point is that a locked device is not a closed device. It is a device with a narrow open interface, and the first question is what that interface will do.

PostHeaderIcon Attack DSP Encrypt Code: Where the Key Actually Sits

Digital signal processors sit in an awkward position on the protection spectrum. They are general-purpose enough to need real code protection, and specialised enough that the vendors implemented it as an on-chip module rather than as a fuse. The result is a family of mechanisms that are more sophisticated than a microcontroller’s lock bit and, in several cases, considerably more interesting to attack because the secret has a physical address.

Two architectures dominate. In the first, a code security module gates access to a region of memory and unlocks when a password is presented. In the second, the device boots in a secure mode and refuses to release the CPU until it has validated an image against a key. They fail differently and they are attacked differently.

Architecture one: the password in flash

The best-known example is the code security module on Texas Instruments’ C2000 family. A 128-bit password occupies a specific, documented range at the top of the flash address space, and the module gates read access to the rest of the flash, to RAM and to several peripherals until the password is written to the unlock registers.

Property Value
Password width 128 bits, eight 16-bit words
Location The highest eight words of flash
Default state All ones on a blank device, which means unlocked
Effect of a wrong password The module locks until reset
Effect of an erase Password and protected contents are both erased

The third row is the design detail that makes this mechanism interesting. A blank device has an all-ones password, and writing all ones to the unlock registers matches it, so a device that has never been programmed is accessible by default. That is correct behaviour and it occasionally confuses people who expect a blank part to be locked.

The fifth row is the same veto described throughout this site: the mechanism that clears the password clears the code. A full erase is not a way in; it is a way to end the conversation.

Why the password is findable

The password has to be available to the firmware, because the firmware has to unlock the module after every reset. If the application is a standalone controller with no external input, the password must be stored in the image, or derived from something stored in the image.

Where it can be How it appears in the image
In flash, outside the protected region A 128-bit constant with no code-like structure
Computed from constants in flash A short routine combining several immediates
Supplied by an external device at boot An SPI or I2C read early in the init sequence
Fixed for all units The same value across several samples

The first row is the common case, and it means the password is often recoverable from a read of the unprotected region alone — no decapsulation required. If any part of the flash is readable while the module is locked, and the password is stored there, the protection is defeated by reading the boot code.

The fourth row is a design weakness worth flagging to customers: a password identical across all units protects against a casual read of one device and nothing else, because one recovery covers the entire production run.

Architecture two: secure boot

The second architecture moves the check earlier. Before the CPU is released, a boot ROM validates the image against a key or a digest, and a failure leaves the device in a terminal state.

Element Where it lives Attack surface
Boot ROM validation code Mask ROM, unreadable Its behaviour, not its contents
Key or digest OTP, or flash, or derived Readable only if not protected
Image header At a fixed offset in the image Modifiable if the check is weak
Failure action Reset loop or brick Side channels during the loop

The first row is the important one. Mask ROM cannot be read and cannot be changed, so the validation logic is not attackable in the usual sense. What is attackable is the comparison: if the digest is stored in readable flash and the comparison is symmetric, a fault injected at the comparison can turn a mismatch into a match.

Side channels and why they matter here

DSPs are unusually good targets for side-channel work, and the reason is architectural. They are designed for deterministic, repetitive computation, which means power consumption and execution time are highly correlated with data.

Channel Signal Practicality
Power Current draw during the unlock or compare Good on older parts, harder on modern ones
Timing Loop count depending on a compared byte Excellent if the comparison is early-exit
EM Local field above the core Requires preparation, very informative
Cache and bus Access patterns leaking key bytes Depends on the memory system

The second row is the cheapest to exploit when it exists. A password comparison that returns after the first mismatching byte leaks the password one byte at a time, and the measurement is a timer rather than a laboratory instrument. Modern libraries compare in constant time precisely because of this; older firmware frequently does not.

The practical assessment

Before any technique is chosen, four facts decide the route.

Fact Why it decides
Which protection architecture Password module and secure boot have disjoint weaknesses
Whether any region is readable while locked Determines whether the key might already be exposed
Whether the password is per-device Determines whether one recovery covers the run
Whether the image is signed or merely checked Signing removes the fault-injection route

The fourth row is the dividing line between eras. A signature check with the public key in ROM cannot be defeated by flipping a comparison, because the check is not a comparison of a stored digest; it is a verification that requires the private key to forge.

Where this fits

The system-level view, where the DSP boots from an external device and the key handling spans two chips, is in attacking an encrypted DSP system. The microcontroller analogue of this problem, where the mechanism is a fuse plus a rolling code, is in attacking Microchip encrypted code. The memory side, which determines what a read of the unlocked region actually yields, is in reading DSP chip program.

Services at this boundary

Work covers architecture identification, determination of whether the password is stored in a readable region, password recovery where it is, side-channel assessment where it is not, and documentation of the mechanism for a redesign. It does not cover defeating a genuine signature check without the private key, and it does not cover passwords held only in an inaccessible OTP region on a device that offers no other route.

The useful first question is not which attack to run but which architecture is present, because the two have no techniques in common.

PostHeaderIcon Attack an Encrypted DSP System: The Weak Point Is Boot, Not Runtime

An encrypted DSP system looks, from the outside, like a single cryptographic problem: the firmware is ciphertext, so break the cipher. That framing guarantees failure, because the cipher is usually sound. The realistic framing is that the system has a moment when it must turn ciphertext into executable code with no help from a user, and everything interesting happens in that moment.

This is a structural property, not an implementation flaw. A device that boots unattended has to be able to decrypt itself, which means the material needed to decrypt is present at boot. The design question is where, and the attack question is whether that location is reachable.

The boot chain and its handoffs

A typical encrypted DSP system has four stages, and each hands control to the next with a different level of trust.

Stage Runs from Trust level Typical protection
Boot ROM Mask ROM in the DSP Absolute; cannot be changed None needed
First-stage loader External flash, or internal protected region Verified before execution Signature or digest check
Decryption and copy Loader code Has the key, or fetches it Obfuscation only
Application RAM or internal flash Fully decrypted None, by definition

The fourth row is the fundamental issue. Once the application is running, it is plaintext in memory, and a device that can read its own memory can be made to reveal it. The encryption protects the image at rest, not the running system.

Three boot architectures and their weak points

Architecture Where the key is Main weak point
Key stored in external flash alongside the image In a header or a fixed region Reading the flash gives key and ciphertext together
Key derived from a device identifier Derived at boot Algorithm plus one identifier suffices
Key in an on-chip OTP or secure region Inside the DSP Requires a physical or side-channel route

The first row describes a design that provides no real protection against anyone with access to the board, and it is common in products where the threat model is casual copying. It is not a mistake so much as a scope decision, and it is worth saying so plainly, because customers often believe they have more protection than they do.

The second row is more interesting. Deriving a key from a unique identifier gives each unit a different key, which means an image copied from one device will not run on another. It raises the cost of cloning without changing the category: recovering the algorithm and one identifier recovers one unit, and recovering the algorithm alone often recovers all of them if the identifiers are guessable.

Why attacking the application is the wrong end

Once the application is running with decrypted code in memory, everything that could extract it is a debug feature: a monitor, a boundary scan chain, a serial bootloader, a test mode. On a device where these are disabled, attacking the running application requires invasive access, which is the most expensive route available.

Route When available Cost
Read the external flash Almost always, if there is one Very low
Intercept the boot bus If the DSP fetches externally Low, with a probe
Read the internal image after boot Only with debug access High
Physical readout of the DSP Always, in principle Very high

The second row is the sweet spot on many boards: if the DSP fetches its image from an external flash, the image passes across a bus in the clear at every boot. Capturing that bus gives the plaintext image without touching the DSP at all.

The external flash is usually the answer

It is worth stating directly, because it resolves a large fraction of these projects: if the firmware lives in an external flash and the DSP decrypts it at boot, then the flash is an ordinary commodity part with no protection worth the name. It can be read with a programmer, in circuit or out.

Flash protection Effort to defeat
None None; read it
Read inhibit via a status register Low; the register is not a secret
Sector protection Low; protection bits are writable
Encrypted content in the flash Depends on where the key is

The last row returns the question to the DSP, but only if the content really is encrypted. Many systems that are described as encrypted turn out to have a compressed or scrambled image, which is a much easier problem; extracting DSP and CPLD encrypted software covers the classification.

The CPLD in the boot path

On mixed boards, the CPLD is frequently part of the boot chain without being part of the cryptography. It gates the flash’s chip select, sequences power, or holds the DSP in reset until the supply is stable.

CPLD role Effect on the attack
Gates flash access Removing or bypassing the CPLD opens the path
Sequences reset Attack must respect the sequence
Holds a key register Key recovered with the CPLD configuration
Provides the boot clock Clock manipulation becomes possible

The first row is a protection that is purely logical, and logical protections are the easiest kind to remove: a chip select is a signal, and a signal can be asserted by something else.

Where the key questions are asked

The two on-chip architectures, and where a password physically sits in each, are covered in attacking DSP encrypt code. What a read of the DSP yields, once access exists, is in reading DSP chip program. Where the image is fetched from an external device in a mixed architecture, attacking DSP flash content covers the distinction between on-chip ROM and the part next door.

Services at this boundary

Work covers boot chain mapping, identification of where the key is held, external flash readout, bus interception during boot, and image classification where the content turns out not to be encrypted. It does not cover forging a signature without the private key, and it does not cover extracting a key held in an inaccessible OTP on a device with no side-channel weakness.

The expectation worth setting is that most encrypted DSP systems are defeated at the flash or the bus, not at the cipher, and the assessment should start at the cheapest point in the chain rather than the most interesting one.

PostHeaderIcon Attack DSP Flash Content: On-Chip Boot ROM Is Not External NOR

A DSP board typically carries three kinds of non-volatile storage, and customers routinely use one word for all of them. The three are: boot code in mask ROM inside the DSP, application code in flash inside the DSP on some parts, and application code in an external flash device on the board. The word used for all three is usually “flash”, and the confusion is expensive because one of them is not flash at all.

Sorting them out takes a part number and a board photograph. What follows from that sorting determines whether the job is a five-minute read or a week of laboratory work.

The three storage locations

Location Technology Writable Readable
Boot ROM inside the DSP Mask ROM, programmed at wafer fab Never No; not addressable from outside
Internal flash Floating gate, on the DSP die Via the device’s own loader Only through the device
External flash Commodity NOR or NAND With a programmer With a programmer, directly

The first row is the one that produces hopeless requests. A customer asks for the boot ROM to be extracted so the boot process can be modified. It cannot be extracted and it cannot be modified, because it is defined by a mask during fabrication. What can be done is to document its behaviour, which is usually already in the reference manual.

Why the boot ROM matters anyway

Even though the boot ROM cannot be read, it is the most important thing to understand in the system, because it defines the rules that everything else obeys.

Boot ROM behaviour Consequence for the work
Which interfaces it tries, in which order Determines the entry points available
How it validates an image Determines whether a modified image can boot
Where it copies the image to Determines what a memory capture will show
What it does on failure Determines whether the device is recoverable

The second row is where most of the difficulty lives. If the boot ROM performs a signature check, a modified image will not boot regardless of how it was produced, and the work becomes a key problem rather than an image problem.

The external flash: the easy case

An external NOR flash on a DSP board is an ordinary part. It has a datasheet, a command set, and no meaningful protection. Reading it does not require defeating anything.

Method Requires Notes
Read in circuit via the DSP’s loader A working DSP and a loader path Slow, and may be blocked
Read in circuit via a probe on the bus Access to the bus Reveals the decrypted stream, if decryption happens later
Desolder and read with a programmer Hot air and a socket Fastest and most reliable
Read with a clip, in circuit A SOIC or similar package No desoldering, works if the bus is quiet

The third row is the standard approach and it is worth preferring over cleverness. A flash removed from the board and read in a socket gives a clean image with no interference from the DSP, and it takes minutes.

The second row is the one that matters when the content is encrypted: the DSP reads ciphertext, so a bus capture gives ciphertext. If the DSP decrypts in hardware before executing, the plaintext never appears on the external bus, and only the internal image is useful.

What an external flash image contains

The image in an external flash is not just code. It has a structure defined by the boot ROM and the linker, and the structure is what makes the image bootable.

Region Content Why it matters
Header Entry point, sizes, checksums, sometimes a signature Wrong header means no boot
Code sections Instructions The program
Initialised data Constants and tables Frequently the valuable IP
Boot configuration Clock and memory settings Wrong values mean no boot
Trailer Padding or a second header Sometimes holds a key or digest

The fourth row catches people out. A DSP that runs at the wrong clock because a configuration word was not copied will appear to boot and then fail at the first peripheral access, and the symptom points at the peripheral rather than at the configuration.

When the flash is inside the DSP

Some DSPs integrate their own flash, which moves the problem inside the device and changes the rules.

Situation Route
Internal flash, no protection Read through the device’s loader
Internal flash, protected by a security module Unlock or physical, depending on the architecture
Internal flash, part of a secure boot chain Key problem first
No internal flash, boot from external only External read is the whole job

The second row leads back to the mechanisms described in attacking DSP encrypt code, where the password or key location determines whether a logical route exists.

Measuring before deciding

The cheapest way to establish where the code actually lives is to observe a boot with the external flash removed, or with its chip select disabled.

Observation Conclusion
Device boots with external flash removed Code is internal, or the board has a second source
Device does not boot, bus shows activity Code is external and fetched at boot
Bus shows encrypted-looking data Decryption happens inside the DSP
Bus shows valid instruction patterns No encryption, or decryption is external

The fourth row is genuinely useful: if the external bus carries recognisable instruction encodings, the image on the flash is plaintext, and the whole job reduces to a flash read.

Where the rest of the chain is covered

The boot-chain reasoning that follows from these observations is in attacking an encrypted DSP system. Reading the internal program space once access exists is in reading DSP chip program. Where a CPLD sits between the DSP and the flash, as a decode or gate, reading DSP and CPLD dump information covers the two-device view.

Services at this boundary

Work covers storage location identification, external flash readout in circuit or in a socket, image structure analysis, boot ROM behaviour documentation, and internal readout where a route exists. It does not cover modifying or extracting mask ROM, because it is not physically possible, and it does not cover booting a modified image on a device that verifies signatures.

The distinction to make early is which of the three storage locations holds the code, because two of them are trivial and one of them is not a storage device at all.

PostHeaderIcon Attack CPLD Encrypted Code: Flash-Based and EEPROM-Based Are Not Alike

The CPLD category looks homogeneous from a catalogue page: same packages, same pin counts, same five-volt or three-volt compatibility, same claim that the design is protected. Underneath, the devices split into two groups whose protection mechanisms share almost no properties, and a technique developed on one group usually does nothing on the other.

The split is by configuration storage. EEPROM-based devices store the design as charge on floating gates in an array that is written and erased electrically. Flash-based devices store it in flash cells governed by a configuration controller, and that controller is where security lives. The second kind can do things the first cannot, because the first has no controller to put a policy in.

What each family can and cannot enforce

Capability EEPROM-based Flash-based
Refuse readback Yes Yes
Refuse readback without erasing Usually no Yes, via security bit
Distinguish read-protected from blank Rarely Yes
Allow re-protection after erase Yes Yes
Support encrypted configuration No On some families
Survive erase with contents No No

The third row is the one that changes project planning. An EEPROM device that refuses a read is indistinguishable from an erased device using the read path alone, so the decision about how to proceed is made on evidence from outside the device: the customer’s knowledge that it was programmed, the board’s behaviour, the age of the product. A flash device with a security bit tells you explicitly that it is protected, which removes an entire category of uncertainty.

Why encryption is nearly absent from the older group

A CPLD has no processor to run decryption code. Any encrypted configuration therefore has to be decrypted by hardware in the configuration path, and that hardware has to hold a key. On a device with no configuration controller worth the name, there is nowhere for that to happen.

Mechanism Requires Present on
Read inhibit A control bit gating the readback path Both groups
Security bit with policy A configuration controller Flash-based
Encrypted bitstream A decrypting configuration engine and key storage A few flash families
Tamper response Sensors and a state machine Essentially none in this class

The third row is what “encrypted code” usually refers to when the phrase is used accurately, and in the CPLD world it is uncommon. When it does appear, the key management question becomes central: the device must be able to decrypt its own configuration at every power-up, which means the key is present in the device, which means the protection is against casual copying rather than against a determined attacker with the part in hand.

The attack surface, family by family

An attack surface here is the set of interfaces that can influence the configuration state. Enumerating them is the first step of any assessment, and the list is short.

Interface Access level Notes
JTAG or ISP port Board or fixture Governed by the security policy
Power and ground Always Supply manipulation is a classic route
Clock, if external Often Clock manipulation is the other classic
Package surface Physical Decapsulation, imaging, probing
Configuration source, if external Board Only on devices that boot from an external memory

The fourth row is the one that matters most for the EEPROM group, because there is no policy engine to defeat. The array is a physical structure with a known layout, and the question is whether the geometry allows imaging. Older parts with relaxed rules and small arrays are routinely tractable; a modern fine-geometry part is not.

Fault injection and why it is overrated here

Textbook treatments of CPLD attacks devote a lot of space to glitching: voltage dips, clock spikes, temperature excursions, aimed at making the device skip a check. On microcontrollers with a boot sequence, this is a rich area because there is a check to skip. On a CPLD there usually is not. The protection is not a procedure that runs and can be interrupted; it is a property of a control bit.

Target Common technique Works on CPLD
Skip an authentication routine Clock or voltage glitch Rarely; no routine to skip
Corrupt a read result Supply manipulation Sometimes; produces wrong data, not access
Force a reset into an unprotected state Power sequencing Occasionally, on devices with poor state machines
Read the array directly Optical or electrical Yes, and this is the main route

Glitching a CPLD tends to produce corrupted reads rather than unauthorised ones, which is worse than nothing because the corruption is not obvious. A read that returns plausible but wrong fuse bits will produce a design that almost works, and the debugging cost of that is enormous.

Assessing before committing

The assessment has a fixed sequence and each step is cheap.

Step Question Consequence
Identify the family precisely EEPROM or flash based Determines whether a policy exists
Identify the revision Has the layout changed Determines whether known techniques apply
Establish the security state Protected, blank, or unknown Determines whether the read path is alive
Establish uniqueness Is this the only sample Determines the acceptable risk
Choose the route Session or physical Follows from the four answers above

The fourth step is not technical and routinely omitted. A customer with one sample and a customer with fifty identical boards should get different recommendations, because the cost of a failed attempt is different.

Where the routes lead

If the device is unprotected, the read is routine and is described in reading Lattice CPLD embedded firmware. If it is protected, the logical route usually ends in an erasure, and the three possible endings are set out in cracking Lattice CPLD embedded firmware. What the physical route costs, and when it is the right first choice rather than the fallback, is covered in extracting FPGA configuration — the same three-route reasoning applies to the larger programmable devices.

Services at this boundary

Work covers family and revision identification, security state determination, attack surface enumeration, route selection with an explicit risk statement, and execution by session or physical means. It does not cover defeating encrypted configuration on families where the key is held in an inaccessible block, and it does not cover fault injection as a primary route, because on this class it produces corruption rather than access.

The framing worth keeping is that the storage technology is the attack surface. Everything else is a detail of how that surface is reached.

PostHeaderIcon CPLD and MCU Firmware File: One Phrase, Two Incompatible Objects

A board with a microcontroller and a CPLD has two programmable devices and, in most people’s vocabulary, two pieces of firmware. The word suggests the files are similar. They are not, and the difference is structural rather than stylistic: one file describes what a device should compute, the other describes what a device should be.

This matters at quotation time more than at any other. A request that says “recover the firmware from both chips” is ambiguous in a way that changes the effort by an order of magnitude, and the ambiguity is invisible until somebody opens the files.

The two objects compared

Property MCU hex file CPLD fuse map
Basic unit Address and data pair Fuse coordinate
Total length Proportional to used code Fixed: the device’s programmable element count
Contains addresses Yes, explicitly No; position implies address
Contains checksum Per record, plus a file checksum One checksum over the fuse bits
Meaning of a byte An instruction or data An unordered set of connection bits
Can be disassembled Yes No; requires architecture decode

The second row is the one people find surprising. A hex file for a small microcontroller program can be a few kilobytes, because it only records the addresses that were written. A fuse map for a 64-macrocell CPLD is exactly the size of the device’s programmable array regardless of how much logic the design uses — an almost-empty design still produces a full-length file.

What each file is for

The intended use of the two files is different, and that difference explains their structure.

File Consumer Operation
Hex or binary Programmer writing flash Place bytes at addresses
Fuse map Programmer configuring logic Set or clear every element
Bitstream Configuration engine Load a serial frame
Object file Linker and debugger Combine sections, resolve symbols

A programmer that expects a fuse map will reject a hex file immediately, and vice versa. The failures are usually loud, which is the good case. The bad case is a tool that accepts either and guesses wrong, producing a device that is programmed with something.

Where the confusion causes damage

Three specific failures follow from treating the two as the same kind of thing.

Assumption Reality Consequence
Same effort to read both CPLD read is often physical; MCU read may be a session Schedule and price both wrong
Same file size means same work Fuse map is fixed size, hex is not Progress measured by bytes is meaningless
Same reconstruction path MCU to disassembly, CPLD to equations Wrong specialist assigned

The first row is the expensive one. On a board where the microcontroller can be read over its debug port and the CPLD cannot be read at all, a single quotation covering both devices will either overprice the first or underprice the second, and the direction of the error depends on which device the estimator thought about.

Reading the CPLD half

The fuse map’s fixed length is actually helpful once understood, because it makes truncation detectable. A read that returns fewer bits than the device has programmable elements is incomplete, and the device’s own checksum confirms whether the bits are self-consistent.

Check What it proves
Length equals device fuse count No truncation
Checksum matches device-reported value Bits are consistent
Device ID in the header matches marking The map is for this device
UES contents are plausible The read reached the signature row

Without these checks, a partial read produces a map that decodes into equations, and the equations produce a design that nearly works. Reading the JED format covers the container field by field, including the checksum definition that makes the second check possible.

Reading the MCU half

The microcontroller file’s variable length is helpful in a different way: it tells you where the code ends. Everything after the last recorded address is unused, and on many devices that region is erased. It also tells you nothing about the parts of the device that were never programmed, which matters when a configuration region is written separately.

Region In the hex file Often missed
Program flash Yes, by address No
EEPROM or data flash Sometimes, different address space Yes
Configuration or fuse bytes Sometimes, at a high address Yes
Calibration or serial Sometimes, at a fixed address Yes

The third and fourth rows are the recurring omissions, and they are the reason a device programmed with a perfect copy of the code sometimes does not run.

A comparison that makes the point

Consider two devices with the same part count and the same board. The microcontroller file, when recovered, is 14 kilobytes and disassembles into about three thousand instructions. The CPLD file is exactly 4,832 bits, contains no instructions, and decodes into 64 equations of three to twelve product terms each.

Both are complete. Both are correct. Neither can be substituted for the other, and no single tool reads both. A workflow that treats them as one class of artefact will produce one good deliverable and one that is nonsense.

Where the specialist boundary falls

The MCU side leads to disassembly and reconstruction, treated in attacking Microchip source code for one family and in cracking microcontroller source code generally. The CPLD side leads to equations and state machines, treated in attacking CPLD source code. The two skills overlap in the first week and diverge completely after it.

Services at this boundary

Work covers both device classes, with the scope written per device rather than per board, and with the file type stated in the quotation. It does not cover producing a single merged deliverable, because there is no such object, and it does not cover estimating a CPLD read from an MCU read, because the routes have nothing in common.

The sentence that prevents most of these problems is one line in the quotation: which device, which file, which deliverable.