Posts Tagged ‘extract cpld ic eeprom’

PostHeaderIcon Power Glitches: The Two Thresholds That Bound Every Vcc Dip

The phrase “power glitch” suggests something crude: drop the supply, confuse the chip, get lucky. In practice a usable power glitch occupies a band a few hundred millivolts tall and a few hundred nanoseconds wide, and everything outside that band produces either nothing at all or a dead device. The work is not in generating the dip. It is in finding and holding the band.

The reason the band exists is that two independent protection mechanisms sit on either side of it. Below it, the brown-out detector fires and the part resets, which destroys the state that was about to be corrupted. Above it, the logic still has enough margin to sample correctly, so nothing changes. A successful glitch lives in the space between a reset that happens too early and a computation that completes too well.

What a dip actually breaks

A digital circuit does not fail because the supply is low. It fails because the time a gate needs to propagate a value grows as the supply falls. Delay in a CMOS gate scales roughly as the inverse of the overdrive above threshold, so a supply that is twenty percent low can add thirty to fifty percent to the delay of the slowest path in a combinational block.

A flip-flop at the end of that path has a deadline. If the new value arrives after the setup window closes, the flip-flop either captures the previous value or enters a metastable state and resolves arbitrarily. The first outcome is the useful one: the register keeps its old contents while the rest of the machine has moved on. A conditional branch that should have been taken is not taken, a comparison that should have failed passes, a counter that should have incremented does not. This is a fault, not a crash, and it is why power glitching can be surgical.

The important consequence is that the effect is data dependent and path dependent. A dip that corrupts the comparison in one routine leaves every other routine correct. That selectivity is what makes the technique usable against a protected device: the target is one specific decision, and the rest of the chip has to keep running well enough to report the result.

The lower bound is the brown-out detector

Almost every microcontroller since the mid-2000s has a brown-out detector, sometimes called a BOR or a supply voltage supervisor. Its job is exactly the thing an attacker does not want: when Vcc falls below a threshold, hold the core in reset until the supply recovers. Thresholds are commonly selectable in steps between about 1.8 V and 4.3 V on a 3.3 V part, usually through a configuration byte.

The detector is the lower wall of the window. Below it, the reset dominates everything and the glitch is invisible in the output. This is the single most common reason a first attempt fails: the depth is increased until the device simply stops responding, and the conclusion drawn is that the part is protected. The part is not protected. The dip was too deep, and the reset fired before the target instruction executed.

Reading the detector threshold out of the configuration is therefore step zero. On parts with a readable option byte it is a routine read. On locked parts it can often be inferred from behaviour: apply a slow, monotonic ramp downward and find the supply at which the device stops executing and starts drawing the reset current. That measurement costs ten minutes and saves days.

The upper bound is the sampling margin

The upper wall is less obvious because it is not a designed feature. It is the leftover timing margin of the slowest path, and it moves with temperature, with the selected clock, and with the individual die.

A part running at 8 MHz from a 3.3 V supply has a 125 ns cycle. If the critical path needs 60 ns at nominal, there is 65 ns of slack. A supply dip that pushes the path to 70 ns still leaves it inside the cycle, so nothing is corrupted. The dip has to be deep enough, or the clock fast enough, that the path exceeds the cycle. This is why the same glitch setup that works on one board fails on the next: the two boards do not have the same slack, because they do not have the same clock configuration.

Quantity What moves it What it changes
BOR threshold Option byte setting Lower wall of the window
Critical path delay Temperature, supply, silicon speed grade Upper wall of the window
Clock period PLL and prescaler settings Where the upper wall sits relative to the cycle
Dip duration Pulse generator Whether one or several cycles are affected

The last row is often overlooked. A dip shorter than one clock cycle corrupts at most one pipeline stage. A dip spanning three cycles can corrupt three consecutive instructions, and the three are not independent: corrupting an instruction fetch and corrupting a data write produce very different failures.

Depth and width are independent knobs

