In this lesson, you will learn how to verify your system's resilience against physical attacks by intentionally inducing transient voltage drops to bypass security checks.
Understanding Voltage Glitching
Voltage glitching is a form of fault injection where you briefly disrupt the supply voltage (VCC) to a target processor. When a processor performs a critical operation—such as a password verification or an authorization check—the logic gates within the CPU require a stable supply to switch states correctly. By introducing a precise, nanosecond-scale "dip" in the power rail, you can force the hardware to miscalculate or skip instructions.
If the processor is executing an instruction like BEQ (Branch if Equal) to grant access, a well-timed glitch can flip a single bit in the status register or corrupt the instruction fetch. This results in the processor incorrectly determining that the credentials match, effectively bypassing the security check without changing a single line of firmware.
Precision Control and Timing
To implement this, you must control the power supply to the core with high-speed MOSFET switching. The glitching circuit must be triggered by an event—often captured via your JTAG or Trace ports—to ensure the dip occurs at the exact cycle the target code executes.
// Conceptual logic for triggering a glitch pulse
void trigger_glitch(void) {
// 1. Detect target instruction via Trace/ETM trigger
if (wait_for_trigger(PC_ADDRESS_PASSWORD_CHECK)) {
// 2. Delay for precise instruction alignment
delay_cycles(OFFSET_CYCLES);
// 3. Drive power rail low via MOSFET for ~50ns
GPIO_PIN_GLITCH_ENABLE = 1;
delay_nanoseconds(50);
GPIO_PIN_GLITCH_ENABLE = 0;
}
}
Verification Strategy
The goal of this verification is not to "break" the device, but to identify if it breaks. By systematically varying the duration and timing of the glitch, you build a "success map." If your security routines are robust, they should handle these transient faults by triggering a hardware reset or a secure lockout, rather than granting unauthorized access. This testing proves whether your implementation provides "Defense in Depth" against physical manipulation.
Key Takeaway: Voltage glitching exploits the physical sensitivity of digital logic to bypass software security, allowing you to verify that your system fails into a secure state when power conditions are compromised.