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.