Most published descriptions treat the glitch as a single parameter, the amplitude. That is misleading, because amplitude and duration act on different parts of the problem.

Depth decides whether any given path fails. Width decides how many operations are exposed to the failure. A deep, narrow pulse produces a single fault at a precisely known instruction. A shallow, wide pulse produces a slow supply that the regulators and the decoupling network have time to compensate for, which usually produces nothing. Between them sits the useful regime: a pulse wide enough that the pulse generator’s own edge rates do not dominate, and deep enough that the target path misses its deadline.

In practice the two are swept as a grid, not tuned independently, because the interaction is not separable. A deeper pulse can be narrower and still work, and the grid therefore has a hyperbolic ridge of successful settings rather than a single point. Mapping that ridge takes a few hundred attempts on a rig that can repeat a run every second, and it is the difference between a technique that works once and a technique that works on demand.

Why the window moves

Three environmental factors shift the window enough to lose a previously good setting.

Temperature is the largest. Delay rises as temperature rises in most process nodes, so a warm device needs a shallower dip to reach the same failure. A rig calibrated at room temperature and used on a warm part will overshoot into the reset region.

Clock frequency is the second. Doubling the clock halves the slack and makes the window wider and shallower, which is convenient, but it also halves the time available to trigger the dip at the right instruction, which makes the timing harder.

Supply decoupling is the third, and it is the one that varies most between boards. A board with 10 µF of ceramic capacitance near the die resists a 100 ns dip far more than a board with 100 nF. The pulse generator’s specified amplitude is therefore not the amplitude seen at the die, and the difference can be a few hundred millivolts.

Measuring the dip at the die rather than at the generator is not optional if the work is to be repeatable. A short ground lead and a wideband probe are enough; the measurement is crude but it converts a guess into a number.

Three outcome signatures

Once the rig is running, every attempt produces one of three outcomes, and telling them apart is what turns a sweep into a search.

The first is a reset. The device reboots, the startup banner repeats, and any volatile state is gone. This means the dip crossed the brown-out threshold, so the next attempt should be shallower or shorter.

The second is a hang. The device stops responding but does not restart. This is the signature of a corrupted control flow: the program counter reached an address that holds no valid instruction, or a loop lost its exit condition. It means the dip was in the useful depth range but landed on the wrong instruction, so the timing offset should move.

The third is the target outcome, and it is usually quiet. The device behaves normally except for one decision: a check passes that should have failed, or a lock state reads as open that should read as closed. There is no error message, because from the device’s point of view nothing went wrong.

Only the third outcome is progress, and it is easy to mistake the second for it if the acceptance criterion is not explicit before the run starts.

What this means in recovery work

On a device whose read protection is a single configuration bit checked at boot, a power glitch is one of the few techniques that can open a session without erasing the array. The dip has to land on the branch that evaluates the protection state, which is why the first task in such a job is locating that branch rather than building a pulse generator.

The honest boundary is worth stating. A glitch can make a device accept a command it would otherwise refuse; it cannot make a device return data it never stored. Where the protection is enforced by a physical barrier rather than a firmware check, no supply manipulation changes the outcome, and the work moves to the optical route described in extracting IC flash. What a glitch can reliably produce is a session, and what that session can read depends on the read path itself, which is the subject of three read channels.

The service side of this is narrow and specific. We characterise the brown-out threshold and the timing slack of the actual board, sweep the amplitude and duration grid, and report the ridge of settings that produces a controlled fault rather than a reset. We do not promise that a glitch will defeat every protection, because on parts with a shielded die and an internal supply regulator there is no external node to dip. Establishing which case applies costs one measurement and prevents an unfundable project.

Related mechanisms

A clock glitch attacks the same margin from the time side instead of the voltage side, and the difference in what it can reach is treated in clock glitch application. The injection point for either technique decides whether the chip can even see the disturbance, which is covered in clock glitch injection points. Once a fault is reproducible, finding the right instruction among thousands is a search problem, and glitch attacks as a search problem sets out the sweep strategy that makes it tractable.