19  Hardware Vulnerabilities

19.1 Hardware Vulnerabilities

This chapter covers hardware-level security threats to IoT devices, including hardware trojans, side-channel attacks, supply chain risks, and countermeasures for protecting physical device integrity.

19.2 Learning Objectives

By the end of this chapter, you will be able to:

  • Classify hardware trojan trigger mechanisms and predict their activation conditions
  • Analyze side-channel attack techniques (SPA, DPA, CPA) and calculate key extraction feasibility
  • Assess supply chain security risks at each stage from design through distribution
  • Select and implement hardware security countermeasures based on threat model and budget
  • Detect hardware tampering in production devices using inspection and verification methods

Key Concepts

  • JTAG (Joint Test Action Group): A hardware debug interface standard (IEEE 1149.1) present on most microcontrollers, providing access to processor registers, memory, and firmware — a critical attack surface if left enabled in production devices.
  • Side-channel attack: An attack that extracts secret information by analysing physical characteristics of device operation (power consumption, electromagnetic emissions, timing variations) rather than attacking the algorithm directly.
  • Fault injection: An attack technique deliberately inducing hardware faults (voltage glitches, clock manipulation, laser illumination) to cause a device to skip security checks or enter an exploitable state.
  • Secure element: A tamper-resistant hardware component that stores cryptographic keys and performs security operations in an isolated environment, protecting credentials even if the main processor is compromised.
  • Physical unclonable function (PUF): A hardware structure that exploits manufacturing variations to produce a unique, device-specific response to a challenge — used for unique device identity without storing persistent secrets.
  • Supply chain attack: Compromising a device’s security at the manufacturing, distribution, or component sourcing stage, before it is deployed — a growing threat for IoT devices manufactured in geographically distributed supply chains.
In 60 Seconds

Hardware vulnerabilities in IoT devices — exposed debug interfaces, weak physical tamper protection, insecure boot sequences, and vulnerable supply chains — allow attackers with physical access to extract firmware, credentials, and cryptographic keys that software defences cannot protect. Unlike software vulnerabilities that can be patched remotely, hardware vulnerabilities often require physical device replacement.

Hardware vulnerabilities are physical weaknesses in the chips and circuits that make up IoT devices. Think of a chip as a tiny city – hardware trojans are like secret agents hiding inside it from the factory, side-channel attacks are like someone guessing your password by watching the lights flicker when you type, and supply chain attacks happen when someone tampers with the chip during its journey from factory to your device. This chapter helps you understand these physical threats so you can protect the “body” of your IoT devices, not just their software.

“Something is wrong,” Max the Microcontroller said nervously, checking his circuits. “What if a tiny spy was hidden inside me before I was even built? That is what a hardware trojan is – a secret bad instruction planted in a chip during manufacturing!”

Sammy the Sensor shuddered. “That is like someone hiding a secret microphone inside a teddy bear at the toy factory! The bear looks perfectly normal, but it is secretly recording everything. Hardware trojans can hide in a chip for months or years, then suddenly activate and steal secret keys or open a backdoor.”

“And then there are side-channel attacks,” Lila the LED added. “Imagine you are typing a secret password, and someone watches which keys light up and how much power each key press uses. They can figure out your password without ever seeing the screen! Attackers measure tiny things like power usage, heat, or even the sounds a chip makes to steal secrets.”

“The scariest part is the supply chain,” Bella the Battery explained. “A chip might travel through five different countries before it reaches your device. At any stop along the way, someone could tamper with it. That is why we need tamper-evident packaging, trusted suppliers, and special tests that check if a chip has been secretly modified. Trust starts at the factory!”

19.3 Hardware Trojans

Hardware trojans are malicious modifications to integrated circuits that can: - Leak cryptographic keys - Create backdoors for unauthorized access - Disable security functions under specific conditions - Cause device failure at critical moments

19.3.1 Trojan Anatomy

Diagram showing the anatomy of a hardware trojan in an integrated circuit, with trigger mechanism (combinational, sequential, analog, or time-based) connected to a payload that can leak keys, create backdoors, disable security, or cause device failure.
Figure 19.1: Hardware Trojan Anatomy

19.3.2 Trigger Types

