Side-Channel Analysis

Research
Introduced by
Paul Kocher
Year
1996
Type
physical side-channel exploitation
Family
Implementation attack

What does it do?

Side-channel analysis is a family of attacks that exploit unintended observable behaviour of a cryptographic implementation, such as its execution time, power consumption, electromagnetic emissions or cache behaviour, to recover secret keys.

Paul Kocher's 1996 timing attacks on implementations of Diffie-Hellman, RSA, DSS and other systems introduced the approach, and differential power analysis followed in 1999. Because the leakage comes from how an algorithm is implemented rather than from its mathematics, defences centre on implementation-level measures such as constant-time code and physical countermeasures.

The intuition behind the method

An algorithm can be mathematically sound and still leak through its implementation. If the time an operation takes, the power a device draws, or the pattern of memory accesses depends on secret data, an observer who can measure that quantity gains information about the key. The attacker collects many such observations for known inputs and tests key hypotheses against them. The cipher's mathematics is untouched; it is the physical execution of the computation that reveals the secret.

History

Kocher's 1996 timing attacks on implementations of Diffie-Hellman, RSA, DSS and other systems showed that physical measurement of execution time could expose secret keys in public-key implementations. Differential power analysis, introduced by Kocher, Jaffe and Jun in 1999, extended the threat model to power consumption measurements. The field has since grown to include cache-based attacks such as Spectre and Meltdown, and studies of particular cache structures, for example the L1D cache way predictors of AMD processors (Lipp et al., 2020), as well as electromagnetic and acoustic analysis. Industry responses include constant-time coding practices and hardware security modules.

When to use it

Choose side-channel analysis when the question is whether a deployed or prototype implementation of a cryptographic algorithm leaks secret-dependent information, for example in smart cards, embedded devices or software sharing hardware with untrusted code. Timing analysis suits cases where run time can be observed, while power or electromagnetic analysis requires physical access to the device. Do not use a side-channel evaluation as a test of an algorithm's mathematical strength, since it says nothing about resistance to cryptanalysis. It also does not replace code review of secret-dependent branches and memory accesses.

Limitations and considerations

  • Requires access to the device or to a channel correlated with it; for power and electromagnetic methods this means physical proximity or direct access.
  • Statistical analysis needs enough measurements for the signal to stand out from noise, so a noisy or well-shielded device may require far more data or may resist the attack.
  • Countermeasures such as constant-time code and power randomisation reduce leakage, but the reduction is partial and has to be checked for each platform and build.
  • Results are specific to the implementation, device and measurement setup; a negative result on one device does not establish safety on another.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Targets implementation behaviour, so an algorithm with no known mathematical weakness can still be broken if its execution depends on secret data, as Kocher's timing attacks on several public-key systems showed.
  • Works from observations of execution (time, power, emissions or cache state) rather than from solving the underlying mathematical problem.
  • Lets a tester evaluate the implementation that will actually be deployed, including compiler output and hardware behaviour, which analysis of the algorithm alone does not capture.
  • Provides a concrete way to check countermeasures: a constant-time or masked implementation can be measured again to see whether the observable leakage has been reduced.

Applications

  • Evaluating security of cryptographic implementations in smartcards and hardware security modules
  • Testing embedded systems and IoT devices for side-channel vulnerabilities
  • Developing countermeasures and validating effectiveness against various side-channel attacks
  • Assessing whether key material could be recovered through physical measurement of a device, subject to the access and setup limits described above

How it works

How it works

1

Record a measurable quantity produced while the cryptographic operation runs. Depending on the attack, this is elapsed time, power consumption, electromagnetic emanations, or cache access behaviour.

2

Gather many such measurements while the device processes varying inputs under the same secret key. The attack depends on the leakage repeating across executions, and the number of measurements needed depends on how much noise the recordings contain.

3

Compare the measurements with predictions derived from hypothesised key values or intermediate values, and apply a statistical test to each hypothesis. The hypothesis whose predictions agree best with the observations is the candidate. Differential power analysis, introduced by Kocher, Jaffe and Jun (1999), is an example of this approach applied to power measurements. A candidate is meaningful only if it stands out clearly from the alternative hypotheses and remains stable when the measurements are repeated or split into subsets. Leakage that is small relative to noise can look absent when too few traces are collected, so a weak or null result does not by itself establish that the implementation is safe.

4

Select the key hypothesis, or key portion, that shows the strongest statistical agreement with the data. Where the operation can be attacked in separable parts, the key is recovered part by part; where leakage is weak or entangled, the recovery may fail.

Common pitfalls

  • Assuming that a sound algorithm gives a sound implementation: secret-dependent branches or table lookups can leak even when the cipher itself is secure.
  • Validating constant-time behaviour only in source code. Compiler optimisations and hardware can reintroduce secret-dependent timing or power variation, so the compiled and deployed code should be measured.
  • Assuming the device cannot be measured. Many embedded and IoT devices are physically accessible, and in shared-hardware environments other processes may be able to observe cache state.
  • Treating one clean measurement run as proof of safety. Leakage that is small relative to noise can look absent when too few traces are collected.

Frequently asked questions

What is a constant-time implementation?

A constant-time implementation avoids secret-dependent control flow and secret-dependent memory addresses, so its execution time does not vary with secret values such as key bits. This removes the timing dependence that a timing attack exploits, but it does not by itself eliminate power or electromagnetic leakage, and cache-based leakage has to be assessed separately on the target platform.

Can I protect against all side-channel attacks?

Completely eliminating side-channel leakage is impractical. Layered defences, such as constant-time algorithms, power randomisation and physical shielding, reduce the risk to an acceptable level for a given threat model.

Is timing attack protection built into cryptographic libraries?

Whether a cryptographic library is constant-time is a property of its specific implementation and version, so it should be checked in its documentation and by measurement rather than assumed.

What is differential power analysis (DPA)?

DPA statistically compares power consumption measurements with predictions based on hypothesised key values. When the measured pattern agrees better with one hypothesis than with the others, that hypothesis is taken as the key, or key portion.

Are cache attacks practical?

Spectre and Meltdown demonstrated practical exploitation of cache-related side channels on modern processors. Whether a particular secret can be recovered depends on the system and the attacker's position, so these results should not be generalised to all key material.

Related methods

Sources

  1. Kocher, P. C. (1996). Timing attacks on implementations of Diffie-Hellman, RSA, DSS, and other systems. In Advances in Cryptology - CRYPTO 1996, LNCS 1109, pp. 104-113.

    Open DOI reference
  2. Kocher, P., Jaffe, J., & Jun, B. (1999). Differential power analysis. In Advances in Cryptology - CRYPTO 1999, LNCS 1666, pp. 388-397.

    Open DOI reference
  3. Take A Way: Exploring the Security Implications of AMD's Cache Way Predictors (Lipp et al., 2020), p. 2