Abstract
This paper investigates the effect of bucketing in security against timing-channel attacks. Bucketing is a technique proposed to mitigate timing-channel attacks by restricting a system’s outputs to only occur at designated time intervals, and has the effect of reducing the possible timing-channel observations to a small number of possibilities. However, there is little formal analysis on when and to what degree bucketing is effective against timing-channel attacks. In this paper, we show that bucketing is in general insufficient to ensure security. Then, we present two conditions that can be used to ensure security of systems against adaptive timing-channel attacks. The first is a general condition that ensures that the security of a system decreases only by a limited degree by allowing timing-channel observations, whereas the second condition ensures that the system would satisfy the first condition when bucketing is applied and hence becomes secure against timing-channel attacks. A main benefit of the conditions is that they allow separation of concerns whereby the security of the regular channel can be proven independently of concerns of side-channel information leakage, and certain conditions are placed on the side channel to guarantee the security of the whole system. Further, we show that the bucketing technique can be applied compositionally in conjunction with the constant-time-implementation technique to increase their applicability. While we instantiate our contributions to timing channel and bucketing, many of the results are actually quite general and are applicable to any side channels and techniques that reduce the number of possible observations on the channel. It is interesting to note that our results make non-trivial (and somewhat unconventional) uses of ideas from information flow research such as channel capacity and refinement order relation.
Introduction
Side-channel attacks aim to recover a computer system’s secret information by observing the target system’s side channels such as cache, power, timing and electromagnetic radiation [13,18,20,21,25,27–29,36,46]. They are well recognized as a serious threat to the security of computer systems. Timing-channel (or simply timing) attacks are a class of side-channel attacks in which the adversary makes observations on the system’s running time. Much research has been done to detect and prevent timing attacks [1,3,4,6,8,11,22,24,26,30,31,35,51].
Bucketing is a technique proposed for mitigating timing attacks [8,16,30,31,51]. It restricts the system’s outputs to only occur at pre-determined and input-independent (but possibly non-periodic and security-parameter-dependent) time intervals. Therefore, bucketing has the effect of reducing the possible timing-channel observations to a small number of possibilities. This is at some cost of the system’s performance because outputs must be delayed to the next bucket time. Nonetheless, in comparison to the constant-time implementation technique [1,3,6,11,24,26] which restricts the system’s running time to be independent of secrets, bucketing is often said to be more efficient and easier to implement as it allows running times to vary depending on secrets [30,31].1
Sometimes, the terminology “constant-time implementation” is used to mean even stricter requirements, such as requiring control flows to be secret independent [3,11]. In this paper, we use the terminology for a more permissive notion in which only the running time is required to be secret independent.
In this paper, we formally study the effect of bucketing on security against adaptive timing attacks. To this end, first, we review a formal notion of security against adaptive side-channel-observing adversaries, called
Next, we show that bucketing alone is in general insufficient to guarantee security against adaptive side-channel attacks by presenting a counterexample that has only two timing observations and yet is efficiently attackable. This motivates a search for conditions sufficient for security. We present a condition, called secret-restricted side-channel refinement (
Because of the insufficiency of bucketing mentioned above, applying bucketing to an arbitrary system may not lead to a system that satisfies
Finally, we show that the bucketing technique can be applied in a compositional manner with the constant-time implementation technique. Specifically, we show that when a system is a sequential composition of components in which one component is constant-time and the other component is A counterexample which shows that bucketing alone is insufficient for security against adaptive side-channel attacks (Section 2.1). A condition A condition A compositional approach that combines bucketing and the constant-time technique (Section 3.3).
As remarked before, these results are given in terms of a formal notion of security called
While the paper focuses on timing channels and bucketing, many of the results are actually quite general and are applicable to side channels other than timing channels. Specifically, aside from the compositional bucketing result that exploits the “additive” nature of timing channels (cf. Section 3.3), the results are applicable to any side channels and techniques that reduce the number of possible side-channel observations.
Our results make use of ideas from (quantitative) information flow research such as refinement order relation [33,34,38,48] and channel capacity [5,9,32,39,48,49]. It is interesting to note that we use the ideas somewhat unconventionally. Rather than using them directly to, for example, derive the degree of security in terms of information theoretic measures such as Shannon entropy, we use them indirectly, for example, to bound the degree of influence that attacker-controlled inputs have on side-channel outputs. We show that, combined with certain additional conditions and program transformations, this allows us to derive the security of the final system.
The rest of the paper is organized as follows. Section 2 formalizes the setting, and defines
A preliminary version of this paper appeared in [43]. The present paper substantially improves that version by extending the key results. Namely, the conditions The condition called low-input side-channel non-interference ( The extensions (1) and (2) together improve the An additional example demonstrating the usefulness of the An extended analysis of the leaky login program is added. The analysis shows a limitation with the permissive definition of bucketing that is used in this paper (and in [43]) (Example 3.15 in Section 3.2).
In summary, the main technical contributions given in Sections 3.1, 3.2 and 3.3 (same section numbers are used in [43]) have all been substantially extended to allow improved security analysis. Also, as a side effect of the extended results, we were able to “fix” the bugs in the examples of [43] where we claimed security bounds that cannot be derived by the results in that version (the authors’ online copy of [43] corrects the bug by stating weaker bounds [44]). The extensions in this submission allow the derivation of the strong bounds.
Formally, a system (or, program) is a tuple
We restrict to deterministic systems in this paper. Extension to probabilistic systems is left for future work.
For a system C and
Also, for generality, we intentionally leave the computation class of adversaries unspecified. The methods presented in this paper work for any computation class, including the class of polynomial time randomized algorithms and the class of resource-unlimited randomized algorithms. The former is the standard for arguing the security of cryptography algorithms, and the latter ensures information theoretic security. In what follows, unless specified otherwise, we assume that the computation class of adversaries is the class of resource-unlimited randomized algorithms.
As standard, we define security as the bound on the probability that an adversary wins a certain game. Let f be a function from
Let
Roughly,
A slight difference is that the definition in [7] is not asymptotic, i.e., it asserts
By abuse of notation, we often implicitly treat an expression e on the security parameter n as the function Consider the program shown in Fig. 1 written in a C-like language. The program is an abridged version of the timing insecure login program from [6]. Here,
Timing insecure login program. We formalize the program as the system C where for all For all For all For a secret Next, we consider the security of the program from Example 2.2 but with bucketing applied. Here, we assume a constant number of buckets, k, such that the program returns its output at time intervals A similar analysis can be done for any strictly sub-linear number of buckets. For all For all Roughly, the bound for the ideal login program follows from the fact that the probability of guessing an element in a set of size M in X tries is 
Here,
where
Note that in Example 2.3, the parameters f and ϵ in
As we shall see later in the paper, the main results of the paper (cf. Theorem 3.4, Theorem 3.11, Corollary 3.12 and Theorem 3.21) show, given a system with or without bucketing, how to transfer the regular-channel security of the system in which the adversary only observes the regular channel (cf. Section 3.1) to that for the case when the adversary observes both the regular and the side channel. Some amount of security is lost in the transfer and each theorem stipulates how much security is lost in terms of the change in the f and ϵ parameters. As we shall show, the statements of the theorems say that only the ϵ parameter is affected, possibly giving a false impression that bucketing only affects the probability of the attack success. However, due to the parameter correlation, the results actually imply that the change in the ϵ parameter may need to be compensated by a change in the f parameter, that is, the transfer also affects the number of queries the adversary needs to make to recover the secret.
Insufficiency of bucketing
We show that bucketing is in general insufficient to guarantee the security of systems against adaptive side-channel attacks. In fact, we show that bucketing with even just two buckets is insufficient (two is the minimum number of buckets that can be used to show the insufficiency because having only one bucket implies that the system is constant-time and therefore is secure). More generally, our result applies to any side channels, and it shows that there are systems with just two possible side-channel outputs and completely secure (i.e., non-interferent [23,47]) regular channel that is efficiently attackable by side-channel-observing adversaries.
Consider the system such that, for all For all For all
Note that the regular channel
We remark that the above attack is efficient. That is, the attacker recovers the secret with a high probability with only a small amount of queries. This is in contrast to the bucketed leaky login program from Example 2.3 which, while still leaking information through the side channel, is secure in the sense that any attack that recovers the secret with a high probability must make an exponential number of queries. Secondly, we remark that leaking information does not mean that attacker can always recover the secret with a high probability, even with an unlimited number of queries. For instance, if a line
Sufficient conditions for security against adaptive side-channel attacks
In this section, we present conditions that guarantee the security of systems against adaptive side-channel-observing adversaries. The condition
Secret-restricted side-channel refinement condition
We present the secret-restricted side-channel refinement condition (
We begin by introducing preliminary notions that we shall use to state the
Regular-channel security. We write
Secret restriction. Let us write
Refinement order relation. Let us fix a system
Let T be an indexed family of sets of secrets such that
Let
Let T be an indexed family of sets of secrets such that
Suppose for contradiction that
We construct such
We are now ready to formally state the
Let For all For all It is easy to relax the condition to also be asymptotic so that the refinement order relation only needs to hold for large n.
We informally describe why
Suppose C satisfies
There exists
Suppose for contradiction that C is not
We now show the construction of
We remark about a restricted case of the
Recall the bucketed leaky login program from Example 2.3. We show that the program satisfies the
Recall f such that
To effectively apply Theorem 3.4, one needs to find a suitable secret restriction X on which the system’s regular channel is secure and the side channel satisfies the refinement order relation with respect to the regular channel. As also observed in a prior work [48], the refinement order relation is a 2-safety property [15,42] for which there are a number of effective verification methods [2,6,12,37,40]. For instance, self-composition [3,4,10,19,42] is a well-known technique that can be used to verify arbitrary 2-safety properties.
We note that a main benefit of Theorem 3.4 is separation of concerns whereby the security of regular channel can be proven independently of side channels, and the conditions required for side channels can be checked separately. For instance, a system designer may prove the regular-channel We make some additional observations regarding the Secondly, Theorem 3.4 says that, given a secret restriction X, if the regular channel of the system is Finally, condition (1) of
While
We show that the system satisfying
As we shall show next, while the condition is not permissive enough to prove security of the leaky login program (cf. Examples 2.2, 2.3 and 3.5), it covers interesting scenarios such as fast modular exponentiation (cf. Example 3.13). Also, as we shall show in Section 3.3, the condition may be used compositionally in combination with the constant-time implementation technique [1,3,11,26] to further widen its applicability.
For a set A and an equivalence relation
(
).
We define the low-input side-channel capacity of C for
Intuitively, low-input side-channel capacity measures the number of equivalence classes of low inputs (i.e., attacker-controlled inputs) that can be obtained by observing the side-channel output, where two low inputs are considered equivalent if they yield the same side-channel output for each high input (i.e., secret). It is interesting to note that this is the standard definition of channel capacity for deterministic systems [5,9,32,39,48,49], except that the roles of high inputs and low inputs are reversed.8
In QIF literature, channel capacity is typically defined to be the log of the number of equivalence classes. Here, we use the non-log form which turns out to be more convenient for our purposes.
As a special case, we say that C is low-input side-channel non-interferent when
We now define the bounded low-input side-channel capacity condition.
Let C is regular-channel For all It is easy to relax the notion to be asymptotic so that channel capacity only needs to be bounded for large n.
We remark that, when
The
Let C be a system and For all For all
Roughly, k-bucketing partitions the side channel outputs into k number of buckets. We note that our notion of “bucketing” is quite general in that it does not specify how the side channel outputs are partitioned into the buckets. Indeed, as we shall show next, the security guarantee derived by
We shall make use of the following lemma in the proof of
Let C be a system,
For each
We show the if direction. We have that
We show the only-if direction. Let
We now state and prove the
Suppose that C satisfies
For all
Let
We show that X satisfies (♣). Fix
Therefore, it suffices to show that
It remains to show that the condition (1) of
As a corollary of Theorems 3.4 and 3.11, we have the following.
Suppose that C satisfies
Note that as k approaches 1 (and hence the system becomes constant-time), the security bound of
We remark that Theorem 3.11 and Corollary 3.12 substantially improve the corresponding results from [43]. First, the results in [43] were restricted only to the low-input side-channel non-interference, that is, the case where ℓ is restricted to be 1 in
For the same example, [43] erroneously asserts the strong bound which cannot be actually derived by the results in that paper (the error is corrected in the authors’ online copy of that paper by asserting a weaker bound [44]).
Fast modular exponentiation is an operation that is often found in cryptography algorithms such as RSA [27,35]. Figure 2 shows its implementation written in a C-like language. It computes
Fast modular exponentiation.
However, assuming that running time of the operation
This is admittedly an optimistic assumption. Indeed, proposed timing attacks exploit the fact that the running time of the operation can depend on
For all
For all
Let the computation class of adversaries be the class of randomized polynomial time algorithms. Then, under the standard computational assumption that inverting modular exponentiation is hard, one can show that C satisfies
The latter holds because
We show another example demonstrating the usefulness of the For all For all For all
Roughly,
We have allowed
First, we show that
We cannot apply
Unfortunately, as we shall show next, there cannot be such a condition if bucketing is formalized in the very permissive way as we have done in this paper. Recall that in Definition 3.9, we have formalized bucketing to be a program transformation that partitions the side-channel outputs into some number of buckets, but placed no restriction on which side-channel outputs are put into which bucket. Below, we show a bucketed version of the leaky login program that is efficiently attackable by an adaptive adversary. As we shall show, bucketing partitions the side-channel outputs into only two buckets, but does so in a rather unrealistic manner. This bucketed leaky login program is formalized as the following system:
For all For all
Note that the side-channel outputs are partitioned into two buckets, that is, the side channel outputs 0 if the length of the matching prefix is even and outputs 1 if it is odd.
We show that the system is efficiently attackable. For
The attack on the system proceeds as follows. The adversary
The above shows that our definition of bucketing is too permissive for proving its effectiveness on the leaky login program. The issue here is that the definition allows an arbitrary, even unrealistic, partitioning of side-channel outputs. Note that partitioning odd timings from even timings cannot happen in reality because for any timing outputs
We make some additional observations regarding the
Secondly, we remark that it is easy to extend the channel capacity parameter ℓ in
We show that the
(Constant-time).
Let C is regular-channel For all
Note that
(
soundness).
If C satisfies
To motivate the combined application of
Figure 3 shows a simple, albeit contrived, program that we will use to motivate the combined approach. Here,
A non-constant-time program that cannot be made secure by globally applying bucketing.
The program can be formalized as the system For all For all
Note that the side channel outputs the sum of the high input and the low input. It is easy to see that the system is not constant-time (i.e., not
Also, it is easy to see that the system does not satisfy For all For all
We show that there exists an efficient adaptive attack against
Next, we present the compositional bucketing approach. Roughly, our compositionality theorem (Theorem 3.21) states that the sequential composition of a constant-time system with a system whose side channel has a bounded low-input channel capacity can be made secure by applying bucketing to only the non-constant-time component. As with
To state the compositionality theorem, we explicitly separate the conditions on side channels of
Let For all
We note that the definition of sequential composition specifically targets the case when the side channel is a timing channel, and says that the side-channels outputs are numeric values and that the side-channel output of the composed system is the sum of those of the components. Also, the definition leaves the composition of regular channels open, and allows the regular channel of the composed system to be any function from
(Compositionality).
Let
For all
Let
By an argument similar to that in the proof of Theorem 3.11, we can show that X satisfies (♣). Therefore, it suffices to show that C satisfies
As a corollary of Theorems 3.4 and 3.21, we have the following.
Let
We note that the notion of sequential composition is symmetric. Therefore, Corollary 3.22 implies that composing the components in the reverse order, that is,
The compositionality theorem suggests the following compositional approach to ensuring security. Given a system C that is a sequential composition of a component that satisfies the constant-time property (i.e., satisfies
Let us apply compositional bucketing to the system For all For all
Roughly,
Note that
Therefore, a similar analysis can be done for any strictly sub-exponential number of buckets.
The above example shows that compositional bucketing can be used to ensure security of non-constant-time systems that cannot be made secure by a whole-system bucketing. It is interesting to observe that the constant-time condition,
It is easy to see that sequentially composing components that satisfy
Suppose that
Fix
For each
Therefore, such compositions can be used freely in conjunction with the compositional bucketing technique of this section. We also conjecture that components that are made secure by compositional bucketing can themselves be sequentially composed to form a secure system (possibly with some decrease in the degree of security). We leave a more detailed investigation for future work.
As remarked in Section 1, much research has been done on defending against timing attacks and more generally side channel attacks. For instance, there have been experimental evaluations on the effectiveness of bucketing and other timing-channel mitigation schemes [16,22], and other works have proposed information-theoretic methods for formally analyzing the security of (deterministic and probabilistic) systems against adaptive adversaries [14,29].
However, few prior works have formally analyzed the effect of bucketing on timing channel security (or similar techniques for other side channels) against adaptive adversaries. Indeed, to our knowledge, the only prior work to do so are the series of works by Köpf et al. [30,31] who investigated the effect of bucketing applied to blinded cryptography algorithms. They show that applying bucketing to a blinded cryptography algorithm whose regular channel is IND-CCA2 secure results in an algorithm that is IND-CCA2 secure against timing-channel-observing adversaries. In addition, they show bounds on information leaked by such bucketed blinded cryptography algorithms in terms of quantitative information flow [5,32,39,49,50]. By contrast, we analyze the effect of applying bucketing to general systems, show that bucketing is in general insufficient against adaptive adversaries, and present novel conditions that guarantee security against such adversaries. In fact, the results of [30,31] may be seen as an instance of our
Next, we compare our work with the works on constant-time implementations (i.e., timing-channel non-interference) [1,3,6,11,24,26]. The previous works have proposed methods for verifying that the given system is constant-time [3,6,11,24] or transforming it to one that is constant-time [1,26]. As we have also discussed in this paper (cf. Theorem 3.18), it is easy to see that the constant-time condition directly transfers the regular-channel-only security to the security for the case with timing channels. By contrast, security implied by bucketing is less straightforward. In this paper, we have shown that bucketing is in general insufficient to guarantee the security of systems even when their regular channel is perfectly secure. And, we have presented results that show that, under certain conditions, the regular-channel-only security can be transferred to the side-channel-observing case to certain degrees. Because there are advantages of bucketing such as efficiency and ease of implementation [8,16,30,31,51], we hope that our results will contribute to a better understanding of the bucketing technique and foster further research on the topic.
Next, we remark on a recent work by Tizpaz-Niari et al. [45] that proposes an interesting mitigation scheme against timing channel attacks. Like every timing channel mitigation schemes, their scheme works by changing the time when an output is released to the adversary-observing environment. However, whereas bucketing simply delays the output of the (unmodified) system until the next time interval by blackbox monitoring, they propose to monitor the internal of the system so that different amounts of delay can be added for different runs of the system. Similar to bucketing, they use the delays to partition the outputs to a small set of possibilities. However, a much more flexible partitioning is possible thanks to the internal monitoring (indeed, an arbitrary partitioning can be achieved by this scheme). They argue the security in terms of quantitative information flow. However, they implement their scheme as a best effort method that uses dynamic analyses to estimate the timing channel leakage and adds delays based on run-time characteristics such as basic block calls, and therefore they lack a formal guarantee of security. Also, unlike our work which uses a parametric notion of security (i.e., (f, ϵ)-security), they use what they call a functional observation model of security, which amounts to security against an adversary who makes an unlimited number of queries (i.e., with every possible public inputs). Note that a parametric notion of security is required to argue the security of systems like the bucketed leaky login program, because an adversary is able to always recover the secret for that system if an unlimited number of queries to the side channel are allowed.
Finally, we remark on a work by Svenningsson and Sands [41] which is related to the
Conclusion and future work
In this paper, we have presented a formal analysis of the effectiveness of the bucketing technique against adaptive side-channel-observing adversaries. We have shown that bucketing is in general insufficient against such adversaries, and presented two novel conditions,
While we have instantiated our results to timing channels and bucketing, many of the results are actually quite general and are applicable to side channels other than timing channels. Specifically, aside from the compositional bucketing result that exploits the “additive” nature of timing channels, the results are applicable to any side channels and techniques that reduce the number of possible side-channel observations.
As future work, we would like to extend our results to probabilistic systems. Currently, our results are limited to deterministic systems, and such an extension would be needed to assess the effect of bucketing when it is used together with countermeasure techniques that involve randomization. We would also like to improve the conditions and the security bounds thereof to be able to better analyze systems such as the leaky login program shown in Examples 2.2, 2.3 and 3.5. Finally, we would like to extend the applicability of the compositional bucketing technique by considering more patterns of compositions, such as sequentially composing components that themselves have been made secure by compositional bucketing.
Footnotes
Acknowledgments
This work was supported by JSPS KAKENHI Grant Numbers 17H01720, 18K19787, 20H04162 and 20K20625, JSPS Core-to-Core Program, A.Advanced Research Networks, and Office of Naval Research (ONR) award #N00014-17-1-2787.