Trigger Type Description Example Detection Difficulty
Combinational Activates on specific input pattern Magic password enables debug mode Medium
Sequential Requires sequence of events After 1000 boot cycles, leak keys High
Analog Temperature, voltage, EM conditions At >50°C, disable encryption Very High
Time-based After specific time period After 1 year, enable backdoor High

19.4 Supply Chain Security Risk

The IC supply chain has multiple insertion points for hardware trojans. A typical chip passes through 4-6 organizations across multiple countries before reaching a finished device, and each handoff creates an opportunity for malicious modification or counterfeit substitution:

Diagram showing the integrated circuit supply chain from design through fabrication, assembly, testing, and distribution, with potential trojan insertion points highlighted at each stage including malicious IP cores at design, doping modifications at foundry, counterfeit substitution at assembly, and firmware implants at distribution.
Figure 19.2: IC Supply Chain Attack Surface

See Real-World Supply Chain Incidents below for documented cases of supply chain compromise.

19.5 Side-Channel Attacks

Side-channel attacks extract secrets by analyzing physical properties of a device during operation:

19.5.1 Simple Power Analysis (SPA)

Directly observes power consumption patterns to identify cryptographic operations:

Power Trace During RSA (square-and-multiply):
        │
  High  │    ██    ██████    ██
Power   │   ████  ████████  ████
        │  ██████████████████████
  Low   │──────────────────────────
        └─────────────────────────► Time
              ^       ^
              │       │
          Square  Square + Multiply
         (bit=0)   (bit=1, higher power)

In RSA’s square-and-multiply algorithm, key bit 0 triggers only a square operation, while key bit 1 triggers both square and multiply. The multiply step draws more power, creating a visible spike that reveals each key bit.

19.5.2 Differential Power Analysis (DPA)

Uses statistical analysis of many power traces to extract keys:

  1. Collect thousands of power traces during encryption
  2. Hypothesize key byte values
  3. Correlate hypothesis with power consumption
  4. Correct key hypothesis shows higher correlation

19.5.3 Countermeasures

Technique Description Overhead
Constant-time code Same operations regardless of data ~10-20% slower
Power randomization Add random delays/operations ~30% power increase
Masking Split secrets into random shares 2-3x computation
Noise injection Add power noise during operations 10% power increase
Shielding Metal mesh over chip Manufacturing cost

19.6 Physical Attack Vectors

19.6.1 Debug Interface Exploitation

Diagram showing JTAG daisy-chain architecture with three chips (TI DSP and two Core Logic processors) connected in series. Each chip contains Bypass Register, Instruction Register, and Boundary Scan cells shown as yellow squares around the chip perimeter. The four JTAG signals (TDI - Test Data In, TCK - Test Clock, TMS - Test Mode Select, TDO - Test Data Out) connect all chips in a chain, with TDO of one chip feeding TDI of the next. Source: University of Edinburgh IoT Security Course.

JTAG Daisy-Chain Architecture showing multiple chips connected via debug interface

Source: University of Edinburgh - IoT Systems Security Course

This diagram illustrates the JTAG daisy-chain architecture - a critical hardware attack vector in IoT devices:

How JTAG Chains Work:

  • TDI (Test Data In): Serial data input to the chain
  • TDO (Test Data Out): Serial data output from the chain
  • TCK (Test Clock): Synchronizes all chips in the chain
  • TMS (Test Mode Select): Controls the TAP state machine

Security Implications for IoT:

  • Multi-chip access: A single JTAG port provides access to ALL chips in the chain
  • Boundary scan: Yellow cells around chip perimeter allow testing/controlling every I/O pin
  • Bypass register: Attackers can selectively target specific chips while bypassing others
  • Daisy-chain vulnerability: Compromising one debug port compromises the entire system

Why This Matters for Device Security: IoT devices often contain multiple processors (main CPU, wireless radio, sensor MCU) connected via JTAG. If debug ports are not disabled in production: 1. Attacker connects to single exposed JTAG header 2. Gains access to ALL processors in the chain 3. Can read/write firmware, extract keys, inject malware on any chip 4. Even “secure” chips become vulnerable through chain access

Mitigation: Disable JTAG by burning eFuse bits, remove test points from production PCBs, or implement JTAG authentication.

Professional hardware debugging kit showing a white rectangular device (logic analyzer or debugger) with USB ports and blue LED indicators, alongside multiple cable adapters including JTAG ribbon cable connector, SWD probe clips, and various debugging probes for connecting to IoT device test points and extracting firmware or debugging hardware.

