Attacking the device, not the mathematics
A cipher can be mathematically sound and still give its key away through the machine that runs it. A working chip uses power, takes time, gives off radio signals and even makes sound, and each of these can reveal what it is doing. A chip can also be pushed into making a mistake that exposes its secret. No background beyond the earlier cryptography is assumed. These attacks matter wherever an attacker can get close to a device: payment cards, door tokens, phones and shared servers.
By the end of this unit you will be able to:
- Explain how a side-channel attack recovers a key from power use, radio signals, sound or timing
- Calculate how a timing leak shortens a search for a secret
- Explain how fault injection works and how a device resists it
- Choose controls for emanations: TEMPEST, shielding, Faraday cages, white noise and control zones
- Tell apart side-channel, timing and fault injection attacks
A parking permit card that told its secret
An illustrative example
A council issues residents' parking permits as smart cards. Each card holds a secret key and proves itself to the barrier using AES, a cipher nobody has broken.
A university researcher borrows a card. She connects it to a reader and a cheap measuring device, and records the card's electricity use while it answers the reader five hundred times. By the evening she has the key and can make copies of the card.
The researcher never broke AES. What did she attack instead?
Side channels: what a working device gives away
A safe opened by listening
An old-fashioned safe cracker does not try every combination. He presses an ear to the door and turns the dial. A faint change in the click tells him when one number is right, so he finds the numbers one at a time.
A side-channel attack recovers a secret from what a device leaks while it works, not from the mathematics of its . The leak is a physical by-product: the power the chip draws, the time it takes, the radio signals it gives off, the sound it makes. Each changes slightly with the key being used. Many measurements, compared with statistics, turn those slight changes into the key.
- Power analysis: a small resistor in a smart card's power line records its electricity use. Reading one trace directly, where the 16 rounds of DES can be seen, is simple power analysis (SPA). Comparing many traces with statistics to reveal the key is differential power analysis (DPA).
- Electromagnetic leakage: the same changes appear in radio signals from the chip, picked up by an antenna close by without touching it.
- Sound: researchers extracted 4,096-bit RSA keys from laptops within an hour, using a mobile phone placed next to them or a sensitive microphone 4 metres away.
- Cache timing: the speed of memory depends on which parts of a table the cipher used. A program sharing the processor can measure this directly. In 2005 a researcher recovered a complete AES key just by timing a server's replies over a network.
These are implementation attacks: the cipher is sound, and the way a device carries it out is not. Many need no contact with the inside of the device, so they leave no trace on it.
Timing attacks and constant-time code
A timing attack is a side-channel attack that measures how long a device takes to carry out an operation on a secret. Programs often take a shortcut when they can: stopping a comparison at the first wrong character, or skipping a step when a bit of the key is zero. Each shortcut makes the time depend on the secret.
In 1996 Paul Kocher showed that careful timing of private key operations could reveal Diffie-Hellman secrets and factor RSA keys. The attack was cheap and often needed only known . Smart cards and servers reachable across a network were both at .
- Constant-time code
- Constant-time code is written so that every input takes the same time, with no shortcut that depends on the secret. It is the main defence, and it is hard to get right on modern processors.
- Blinding
- Mixing a fresh random value into the input before the private key operation, and removing it afterwards, so that the time measured bears no relation to the attacker's input.
- Random delay
- Adding a random pause. It is weak: the attacker averages it out by taking more measurements.
Common misconception
“Adding a random delay to each answer stops a timing attack.”
The delay averages out. The attacker needs more measurements, not new skill. The fix is code whose time does not depend on the secret.
Fault injection: forcing the device to make a mistake
In fault injection the attacker disturbs a device while it calculates, so that it makes an error, then studies the wrong answer. The attack is active: it changes the device's behaviour, where a side-channel attack only watches.
The disturbance can be a sudden change in the supply voltage, a strong electromagnetic field, or a temperature outside the device's working range. It can also be a glitch in the device's clock, or a flash of laser light on the chip. A wrong result can reveal far more than a right one. In 1997 researchers showed that one faulty RSA signature from a common fast method of signing was enough to factor the key.
- Check before release: compute the result twice, or verify a signature, and give out nothing if the two disagree.
- Sense the environment: detect voltage or temperature outside the safe range and erase the keys at once.
- Shield and enclose the chip so that fields and probes cannot reach it.
Emanations and the controls that contain them
Emanations are signals that equipment gives off without meaning to: radio waves from screens, cables and keyboards, and sound. An eavesdropper with suitable receivers can rebuild what was on a screen or typed on a keyboard from them. TEMPEST is the name used for the study and control of these compromising emanations. The NIST catalogue of security controls includes one for protecting systems from information leaking through electromagnetic signals.
| Control | How it works | Typical use |
|---|---|---|
| TEMPEST-approved equipment | Designed and tested to give off very little signal | Machines handling classified information |
| Shielding | Metal casing and shielded cables absorb or reflect signals | Equipment and cable runs in sensitive rooms |
| Faraday cage | A complete enclosure of conducting mesh or sheet that blocks signals in both directions | A whole room, or a box for phones and tokens |
| White noise | Transmits random signal or sound that drowns the real one | Rooms where shielding is impractical |
| Control zone | Keeps an area around the equipment clear of uncontrolled people, so signals fade before anyone can receive them | A sensitive facility with a secured surround |
The controls combine. A room may use shielded equipment inside a Faraday cage, with a control zone around the building.
Defences in hardware, and three attacks told apart
A device that holds keys can be built to resist attack. Tamper evidence shows that someone has interfered, through seals or coatings that cannot be removed unnoticed. Tamper resistance makes interference hard, and at its strongest detects an attempt and erases the keys.
The United States standard for modules, FIPS 140-3, sets four increasing levels. As its predecessor described them, the lowest asks for production-grade parts. The second adds tamper evidence. The third must detect and respond to attempts to reach the keys. The fourth adds protection against voltage and temperature outside the normal range, the conditions fault injection relies on.
| Point | Side-channel | Timing | Fault injection |
|---|---|---|---|
| What the attacker does | Watches a physical by-product | Measures how long operations take | Disturbs the device to cause an error |
| Passive or active | Passive | Passive | Active |
| Typical example | Power analysis of a smart card | A comparison that stops at the first wrong character | A voltage change during an RSA signature |
| Main defence | Shielding, noise in the leak, masked computation | Constant-time code, blinding | Result checks, sensors, erasing keys on tamper |
Side-channel watches, fault injection pushes. Timing is the side channel of time.
Worked example: How a timing leak shortens a search
A door entry pad checks a 4-digit code. Its program compares the code entered with the stored code one digit at a time and stops at the first digit that is wrong. Each correct digit adds a small, measurable delay before the pad says no.
- Without the leak, an attacker must try codes blindly: 10 × 10 × 10 × 10 = 10,000 possibilities.
- With the leak, the attacker tries 0 to 9 in the first position and watches for the slower refusal. That takes at most 10 tries.
- The attacker fixes that digit and repeats for the second, third and fourth positions: at most 10 tries each.
- In all: at most 4 × 10 = 40 tries, against 10,000.
- The fix is a comparison that always checks all four digits and takes the same time whatever is entered.
The timing leak turned a search of 10,000 codes into one of 40. Constant-time comparison closes it, and limiting failed attempts adds a second barrier.
A question, worked through
A security manager at a firm that makes card payment terminals receives a report from an outside tester. The terminal's software takes measurably different times to process cards depending on bits of the secret key it uses. The terminals are sold to shops and stand in public places. The development lead proposes a fix that can ship within one month.
Which fix BEST removes the weakness the tester found?
Decide on your answer, then open the reasoning
- The weakness is a timing side channel: the time taken depends on the key.
- Rule out c. The cipher is not the problem. A longer key processed by the same code leaks in the same way.
- Rule out d. Shielding stops electromagnetic leakage, a different side channel. The time a reply takes is visible from outside any case.
- Between a and b: a random pause adds noise, and an attacker removes it by taking more measurements.
- Constant-time code removes the link between the key and the time. Option a is the answer.
Answer: A. Rewrite the key operations so they take the same time whatever the key
Choosing between good answers
- A scenario has an attacker measuring power, radio signals, sound or time
- it is a side-channel attack. The cipher is not at fault, so a stronger cipher is not the fix.
- A scenario has an attacker changing voltage, temperature or fields to make a device err
- it is fault injection. Choose result checks, environmental sensors and erasing keys on tamper.
- Options for a timing leak include random delays and constant-time code
- choose constant-time code. Random delays are averaged out.
- A question asks how to stop eavesdropping on signals from screens and cables
- choose emanation controls: TEMPEST equipment, shielding, Faraday cages, white noise or a control zone.
Check your understanding
4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 4
What to remember
- A side-channel attack reads a key from what a working device leaks: power, radio signals, sound or time.
- A timing attack measures how long operations take. Constant-time code is the defence; random delays only slow the attacker.
- Fault injection disturbs a device to make it err, then studies the wrong answer. Checks, sensors and erasing keys defend.
- TEMPEST is the study and control of emanations. Shielding, Faraday cages, white noise and control zones contain them.
- FIPS 140-3 sets four levels for cryptographic modules, rising from basic parts to tamper response and environmental protection.
Say it from memory
What is a side-channel attack? Give three channels and one example.
An attack that recovers a secret from what a device leaks while it works, not from the cipher's mathematics. Channels: power use, electromagnetic radiation, sound, timing, cache behaviour. Example: power analysis of a smart card reveals its key from many power traces. Defences include shielding, masking the computation and constant-time code.
How does a fault injection attack work, and how does a device defend against it?
The attacker disturbs the device while it calculates, by a voltage change, a clock glitch, a flash of light, a strong electromagnetic field or a temperature outside its range, and studies the wrong result. One faulty RSA signature can reveal the key. Defences: check results before releasing them, sense abnormal conditions and erase keys, shield the chip. It is active; a side-channel attack only watches.
What does a timing attack measure, and what is the main defence?
How long a device takes to carry out operations on a secret, because shortcuts make the time depend on the key or password. Kocher showed in 1996 that this can reveal RSA and Diffie-Hellman keys. The main defence is constant-time code, with blinding for public key operations. Random delays are weak because they average out.
How does simple power analysis differ from differential power analysis?
Simple power analysis reads one power trace directly, in which, for example, the 16 rounds of DES can be seen. Differential power analysis compares many traces with statistics to reveal the key. Both are implementation attacks: the cipher is sound, and the way the device carries it out is not.
What is a Faraday cage, and how do white noise and a control zone contain emanations?
A Faraday cage is a complete enclosure of conducting mesh or sheet that blocks signals in both directions. White noise transmits random signal or sound that drowns the real one. A control zone keeps an area around the equipment clear of uncontrolled people, so signals fade before anyone can receive them.
How does tamper evidence differ from tamper resistance, and which FIPS 140-3 level adds protection against abnormal voltage and temperature?
Tamper evidence shows that someone has interfered, through seals or coatings that cannot be removed unnoticed. Tamper resistance makes interference hard, and at its strongest detects an attempt and erases the keys. The fourth level adds protection against voltage and temperature outside the normal range, the conditions fault injection relies on.
Sources
- Side-channel attack (NIST CSRC Glossary), National Institute of Standards and TechnologyA side-channel attack as one enabled by leakage of information from a physical cryptosystem, through timing, power consumption and electromagnetic and acoustic emissions.
- Differential Power Analysis, Paul Kocher, Joshua Jaffe and Benjamin Jun (Cryptography Research)Power consumption measured through a small resistor revealing keys from tamper-resistant devices such as smart cards, with the 16 DES rounds visible in a trace; simple power analysis as directly interpreting traces and differential power analysis as statistical analysis of many traces.
- RSA Key Extraction via Low-Bandwidth Acoustic Cryptanalysis, Daniel Genkin, Adi Shamir and Eran TromerFull 4,096-bit RSA keys extracted from laptops within an hour from their sound, using a mobile phone beside them or a microphone 4 metres away.
- Cache-timing attacks on AES, Daniel J. Bernstein, University of Illinois at ChicagoComplete AES key recovery from cache timings of a network server on another computer.
- Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems, Paul C. Kocher (Cryptography Research)Timing of private key operations revealing Diffie-Hellman exponents and RSA keys, often with only known ciphertext; the difficulty of constant-time code, the weakness of random delays and blinding as the better defence.
- NISTIR 8214: Threshold Schemes for Cryptographic Primitives, National Institute of Standards and TechnologyFaults injected by changing the supply voltage or applying a strong electromagnetic field, and side channels such as execution time, energy and electromagnetic emanations that need no physical contact.
- On the importance of checking cryptographic protocols for faults, Dan Boneh, Richard DeMillo and Richard Lipton (Stanford University publication page)A single erroneous RSA signature from an implementation based on the Chinese Remainder Theorem being enough to break the key.
- NIST CSRC Glossary: TEMPEST, NISTTEMPEST as the investigation, study and control of unintentional compromising emanations from equipment.
- SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations, NISTControl PE-19, protecting a system from information leakage due to electromagnetic signal emanations.
- FIPS 140-3: Security Requirements for Cryptographic Modules, National Institute of Standards and TechnologyFour increasing, qualitative levels of security for cryptographic modules, covering physical security and non-invasive security, superseding FIPS 140-2.
- FIPS 140-2: Security Requirements for Cryptographic Modules (superseded), National Institute of Standards and TechnologyThe physical security at each level: production-grade parts, then tamper evidence, then tamper detection and response, then protection against voltage and temperature outside the normal range.
- Optical Fault Induction Attacks, Sergei P. Skorobogatov and Ross J. Anderson, University of Cambridge Computer Laboratory (CHES 2002)Faults induced by illuminating a chip with a flashgun or laser pointer, extending earlier glitching by voltage transients on the power or clock line.