Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

Decoding EM-FI Attacks: Lessons Learned from Glitching the GigaDevice GD32F407

Black Hat756 views33:1612 months ago

This talk demonstrates the use of electromagnetic fault injection (EM-FI) to bypass read-out protection (RDP) on GigaDevice GD32F407 microcontrollers. The researchers detail the construction of a low-cost, automated glitching rig and the methodology for identifying sensitive areas on the chip die. The presentation provides practical techniques for optimizing glitch parameters, such as pulse power and timing, to achieve successful firmware extraction. Additionally, the speakers reveal a bonus RDP1 bypass technique discovered during the research process.

Bypassing Read-Out Protection on GigaDevice Microcontrollers via EM-FI

TLDR: Researchers at Black Hat 2024 demonstrated a practical, automated electromagnetic fault injection (EM-FI) attack to bypass read-out protection (RDP) on GigaDevice GD32F407 microcontrollers. By constructing a low-cost, 3D-printed glitching rig and systematically mapping the chip die for sensitive areas, they successfully extracted protected firmware. This research highlights that even hardware-level security features like RDP can be circumvented with precise physical manipulation and patience.

Hardware security is often treated as a black box by software-focused researchers, but the reality is that silicon is just as susceptible to exploitation as any web application. When you rely on read-out protection (RDP) to secure proprietary firmware on an ARM Cortex-M device, you are essentially betting that an attacker cannot physically manipulate the chip's internal state. The recent research presented at Black Hat 2024 on the GigaDevice GD32F407 proves that this bet is increasingly risky.

The Mechanics of the Glitch

Fault injection is not about finding a clever logic flaw in code; it is about forcing the hardware to make a mistake. In this case, the goal was to bypass the RDP check that prevents an external debugger from reading the flash memory. The researchers used electromagnetic fault injection, which involves placing a small coil over the chip die and pulsing it with a high-current, short-duration electromagnetic field. This pulse induces transient currents in the chip's internal circuitry, potentially causing a bit flip or a skipped instruction at a critical moment.

The attack flow is straightforward in theory but demanding in practice. First, you must identify the exact moment the chip performs the RDP check. By monitoring the communication protocol—in this case, a serial bootloader—you can trigger your glitching hardware at the precise microsecond the chip is evaluating its security state. If the glitch hits during the comparison operation, the chip might incorrectly conclude that the device is unlocked, granting you full access to the flash memory.

Building the Rig

One of the most impressive aspects of this research is the accessibility of the tooling. The team built an automated rig for approximately $600, utilizing a ChipSHOUTER PicoEMP as the primary pulse generator. They replaced the standard spindle of a cheap desktop CNC machine with a 3D-printed mount for the EM probe, allowing them to automate the process of scanning the chip die in a spiral pattern.

# Conceptual trigger logic for the glitching loop
def trigger_glitch(target_device, delay):
    wait_for_protocol_response(target_device)
    sleep_nanoseconds(delay)
    picoemp.fire_pulse()
    if check_for_success(target_device):
        return True
    return False

The use of a managed USB hub to power-cycle the target device between attempts is a critical detail. When you are performing millions of glitched attempts, you need a way to reset the target into a known state without manual intervention. The researchers also highlighted the importance of monitoring the target's current draw. A successful glitch often manifests as a subtle change in power consumption, which serves as a reliable indicator that you have influenced the chip's internal state.

Real-World Applicability

For a pentester or a hardware security researcher, this technique is a game-changer for engagements involving embedded systems. If you are tasked with assessing the security of an IoT device, the ability to extract firmware from a locked microcontroller is the ultimate prize. It allows you to perform static analysis on the binary, search for hardcoded credentials, and identify vulnerabilities that are invisible from the outside.

The researchers also stumbled upon a bonus technique: an RDP1 bypass that didn't even require a complex glitch. By injecting firmware extraction code into the SRAM via a debugger while the device was in a specific boot state, they could bypass the protection entirely. This serves as a stark reminder that security features are often implemented in layers, and if one layer is weak, the entire system can collapse.

Defensive Considerations

Defending against physical fault injection is notoriously difficult. Once an attacker has physical access to the device and the time to perform a scan, software-based protections are largely ineffective. However, manufacturers can implement hardware-level mitigations such as internal voltage regulation, active shields that detect physical tampering, or redundant logic that checks critical security states multiple times.

If you are a developer or a product security engineer, the primary takeaway is to assume that physical access is a total compromise. Do not store sensitive keys or proprietary algorithms in flash memory if you cannot afford for them to be extracted. Use secure elements or hardware security modules (HSMs) that are specifically designed to resist physical attacks, and always ensure that your firmware update mechanism is signed and verified.

Hardware security is a cat-and-mouse game. As researchers continue to refine these techniques, the barrier to entry for physical attacks will only continue to drop. Keep your tools sharp, document your findings, and never assume that a "locked" device is truly secure.

Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in