Hardware Debugging Kit with JTAG/SWD Interfaces

Source: University of Edinburgh - IoT Systems Security Course

This image shows typical hardware hacking tools used for IoT security assessments:

  • Logic analyzer/debugger: Captures signals from JTAG, SWD, UART, SPI interfaces
  • Probe clips: Connect to test points on PCBs without soldering
  • JTAG ribbon cable: Standard 10/20-pin connector for ARM Cortex debug

Why this matters for device security: These tools cost under $100 and allow attackers with physical device access to: 1. Extract firmware for reverse engineering 2. Read encryption keys from memory 3. Bypass secure boot by debugging bootloader 4. Inject malicious code into flash memory

Production IoT devices must disable these debug interfaces to prevent exploitation.

19.6.2 Tamper Detection and Response

Level Protection Response
Level 1 Tamper-evident seals Visual inspection
Level 2 Mesh break detection Log event
Level 3 Active monitoring Alert + log
Level 4 Key zeroization Wipe secrets on breach
Level 5 Device destruction Self-destruct circuit
Knowledge Check: Side-Channel Attack Countermeasures

Question: An IoT device uses software AES encryption with no side-channel protections. An attacker with a $200 ChipWhisperer can extract the full AES key in under 1 hour. What is the most cost-effective countermeasure?

Click to reveal answer

Answer: Use the microcontroller’s built-in hardware AES accelerator (available on STM32, ESP32, and most modern MCUs) instead of software AES. Hardware crypto accelerators include built-in DPA countermeasures (constant-time execution, power randomization) at zero additional cost per unit. This raises the required traces from ~5,000 to ~500,000, increasing attack time from 1 hour to days and making the attack economically infeasible for most threat actors.

19.7 Real-World Supply Chain Incidents

Understanding supply chain risks requires examining documented incidents where hardware tampering created real security consequences.

19.7.1 Bloomberg/SuperMicro Allegations (2018)

Bloomberg reported that Chinese intelligence services had planted rice-grain-sized chips on SuperMicro motherboards used by Apple, Amazon, and the US government. While the affected companies denied the allegations, the incident triggered industry-wide reassessment of hardware supply chain trust:

Impact Details
SuperMicro stock Dropped 41% in one day
Industry response Major cloud providers increased board-level inspection
NIST guidance Updated SP 800-161 (Supply Chain Risk Management)
Military DoD accelerated Trusted Foundry program expansion

Whether or not the specific allegations were accurate, the incident demonstrated that supply chain attacks are economically plausible. A $0.50 chip modification on a $2,000 server board yields a 4,000:1 cost-to-impact ratio.

19.7.2 Cisco Counterfeit Router Discovery (2020)

F-Secure researchers documented counterfeit Cisco Catalyst 2960-X switches discovered at an IT company. The counterfeits included modified firmware that bypassed Cisco’s Secure Boot:

  • Physical appearance: Indistinguishable from genuine units without X-ray or decapping
  • Functional behavior: Passed standard acceptance testing
  • Security gap: Secure Boot signature verification was disabled, allowing arbitrary firmware loading
  • Detection method: Discovered only after a firmware update failed – the counterfeit bootloader could not process the signed update

Lesson for IoT: If enterprise networking equipment with multi-thousand-dollar price tags gets counterfeited, IoT devices at $10-50 price points are even more vulnerable. The economic incentive for counterfeiting is proportional to volume, and IoT volumes dwarf enterprise networking.

19.7.3 Cost-Benefit of Supply Chain Attacks

Attack Method Attacker Cost Potential Yield Detection Difficulty
Chip modification at foundry $50K-$500K (bribe/insider) Access to millions of devices Very high (requires golden model comparison)
Counterfeit component substitution $5K-$50K (counterfeit batch) Thousands of devices with weakened security Medium (visual/X-ray inspection)
Firmware implant during assembly $1K-$10K (insider at contract manufacturer) Entire production run Medium (binary comparison with golden image)
Interception during shipping $10K-$100K (logistics compromise) Targeted units Low (tamper-evident seals)
Common Misconception: “Firewalls Protect IoT Devices”

The Myth: “Our IoT devices are behind a corporate firewall, so they’re protected from hackers.”

