What is Timing attack?
A side-channel attack exploiting processing time that varies with secret values, prevented by constant-time implementation.
Japanese name: タイミング攻撃
A side-channel attack exploiting processing time that varies with secret values, prevented by constant-time implementation.
Japanese name: タイミング攻撃
A clear example is the comparison of an authentication code. If the code is compared one byte at a time from the start and the comparison stops at the first mismatch, the time taken depends on how many leading bytes match. An attacker can look for the value that makes the time slightly longer and so guess one byte at a time from the start. A brute-force search of a 16-byte code has 256 to the 16th power possibilities. With this method the candidates to examine fall to at most 256 × 16, or 4096.
The same thing happens in cryptographic computation. If an extra calculation is done only when a key bit is 1, the key bits leak through the computation time. With table lookups, the time changes depending on whether the entry looked up is in the cache. Some instructions also take a different time depending on the values they handle. The difference in a single run is tiny, but it can be detected by measuring many times and averaging.
The basic countermeasure is to write code whose processing time does not vary with secret values. A comparison should process all bytes without stopping early, accumulate the differences, and decide only once at the end. Merely adding a random delay to the response is not enough, because averaging over many measurements cancels it. Another method hides the values used in the computation with random numbers before processing them.
Answer: C. It exploits processing time varying with secret values; implement code that takes the same time regardless of secrets (constant-time)
In an implementation that does extra work only when a key bit is 1, for example, repeated timing measurements reveal the key bits. The countermeasure is constant-time code, where branches, loop counts and memory access locations do not depend on secrets. Merely slowing everything down or adding random delays is not enough, because attackers can average away the noise with more measurements.
Not sufficiently. The delay disappears when averaged, so with more measurements the original time difference becomes visible again.
It is safer to use the constant-time comparison function that a cryptographic library provides. Ordinary string comparison functions stop early in order to be fast.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.