What Is a Side-Channel Attack? Power, Timing and EM
A side-channel attack recovers a secret, such as a key or a password, not by breaking the math but by measuring how the device behaves while it uses the secret: how long an operation takes, how much current the chip draws, or the electromagnetic field it radiates. These physical effects depend on the data being processed, and with enough measurements and statistics, a small dependence is enough.
Before you start
This is defensive knowledge, for building and testing your own hardware or hardware you are authorized to test. It explains mechanisms and defenses with references to published research. It does not give step-by-step attacks on products or systems you don't own.
What you'll learn
- Why physical behavior leaks data, from the CMOS level up
- Timing leaks, and why an early-exit compare is dangerous
- Power analysis: simple and differential
- Electromagnetic emanation
- Why designers have to care, not only cryptographers
Why hardware leaks
In CMOS, dynamic power is drawn when nodes switch: each 0-to-1 transition charges a capacitance from the supply. So the current a chip draws in a clock cycle depends on how many bits change, and which ones. Registers and buses holding secret-dependent values therefore draw secret-dependent current. Models used in the research literature approximate this with the Hamming weight (the number of 1s in a value) or the Hamming distance (the number of bits that flip between two values). Moving from 0x0F to 0xF0 flips all 8 bits; storing 0x00 has Hamming weight 0 and 0xFF has 8.
Timing
If the time an operation takes depends on secret data, measuring time reveals the data. The classic example is comparing a secret byte by byte and returning at the first mismatch. A guess with the correct first byte takes slightly longer than one without, so an attacker who can time many attempts can find the secret one byte at a time.
| Comparison | Worst-case guesses for a 16-byte secret |
|---|---|
| Constant time (no leak) | 256^16, about 3.4 × 10^38 |
| Early exit, timing measurable | 256 per byte × 16 bytes = 4,096 |
That collapse, from astronomically many to a few thousand, is why timing leaks matter. Paul Kocher's 1996 paper showed timing attacks on real implementations of RSA and Diffie-Hellman, where the time of modular exponentiation depended on key bits. Caches add another timing channel: whether data was in the cache changes how long an access takes.
Power analysis
Simple power analysis (SPA) reads a secret directly from one or a few power traces, when different operations look different: a square followed by a multiply in a naive RSA exponentiation, for example, shows the key bits as a visible pattern. Differential power analysis (DPA), introduced by Kocher, Jaffe and Jun in 1999, works when no single trace shows anything. Many traces are recorded while the device processes known inputs; for each guess of a small part of the key, the analyst predicts an intermediate value (often its Hamming weight) and correlates the predictions with the measured power. The right guess correlates; the wrong ones don't. The statistics average away noise, so a leak far below the noise of one trace is still found.
Electromagnetic emanation
The same switching currents radiate. A small near-field probe over the right part of a die can pick up the activity of one block while ignoring others, so EM analysis can be more targeted than measuring the whole chip's supply current. The analysis methods are the same as for power.
Why this is an ECE problem
- The leak is created by circuits: switching activity, cache behavior and timing paths are designed by hardware engineers.
- Countermeasures cost area, power and performance, so they are design trade-offs, made at RTL and in layout.
- Certification for smart cards, payment terminals and secure elements requires side-channel testing, so verification teams run these measurements on their own designs.
Common mistakes
- Thinking strong cryptography is enough. AES is secure mathematically; a leaky implementation is not.
- Assuming noise protects you. Averaging many traces removes noise.
- Writing secret-dependent branches or table lookups in firmware.
- Testing only function, never leakage, before a security-critical chip ships.
Check your understanding
- Q1. Why does CMOS power depend on data? Answer: dynamic power is drawn when nodes switch, and which nodes switch depends on the values being processed.
- Q2. Why does an early-exit compare leak? Answer: its running time grows with the number of leading bytes that match, so timing reveals how much of a guess is right.
- Q3. What does DPA add over SPA? Answer: statistics over many traces, so a leak smaller than the noise in one trace can still be detected.
The series
Related
Sources
Kocher, 'Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems', CRYPTO 1996; Kocher, Jaffe and Jun, 'Differential Power Analysis', CRYPTO 1999; Mangard, Oswald and Popp, Power Analysis Attacks: Revealing the Secrets of Smart Cards, Springer, 2007.
Last verified
The guess counts and Hamming weights are computed in the site's tests (lib/batch9Numbers.test.js) on 16 November 2026.