The Reality: Firewalls protect against network-based attacks from outside the perimeter, but they cannot defend against:

  1. Physical attacks: Attacker with device access extracts keys via JTAG
  2. Supply chain attacks: Trojan inserted during manufacturing
  3. Insider threats: Employee with network access
  4. Compromised internal hosts: Malware on workstation pivots to IoT
  5. Side-channel attacks: Power analysis extracts keys through the power plug

The Truth: Firewalls are ONE layer of defense. IoT security requires: - Device-level hardening (secure boot, encrypted storage) - Network segmentation (VLANs isolate IoT) - Zero-trust architecture (authenticate every connection) - Physical security (tamper detection)

19.8 Detecting Hardware Trojans in Production

19.8.1 Detection Methods

Method When Applied Detection Rate Cost
Visual Inspection Incoming QC Low (obvious only) Low
X-ray Imaging Sample testing Medium Medium
Side-channel analysis Production testing Medium-High Medium
Formal verification Design phase High (known patterns) High
Golden model comparison Production High Very High

19.9 Hardware Security Assessment Exercise

Exercise: Hardware Security Assessment and Countermeasures

Scenario: You’re tasked with assessing the hardware security of a new IoT gateway being considered for industrial deployment. The device will handle sensitive process control data and must resist physical tampering.

Assessment Checklist:

  1. Debug Interface Analysis:
  2. Physical Security:
  3. Component Analysis:
  4. Side-Channel Assessment:

Countermeasure Recommendations:

Finding Countermeasure Implementation Cost
JTAG enabled Burn eFuse to disable $0 (software)
Exposed test points Epoxy fill, remove from layout $0.50/device
No tamper detection Add mesh + accelerometer $2-5/device
Readable flash Enable encryption $0 (if chip supports)
Side-channel leakage Add countermeasures in firmware Development time

19.10 Worked Example: Hardware Security Assessment of an Industrial IoT Gateway

The following worked example applies the assessment checklist above to a real-world scenario, showing what each step reveals and how to quantify the resulting risk.

Scenario: A water treatment utility is deploying 50 IoT gateways across pump stations in a metropolitan area. Each gateway costs $1,200 and controls chlorine dosing pumps, pressure valves, and flow sensors. Before procurement, you conduct a hardware security assessment on a sample unit. The gateways are installed in outdoor cabinets with basic padlocks.

Step 1: Physical Inspection (30 minutes)

Finding Severity Detail
JTAG header exposed (10-pin, populated) Critical Standard ARM Cortex JTAG pinout, accessible without opening enclosure
UART console (3.3V, 115200 baud) Critical Root shell with no password prompt
Debug LED active Low Indicates processor state, minor information leak
No tamper-evident seals High Cabinet opening leaves no evidence
External microSD slot Medium Firmware and logs accessible without tools
No potting or epoxy on PCB Medium All components accessible for probing

Step 2: Firmware Extraction via JTAG (15 minutes)

Using a $45 Segger J-Link EDU and OpenOCD:

> openocd -f interface/jlink.cfg -f target/stm32f4x.cfg
> halt
> dump_image firmware.bin 0x08000000 0x100000

Result: Complete 1 MB firmware extracted in 12 seconds. Analysis with binwalk:

Content Found Security Impact
Wi-Fi SSID and WPA2 password Access to utility’s internal SCADA network
MQTT broker IP and credentials Subscribe/publish to ALL 50 gateway topics
TLS private key (PEM format) Impersonate any gateway to the cloud platform
Hardcoded API key for cloud Full API access to water treatment control plane
AES-128 key for sensor data Decrypt all sensor communications

Step 3: Side-Channel Analysis (2 hours)

Power analysis during AES encryption using a $200 ChipWhisperer Nano:

  • Collected 5,000 power traces during AES-128 operations
  • Correlation Power Analysis (CPA) on first-round SubBytes
  • Result: Full 128-bit AES key recovered after 3,200 traces
  • Time per trace: 2.4 ms (automated capture)
  • Total attack time: 7.7 seconds of trace capture + 45 minutes of analysis

The device uses a software AES implementation with no countermeasures. Each key byte shows correlation peaks of 0.85+ (values above 0.5 indicate successful extraction).

Step 4: Quantified Risk Assessment

