FPGAs in Security
FPGA & Programmable Logic · Hardware Foundations track
12 min read
In this module
When the Configuration is the Secret
An FPGA bitstream is the complete description of a digital circuit: every logic function, every register, every connection. For a company shipping an FPGA-based product, that bitstream represents years of engineering investment. For an attacker, prising it loose and analysing it hands over the entire hardware design. FPGA security therefore matters for both IP protection and system integrity.
FPGAs also play offence. The same reconfigurability and timing precision that make them targets make them ideal platforms for side-channel analysis, fault injection, and custom security monitoring.
Bitstream Analysis and Reverse Engineering
What a Bitstream Contains
A bitstream is a binary file (typically with a .bit or .bin extension) that configures every programmable element on the FPGA. It contains:
- Configuration frames organised by row, column, and resource type
- LUT truth table contents for every LUT on the chip
- Routing switch states (on/off) for every programmable interconnect point
- BRAM initialisation data
- I/O configuration (voltage standard, drive strength, pull-up/pull-down)
- Device-specific header information (device ID, configuration options)
Reverse Engineering Approaches
Bitstream reverse engineering reconstructs the original design from the raw configuration bits. The process involves:
Bitstream format documentation: Xilinx documents the 7-series format partially in its configuration user guides. Researchers have filled in the gaps through systematic experiments — configuring known circuits and watching which bits flip.
Project X-Ray (now part of F4PGA): An open-source effort to systematically document the Xilinx 7-series bitstream format. By synthesising thousands of test designs and comparing the resulting bitstreams, the project has pinned down the function of most configuration bits, letting open-source tools both generate and parse them.
Bitstream to netlist conversion: Once you know the bit-to-resource mapping, a tool reads the bitstream and reconstructs the gate-level netlist — every LUT's truth table, every flip-flop's connectivity, the complete routing. From there an analyst can grasp the design's functionality, fingerprint cryptographic implementations, hunt for backdoors, or extract hardcoded keys.
Full bitstream reverse engineering is labour-intensive, but partial analysis is often sufficient for a security assessment. An analyst might extract only the BRAM contents (looking for hardcoded keys or certificates), identify the I/O pin assignments (understanding the board interface), or locate specific logic patterns (recognising AES or RSA implementations by their characteristic LUT configurations).
Bitstream Encryption
To protect against bitstream extraction and reverse engineering, both major FPGA vendors support bitstream encryption.
How It Works
FPGA design tools encrypt the bitstream with AES-256 (on current-generation devices) before it lands in external flash. The decryption key lives on the FPGA itself, in one of two flavours:
Battery-Backed RAM (BBRAM): The key sits in volatile SRAM powered by a small coin cell on the PCB. Pull the battery (or let it die) and the key vanishes; the FPGA can no longer decrypt the bitstream. That gives you tamper evidence — desoldering the chip to probe it almost always severs the battery.
eFuses: One-time-programmable fuses burned into the silicon during provisioning. The key survives power loss but can't be changed. If it leaks, you replace the device.
At power-on the FPGA's configuration controller pulls the encrypted bitstream from external flash, decrypts using the on-chip key, then loads the plaintext configuration into the SRAM cells. The plaintext never touches an external bus.
Authentication
Modern FPGAs also support bitstream authentication through HMAC-SHA-256 or RSA signatures. Authentication catches tampering. Even if an attacker can't read the encrypted bitstream, they might try to flip bits in it to nudge the circuit's behaviour. Authentication catches the modification and refuses to load a corrupted bitstream.
Xilinx/AMD UltraScale+ devices support both AES-256-GCM (encryption and authentication baked into one primitive) and RSA-4096 signature verification of the bitstream.
Best practice for FPGA bitstream protection uses both encryption and authentication. Encryption prevents an attacker from reading the design. Authentication prevents an attacker from modifying it. Without authentication, an attacker who knows the bitstream format could make targeted bit flips even in an encrypted bitstream (if the encryption mode is vulnerable to bit-flipping attacks), potentially altering the circuit in a useful way.
Here's that attack on a toy bitstream, a deliberately simplified format with the same moving parts: sync word, frames of LUT INIT values and routing bits, a CRC. Start in plaintext mode on the unlock comparator, press "Make this LUT always 1", recompute the CRC and watch the device happily load your trojan. Then switch to encrypted only, flip a bit in the IV (the one change CBC makes fully predictable) and patch the CRC blind. Finally try any single-bit change at all in authenticated mode.
Toy bitstream explorer
A simplified teaching format, not any vendor's real layout: a header with a sync word, 3 configuration frames each holding four LUT INIT values and some routing bits, and a CRC-32. Play the attacker with a copy of the flash chip, then see whether the device configures.
Anyone who can read the flash can read every LUT and change it. The CRC catches accidental corruption, but an attacker simply recomputes it.
| Header | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Frame 0 | ||||||||||||||||
| Frame 1 | ||||||||||||||||
| Frame 2 | ||||||||||||||||
| CRC-32 |
- Sync word
- Header, frame address and type
- LUT INIT
- Routing (not decoded)
- CRC and tag
| bit | A | B | C | D | F |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | |
| 1 | 0 | 0 | 0 | 1 | |
| 2 | 0 | 0 | 1 | 0 | |
| 3 | 0 | 0 | 1 | 1 | |
| 4 | 0 | 1 | 0 | 0 | |
| 5 | 0 | 1 | 0 | 1 | |
| 6 | 0 | 1 | 1 | 0 | |
| 7 | 0 | 1 | 1 | 1 | |
| 8 | 1 | 0 | 0 | 0 | |
| 9 | 1 | 0 | 0 | 1 | |
| 10 | 1 | 0 | 1 | 0 | |
| 11 | 1 | 0 | 1 | 1 | |
| 12 | 1 | 1 | 0 | 0 | |
| 13 | 1 | 1 | 0 | 1 | |
| 14 | 1 | 1 | 1 | 0 | |
| 15 | 1 | 1 | 1 | 1 |
Designed: F = A'·B'·C'·D' + A'·B·C'·D + A·B'·C·D' + A·B·C·D (16'h8421)
In the flash now: F = A'·B'·C'·D' + A'·B·C'·D + A·B'·C·D' + A·B·C·D (16'h8421)
Inputs A to D, A most significant. Written with ' for NOT.
Recompute CRC does what an attacker would: CRC-32 has no key, so anyone can recalculate it.
Power on: Configured: the device loaded this bitstream and the design is running.
- Passed: Sync word: B1 75 7E 57
- Passed: Header: Version 1, 3 frames of 16 bytes, plaintext
- Passed: CRC-32: 93BDD1D4 matches
About the toy format and the crypto
Header: sync word B1 75 7E 57, format version, frame count, frame size and a security mode flag. Each 16-byte frame holds its address, a type byte, four LUT4 INIT values (two bytes each, big-endian) and six routing bytes. The CRC-32 (the zlib and PNG polynomial) covers the header and the plaintext frames. The design and routing values are illustrative.
Encryption is real AES-128-CBC, with a fixed demo key and IV so the result is repeatable; real tools pick a random IV and current devices use AES-256. The tag is a real HMAC-SHA-256 over every byte before it, checked before decryption. Current Xilinx/AMD UltraScale+ parts use AES-256-GCM, which authenticates and encrypts in one primitive.
Xilinx 7-series devices did carry an HMAC, but checked it only after acting on the decrypted words. The Starbleed attack (Ender, Moradi and Paar, USENIX Security 2020) used that gap, so in practice those parts behaved more like the encrypted-only mode here.
IP Protection
Bitstream encryption fends off external extraction, but IP protection also reaches into the supply chain and the design flow itself.
Design-Level Concerns
- Third-party IP cores: Many FPGA designs incorporate licensed IP blocks (Ethernet controllers, PCIe endpoints, processor cores). These are typically delivered as encrypted HDL or pre-synthesised netlists. The design tools can use them without the designer seeing the source.
- Obfuscation: Some designers apply logic obfuscation - adding key-dependent logic that produces incorrect results unless the correct activation key is applied. This protects the design even if the bitstream is decrypted.
- Partial reconfiguration: Loading only part of the bitstream at runtime. This can be used to keep sensitive portions of the design in volatile memory, loaded from a secure enclave only when needed.
Physical Attacks on Key Storage
An attacker with physical access to the board can attempt to extract the decryption key:
- BBRAM probing: Desoldering the FPGA and reading the BBRAM contents before the capacitance discharges (difficult but demonstrated in research)
- eFuse readout: Some older devices allowed eFuse readout through JTAG if readback protection was not properly configured
- Side-channel attacks on the decryption engine: The FPGA's on-chip AES decryption engine is itself susceptible to power analysis during bitstream loading. The classic result is Moradi and colleagues extracting the bitstream key from Xilinx Virtex-II Pro devices in 2011, and from Virtex-4 and Virtex-5 parts soon after, by measuring power while the device decrypted its configuration
FPGAs as Security Tools
FPGAs are also indispensable tools for hardware security research.
Cryptographic Accelerators
FPGAs can implement cryptographic algorithms in hardware, providing:
- Throughput: Parallel processing of multiple data blocks simultaneously. An FPGA-based AES engine can process tens of gigabits per second by instantiating multiple AES cores.
- Deterministic timing: Hardware implementations have fixed, data-independent execution times, providing inherent protection against timing side-channel attacks (if designed correctly). Timing is only one channel, though: power draw and EM emissions still depend on the data, which is exactly what the side-channel section below exploits.
- Custom algorithms: FPGAs can implement post-quantum cryptographic algorithms, experimental ciphers, or custom protocols that have no CPU instruction support.
Hardware Security Monitors
FPGAs can be deployed as inline security monitors that inspect traffic at wire speed:
- Network intrusion detection: Implementing pattern matching engines in FPGA fabric to inspect every packet at line rate (10-100 Gbps) without the latency of software inspection
- Bus monitors: Sitting on a PCIe, USB, or memory bus and logging or filtering transactions in real time
- Tamper detection: Monitoring physical signals (voltage, temperature, EM emissions) and triggering alerts or zeroising secrets when anomalies are detected
Custom Firewalls and Protocol Filters
FPGAs can parse protocols at wire speed, which is why they end up inside custom firewalls for industrial control systems (SCADA/ICS), military networks, and any other environment where standard IT firewalls don't cut it on either functionality or latency.
Glitch Resistance
FPGAs can implement countermeasures against fault injection attacks:
- Dual-rail logic: Every signal is represented by two complementary wires. A fault that flips one wire without flipping the other is detected as an invalid state.
- Temporal redundancy: The same computation is performed twice (or three times with majority voting) and the results are compared. A transient fault affecting one computation but not the other is detected.
- Sensor networks: On-chip ring oscillator sensors detect voltage and temperature anomalies that indicate a glitch attack in progress.
FPGA-based countermeasures have an advantage over software countermeasures: they operate at the hardware level, directly interfacing with the physical signals that fault injection targets. A voltage glitch detector implemented in FPGA fabric can respond within nanoseconds, far faster than any software watchdog. However, this also means the defender must understand the physical attack surface deeply - the countermeasures themselves can become targets.
FPGA-Based Side-Channel Analysis
The flagship FPGA-based security research platform is ChipWhisperer, an open-source hardware-and-software framework for side-channel analysis and fault injection.
ChipWhisperer Architecture
ChipWhisperer uses FPGAs for several critical functions:
- Trigger generation: Detecting when the target device begins a cryptographic operation by monitoring its I/O lines, allowing precise synchronisation of measurement or glitch injection
- ADC sampling control: Triggering high-speed analogue-to-digital conversion at exactly the right moment to capture the power trace during the operation of interest
- Glitch generation: Producing precisely timed voltage glitches (with nanosecond control over timing, width, and shape) synchronised to the target's clock
- Target implementation: Most ChipWhisperer targets are microcontrollers, but on boards such as the CW305 an FPGA is the target itself, running the cipher under attack so researchers can study hardware implementations
The FPGA delivers deterministic, cycle-accurate timing — territory software tools simply can't reach. Software running on Linux can't hold timing to nanosecond precision once OS scheduling, interrupt handling, and cache effects start interfering. An FPGA shrugs all of that off.
What all that precise capture feeds is statistics. Here's a correlation power analysis (CPA) on the first AES round with simulated traces: the device leaks the Hamming weight of one S-box output plus noise, and the attacker, knowing only the plaintexts and the power readings, tries all 256 key-byte guesses and keeps the one whose predicted leak best tracks the measurements.
Real-World FPGA Security Research
Starbleed (2020)
Researchers at the Horst Görtz Institute demonstrated a vulnerability in Xilinx 7-series FPGA bitstream encryption. The root cause: the configuration logic decrypts the bitstream (AES-CBC) and acts on the decrypted words before the HMAC at the end is checked. That turns the FPGA into its own decryption oracle:
- The attacker modifies the encrypted bitstream so that one decrypted word gets written into the WBSTAR (Warm Boot Start Address) register, a register that survives a warm reset.
- The HMAC check fails, and the attacker resets the device. The reset clears the configuration, but not WBSTAR. The attacker then loads an unencrypted bitstream that reads WBSTAR out, recovering 32 bits of plaintext, and repeats word by word.
- The attack needed access to a configuration interface (JTAG, SelectMAP, or the SPI flash the FPGA boots from) but never recovered, or needed, the AES key.
It goes further than reading the design. The HMAC key sits inside the encrypted bitstream, so once the attacker has decrypted it, they can also build a modified bitstream that authenticates correctly. The paper (Ender, Moradi and Paar, USENIX Security 2020) showed the attack on Xilinx 7-series and Virtex-6 parts; UltraScale and UltraScale+, which authenticate with AES-GCM before using the data, aren't affected. Because the flaw lives in silicon, affected devices can't be patched.
The takeaway: bitstream encryption alone won't save you. The entire configuration interface needs locking down.
FPGAs as the Attacker
Cloud providers rent FPGAs by the hour (AWS EC2 F1 instances, for example), and research has asked what a malicious design can do there. Ring oscillators and delay-line sensors built from ordinary fabric can measure the chip's supply voltage, which is enough for remote power analysis of other logic on the same FPGA, or of a CPU sharing the board's power supply. Circuits built to draw large bursts of current can drop the voltage far enough to inject faults into a neighbour's logic, or crash the device. That's why multi-tenant FPGA sharing is still mostly a research topic and cloud FPGAs are rented one customer per chip, with providers scanning uploaded designs for oscillator structures.
JTAGulator
While not an attack on FPGAs specifically, the JTAGulator (built on a Parallax Propeller microcontroller, not an FPGA) automates the hunt for JTAG and UART debug interfaces on unknown hardware. It cycles through pin combinations until it finds a valid JTAG chain or UART port.
FPGA debug interfaces — JTAG especially — are a juicy attack surface. If JTAG is reachable on a deployed FPGA product, an attacker can:
- Read back the bitstream (if readback is not disabled)
- Overwrite the bitstream with a modified version
- Access internal debug features (Integrated Logic Analysers, debug hubs)
- Interact with embedded processors through the debug port
JTAG Lock and Disable
Securing FPGA JTAG involves:
- Disabling bitstream readback: Configuration bits that prevent the JTAG port from reading back the loaded configuration
- JTAG password: Some FPGAs support requiring a password before JTAG commands are accepted
- eFuse-based JTAG disable: Permanently disabling JTAG by blowing an eFuse (irreversible - also prevents field updates)
- Physical removal: Removing JTAG test points from the production PCB (but debug pads may still be traceable)
Removing JTAG headers from a PCB does not eliminate the attack surface. An experienced hardware analyst can trace the JTAG signals from the FPGA's balls/pads back through the PCB layers and solder directly to them. Similarly, disabling JTAG in the bitstream protects only as long as the bitstream itself is authenticated - without authentication, an attacker can load an unprotected bitstream that re-enables JTAG. Defence must be layered: encryption, authentication, physical hardening, and JTAG lockdown together.
The Bigger Picture
FPGAs sit at an unusual point in the security landscape. They wear three hats at once:
- Targets: Their bitstreams hold valuable IP and possibly extractable secrets
- Attack platforms: Reconfigurability and cycle-accurate timing make them ideal for side-channel analysis and fault injection tools
- Defence platforms: Wire-speed custom hardware logic turns them into formidable security monitors and cryptographic accelerators
Anyone working where hardware meets security needs to grasp FPGA architecture, the synthesis flow, and the implications of programmable logic. The bitstream is the blueprint of the circuit. Protecting it — and pulling it apart when you need to — is core hardware security work.