MaskedNet: The First Hardware Inference Engine Aiming Power Side-Channel Protection

Anuj Dubey, Rosario Cammarota, Aydin Aysu

TL;DR

This paper demonstrates that machine learning models running on edge hardware are highly vulnerable to power side-channel attacks, allowing attackers to "steal" secret model weights in minutes. To combat this, the authors introduce MaskedNet, the first hardware inference engine designed with built-in side-channel protection using cryptographic "masking" techniques to decouple power consumption from secret data.

What Problem Does This Paper Address?

As Machine Learning (ML) moves to the "edge" (IoT devices, smartphones, and embedded sensors), the ML models themselves—specifically their weights and biases—become valuable intellectual property. However, when these models run on physical hardware, they leak information through power consumption.

The authors address Differential Power Analysis (DPA). By measuring the minute fluctuations in power as a device performs mathematical operations, an attacker with physical access can correlate power "traces" with hypothesized weight values. While DPA has been studied for decades in cryptography (e.g., breaking AES keys), its application to neural network extraction is a dangerous and relatively new frontier. The paper highlights that an unprotected Binarized Neural Network (BNN) can be fully compromised with as few as 200 power measurements.

Methods

The authors propose a defense mechanism called Masking, which is an algorithm-level countermeasure. Instead of processing a secret value $x$ directly, the hardware splits it into two "shares": a random mask $r$ and a masked value $(x - r)$. Because the hardware processes these shares independently, the instantaneous power consumption no longer correlates directly with the secret value $x$.

Key Innovations:

  • Masked Adder Trees: The authors redesigned the standard summation hardware used in neural layers to handle masked shares.
  • The Sign-Bit Challenge: Unlike cryptographic algorithms that use modular arithmetic, neural networks rely on standard addition/subtraction. This creates a unique "sign-bit" leakage where the most significant bit (MSB) of the masked shares still correlates with the secret data. To fix this, the authors integrated Wave Differential Dynamic Logic (WDDL)—a "hiding" technique that equalizes power consumption—specifically for the sign-bit computation.
  • Masked Activation Functions: They developed a novel masked binarizer (ReLU equivalent for BNNs) using a chain of masked Look-Up Tables (LUTs) to compute the sign of a sum without ever "unmasking" the intermediate values.
  • Boolean-to-Arithmetic Conversion: Since different parts of the network are more efficient with different types of masking (XOR-based vs. Additive), the authors implemented secure conversion layers between them.

Datasets

The researchers evaluated their design using:

  • MNIST: The classic dataset of 70,000 handwritten digits.
  • Hardware Target: A 3-layer fully-connected Binarized Neural Network (1024 neurons per hidden layer) implemented on a SAKURA-X FPGA board, which is a standard platform for side-channel evaluation.

Key Insights and Ideas

  • ML is the New Crypto: The authors argue that ML weights are the "secret keys" of the modern era. If an attacker can extract the model, they can not only steal IP but also craft much more effective "adversarial attacks" to fool the classifier.
  • Arithmetic Masking is Tricky: A major "aha moment" in the paper is the realization that standard arithmetic masking fails in ML because of the lack of a modulus. The resulting information leak through the sign bit required a hybrid approach combining masking with hardware-level "hiding" (WDDL).
  • First-Order Security: The design is "first-order" secure, meaning an attacker cannot succeed by looking at power consumption at a single point in time.

Key Results

  • Attack Resilience: While the unprotected baseline was broken with 200 traces, the MaskedNet implementation remained secure against first-order DPA even after 100,000 traces.
  • Validation: The authors used a "second-order" attack (which is much harder to perform) to prove that their measurement setup was working correctly and that the first-order protection was truly effective.
  • Hardware Overhead: Security comes at a cost. MaskedNet resulted in a 2.8x increase in latency (due to processing multiple shares) and a 2.3x increase in area (LUT/Flip-Flop utilization) on the FPGA.

Limitations and Future Work

  • Higher-Order Attacks: While MaskedNet thwarts first-order DPA, sophisticated attackers could potentially use "second-order" or "multi-variate" attacks that correlate power at multiple time points. Extending this protection to higher orders would significantly increase the hardware cost.
  • Scaling to Complex Models: This work focused on Binarized Neural Networks (BNNs). Applying these techniques to high-precision floating-point models or complex Convolutional Neural Networks (CNNs) like ResNet would introduce much higher computational overhead.
  • Other Side-Channels: The paper focuses on power, but the authors note that Electromagnetic (EM) side-channels remain a potential threat that may require additional shielding or localized logic styles.

Summary updated

Abstract

Differential Power Analysis (DPA) has been an active area of research for the past two decades to study the attacks for extracting secret information from cryptographic implementations through power measurements and their defenses. The research on power side-channels have so far predominantly focused on analyzing implementations of ciphers such as AES, DES, RSA, and recently post-quantum cryptography primitives (e.g., lattices). Meanwhile, machine-learning applications are becoming ubiquitous with several scenarios where the Machine Learning Models are Intellectual Properties requiring confidentiality. Expanding side-channel analysis to Machine Learning Model extraction, however, is largely unexplored. This paper expands the DPA framework to neural-network classifiers. First, it shows DPA attacks during inference to extract the secret model parameters such as weights and biases of a neural network. Second, it proposes the first countermeasures against these attacks by augmenting masking. The resulting design uses novel masked components such as masked adder trees for fully-connected layers and masked Rectifier Linear Units for activation functions. On a SAKURA-X FPGA board, experiments show that the first-order DPA attacks on the unprotected implementation can succeed with only 200 traces and our protection respectively increases the latency and area-cost by 2.8× and 2.3×.
BibTeX
@inproceedings{dubey2020maskednet,
  author = {Anuj Dubey and Rosario Cammarota and Aydin Aysu},
  title = {{MaskedNet: The First Hardware Inference Engine Aiming Power Side-Channel Protection}},
  booktitle = {HOST},
  year = {2020},
  url = {https://openreview.net/forum?id=MX7uHSWg6s},
}

Loading related content...

Figure