Attack Equipment Cost Time Impact (50 gateways)
JTAG firmware dump $45 (J-Link EDU) 15 min All credentials exposed for entire fleet
UART root access $3 (USB-UART adapter) 2 min Full gateway control, SCADA network access
Side-channel key recovery $200 (ChipWhisperer) 3 hours Decrypt all sensor data, forge commands
microSD cloning $10 (card reader) 5 min Configuration, logs, cached credentials

Worst-case scenario: Attacker with $250 in equipment and physical access to ONE gateway gains credentials to control ALL 50 pump stations. Manipulating chlorine dosing levels at a water treatment facility serving 500,000 people creates a public health emergency. The 2021 Oldsmar, Florida water treatment attack (attempted lye increase to dangerous levels) demonstrates this is a realistic threat.

Step 5: Countermeasure Recommendations

Countermeasure Per-Unit Cost Implementation Risk Reduction
Burn JTAG eFuse $0 (firmware change) 1 day Eliminates JTAG extraction
Disable UART in production firmware $0 (firmware change) 1 day Eliminates root shell access
Secure element (ATECC608B) for key storage $0.65/unit 2 weeks redesign Keys never leave secure element
Hardware AES with DPA countermeasures $0 (use STM32 crypto accelerator) 1 week firmware change Eliminates side-channel extraction
Tamper mesh + accelerometer $3.50/unit 4 weeks redesign Detects cabinet opening, key zeroization
Encrypted firmware with secure boot $0 (firmware change) 2 weeks Prevents firmware analysis
Per-device unique credentials $2,000 (provisioning server) 3 weeks Limits blast radius to 1 device

Total cost: $4.15/unit additional hardware + $12,000 one-time engineering. For 50 units: $12,208 total. Compare to potential cost of a water contamination incident: $50-500 million in emergency response, lawsuits, and regulatory penalties.

Side-Channel Attack Economics: Power Analysis Cost vs. Defense Cost

Calculate the attacker’s cost to extract AES keys via Differential Power Analysis (DPA) versus the defender’s cost to implement countermeasures:

Attacker Equipment Cost (ChipWhisperer setup): - ChipWhisperer-Lite: $330 - Oscilloscope (100 MHz): $500 - Probe + accessories: $120 - Total: $950

Attacker Time Investment:

  • Trace collection: 5,000 traces × 2.4 ms = 12 seconds
  • Correlation analysis: ~45 minutes (automated)
  • Total: <1 hour to extract 128-bit AES key

Defender Countermeasure Cost:

  • Secure element (ATECC608B): $0.65/unit
  • Masked AES implementation: 8 hours dev × $150/hr = $1,200 (NRE)
  • Per-unit cost: $0.65 + ($1,200 / 50 units) = $24.65/unit

ROI Calculation: For 50 industrial gateways, countermeasure cost = $1,233. Avoided breach cost = \(P_{attack} \times C_{breach}\) where \(P_{attack} = 0.10\) (10% physical access probability) and \(C_{breach} = \$500,000\) (water treatment incident). Expected loss avoided = \(0.10 \times 500,000 = \$50,000\). ROI = \((50,000 - 1,233) / 1,233 = 3,956\%\). Conclusion: Side-channel defenses provide exceptional ROI for critical infrastructure despite low attack probability, because impact severity is catastrophic.

Adjust the parameters below to explore how fleet size, attack probability, and breach cost affect the return on investment for hardware security countermeasures.

19.11 Mathematical Foundation: Side-Channel Attack Success Rate (Correlation Power Analysis)

Formal Definition: Correlation Power Analysis (CPA) extracts cryptographic keys by correlating measured power consumption with hypothetical intermediate values. Success rate depends on signal-to-noise ratio (SNR) and number of traces:

\[ P_{success} = \Phi\left(\frac{\sqrt{N} \cdot \rho}{\sqrt{1 - \rho^2}}\right) \]

where \(N\) is number of power traces, \(\rho\) is correlation coefficient between power model and measurements, and \(\Phi\) is cumulative normal distribution.

Worked Calculation (AES-128 Key Extraction from Smart Meter):

Given: - Target: AES-128 encryption (16-byte key, 16 independent subkeys to attack) - Power traces: \(N = 5000\) measurements - Correlation coefficient: \(\rho = 0.12\) (unprotected hardware AES on STM32) - Attack targets one subkey byte at a time (256 hypotheses per byte)

For single subkey byte: \[ \begin{align} P_{success,byte} &= \Phi\left(\frac{\sqrt{5000} \cdot 0.12}{\sqrt{1 - 0.12^2}}\right) \\ &= \Phi\left(\frac{70.71 \cdot 0.12}{0.9928}\right) = \Phi(8.55) \approx 0.9999999999 \end{align} \]

For full 16-byte key (16 independent attacks): \[ P_{success,key} = (P_{success,byte})^{16} = (0.9999999999)^{16} \approx 0.9999999984 \]

Attack timeline (smart meter with software AES): - Trace acquisition: 5,000 encryptions × 12 ms/encryption = 60 seconds - Offline analysis: ~30 minutes (256 hypotheses × 16 bytes) - Total: <1 hour to extract full AES-128 key

With countermeasures (constant-time code + random masking, \(\rho = 0.02\)): \[ P_{success,byte} = \Phi\left(\frac{\sqrt{5000} \cdot 0.02}{\sqrt{1 - 0.02^2}}\right) = \Phi(1.42) \approx 0.92 \]

Require \(N = 50,000\) traces for 99.99% success → 10× more traces, 10× longer attack time.

Result: Unprotected hardware AES provides near-certain key extraction with 5,000 traces (<1 hour). Countermeasures increase required effort by 10-100×, making attacks infeasible for resource-constrained adversaries.

Why This Matters for IoT: Smart meters, payment terminals, and industrial controllers handle high-value secrets. Side-channel protection (secure elements, masked implementations) is mandatory for any device with physical adversary access.

Explore how the number of power traces and correlation coefficient affect the probability of successfully extracting a cryptographic key via Correlation Power Analysis.

19.12 Concept Relationships

How Hardware Threats Interconnect
Threat Type Requires Enables Detection Method Countermeasure
Hardware Trojan Supply chain access Backdoor, key leakage Golden model comparison Trusted foundries, verification
Side-Channel (SPA/DPA) Physical proximity Key extraction Power analysis monitoring Constant-time code, masking
Debug Interface (JTAG) Physical access Firmware extraction Port scanning Disable in production, burn eFuse
Tamper Attack Device access Key theft, firmware modification Accelerometer, mesh sensors Tamper-evident seals, key zeroization
Counterfeit Components Supply chain compromise Weakened security, backdoors X-ray, visual inspection Trusted suppliers, verification testing

Attack Chain Example: Supply chain trojan (inserted at foundry) + side-channel attack (extract AES key via power analysis) + JTAG extraction (dump firmware with embedded secrets) = complete device compromise. Each attack type amplifies others. Defense requires addressing all vectors.

19.13 See Also

Related Hardware Security:

Detection and Response:

Defensive Technologies:

Common Pitfalls

JTAG, UART debug consoles, and SWD interfaces enabled in production firmware provide attackers who gain physical access with complete control over the device. Always disable or protect debug interfaces in production builds with a separate firmware build configuration.

A plastic enclosure with standard screws does not deter an attacker with a screwdriver and 15 minutes. Design tamper protection to be proportional to the threat level: tamper-evident seals for low-value devices, active tamper detection with key erasure for high-value targets.

Naive software implementations of AES and RSA leak secret key information through power consumption and timing variations. Use constant-time, side-channel-resistant cryptographic libraries (ARM Mbed TLS with hardware acceleration) rather than reference implementations.

Device purchasers bear responsibility for configuring hardware security features (burning security fuses, enabling secure boot, disabling debug interfaces) during production provisioning. Verify these configurations are set before deploying devices.

19.14 Summary

This chapter covered hardware vulnerabilities:

  • Hardware Trojans: Malicious circuit modifications with triggers and payloads
  • Supply Chain Risks: Multiple insertion points from design to deployment
  • Side-Channel Attacks: SPA, DPA, CPA extract secrets through physical analysis
  • Physical Attacks: JTAG, UART, flash access enable firmware extraction
  • Countermeasures: Disable debug, add tamper detection, use constant-time code

19.15 Knowledge Check

19.16 What’s Next

The next chapter explores Access Control models for IoT including RBAC, ABAC, OAuth 2.0, and identity management strategies for device fleets.

Continue to Access Control


← OTA Updates Access Control →