Skip to main content
Log in

A comprehensive tolerant algebraic side-channel attack over modern ciphers using constraint programming

  • Regular Paper
  • Published:
Journal of Cryptographic Engineering Aims and scope Submit manuscript

Abstract

Tolerant algebraic side-channel attack (TASCA) exploits side-channel information with an algebraic formulation of a cipher to exploit its weaknesses and recover a secret key. Its inputs consist of a side-channel trace of an encryption and the clear and cipher texts. TASCA demonstrated that pseudo-Boolean optimization can successfully recover a key with reasonable computational efforts. Unlike Boolean Satisfiability (SAT), Constraint Programming (CP) is an optimization technology that favors high-level, rich and expressive models that is ideal to naturally model and solve cryptanalysis challenges. It offers direct encoding of bit-wise operations and avoids costly bit-blasting formulation required by SAT and pseudo-Boolean solvers. TASCA-CP is an embodiment of TASCA and is used to attack AES-128 as well as AES-256 to recover keys when noisy side-channel measurements are available. It achieves this task orders of magnitude faster than the original TASCA approach. TASCA-CP, with its performance, enables cryptanalysts to explore larger key-sizes and probe weaknesses of ciphers. The article demonstrates, with an attack on Keeloq, that a high-level modeling approach is essential to easily adapt to different ciphers. The empirical evaluation establishes the performance of the system when compared to the original TASCA implementation on modern IP solvers and identical hardware.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15

Similar content being viewed by others

Availability of data and materials

The code will be publicly available following acceptance of this article.

Code availability

The code will be publicly available on Docker Hub.

References

  1. Achterberg, T.: Scip: solving constraint integer programs. Math. Program. Comput. 1(1), 1–41 (2009). https://doi.org/10.1007/s12532-008-0001-1

    Article  MathSciNet  MATH  Google Scholar 

  2. Apt, K.: Principles of Constraint Programming. Cambridge University Press, Cambridge (2003). https://doi.org/10.1017/CBO9780511615320

    Book  MATH  Google Scholar 

  3. Berthold, T., Heinz, S., Pfetsch, M.E.: Nonlinear Pseudo–Boolean Optimization: Relaxation or Propagation?, pp. 441–446. Springer, Berlin (2009). https://doi.org/10.1007/978-3-642-02777-2_40

    Book  Google Scholar 

  4. Bockmayr, A., Hooker, J.N.: Constraint programming. Handb. Oper. Res. Manag. Sci. 12, 559–600 (2005)

    MATH  Google Scholar 

  5. Bogdanov, A.: Attacks on the keeloq block cipher and authentication systems. In: In RFIDSec (2007)

  6. Bogdanov, A., Knudsen, L.R., Leander, G., Paar, C., Poschmann, A., Robshaw, M.J.B., Seurin, Y., Vikkelsoe, C.: Present: an ultra-lightweight block cipher. In: Paillier, P., Verbauwhede, I. (eds.) Cryptographic Hardware and Embedded Systems—CHES 2007, pp. 450–466. Springer, Berlin (2007)

    Chapter  Google Scholar 

  7. Courtois, N.T., Bard, G.V., Wagner, D.: Algebraic and slide attacks on keeloq. In: Nyberg, K. (ed.) Fast Software Encryption, pp. 97–115. Springer, Berlin (2008)

    Chapter  Google Scholar 

  8. Daemen, J., Rijmen, V.: The Design of Rijndael: AES—The Advanced Encryption Standard. Springer, Berlin (2013)

    MATH  Google Scholar 

  9. Gallager, R.: Low-density parity-check codes. IRE Trans. Inf. Theory 8(1), 21–28 (1962). https://doi.org/10.1109/TIT.1962.1057683

    Article  MathSciNet  MATH  Google Scholar 

  10. Gandolfi, K., Mourtel, C., Olivier, F.: Electromagnetic analysis: concrete results. In: Koç, Ç.K., Naccache, D., Paar, C. (eds.) Cryptographic Hardware and Embedded Systems—CHES 2001, pp. 251–261. Springer, Berlin (2001)

    Chapter  Google Scholar 

  11. Gleixner, A., Bastubbe, M., Eifler, L., Gally, T., Gamrath, G., Gottwald, R.L., Hendel, G., Hojny, C., Koch, T., Lübbecke, M.E., Maher, S.J., Miltenberger, M., Müller, B., Pfetsch, M.E., Puchert, C., Rehfeldt, D., Schlösser, F., Schubert, C., Serrano, F., Shinano, Y., Viernickel, J.M., Walter, M., Wegscheider, F., Witt, J.T., Witzig, J.: The SCIP Optimization Suite 6.0. Technical report, Optimization Online. http://www.optimization-online.org/DB_HTML/2018/07/6692.html (2018)

  12. Indesteege, S., Keller, N., Dunkelman, O., Biham, E., Preneel, B.: A practical attack on keeloq. In: Smart, N. (ed.) Advances in Cryptology—EUROCRYPT 2008, pp. 1–18. Springer, Berlin (2008)

    Google Scholar 

  13. Junod, P., Canteaut, A.: Advanced Linear Cryptanalysis of Block and Stream Ciphers. Cryptology and Information Security Series. IOS Press, Amsterdam (2011)

    MATH  Google Scholar 

  14. Kocher, P., Jaffe, J., Jun, B.: Differential power analysis. In: Wiener, M. (ed.) Advances in Cryptology—CRYPTO’ 99, pp. 388–397. Springer, Berlin (1999)

  15. Kocher, P.C.: Timing attacks on implementations of diffie-hellman, rsa, dss, and other systems. In: Koblitz, N. (ed.) Advances in Cryptology—CRYPTO ’96, pp. 104–113. Springer, Berlin (1996)

  16. Liu, F., Cruz, W., Ma, C., Johnson, G., Michel, L.: A tolerant algebraic side-channel attack on aes using cp. In: Beck, J.C. (ed.) Principles and Practice of Constraint Programming, pp. 189–205. Springer International Publishing, Cham (2017)

    Chapter  Google Scholar 

  17. Liu, F., Cruz, W., Michel, L.: A complete tolerant algebraic side-channel attack for aes with cp. In: Hooker, J. (ed.) Principles and Practice of Constraint Programming, pp. 259–275. Springer International Publishing, Cham (2018)

    Chapter  Google Scholar 

  18. Mangard, S., Oswald, E., Popp, T.: Power Analysis Attacks: Revealing the Secrets of Smart Cards (Advances in Information Security). Springer-Verlag New York Inc., Secaucus (2007)

    MATH  Google Scholar 

  19. Michel, L., Schaus, P., Van Hentenryck, P.: MiniCP: A Lightweight Solver for Constraint Programming. https://minicp.bitbucket.io (2018)

  20. Michel, L., Van Hentenryck, P.: Constraint satisfaction over bit-vectors. In: International Conference on Principles and Practice of Constraint Programming-CP 2012, pp. 527–543. Springer (2012)

  21. Michel, L., Van Hentenryck, P.: A microkernel architecture for constraint programming. Constraints 22(2), 107–151 (2017). https://doi.org/10.1007/s10601-016-9242-1

    Article  MathSciNet  MATH  Google Scholar 

  22. Mohamed, M.S.E., Bulygin, S., Zohner, M., Heuser, A., Walter, M., Buchmann, J.: Improved algebraic side-channel attack on aes. J. Cryptogr. Eng. 3(3), 139–156 (2013). https://doi.org/10.1007/s13389-013-0059-1

    Article  Google Scholar 

  23. NIST: Federal information processing standards publication (FIPS 197), Advanced Encryption Standard (AES) (2001)

  24. Oren, Y., Kirschbaum, M., Popp, T., Wool, A.: Algebraic side-channel analysis in the presence of errors. In: Mangard, S., Standaert, F.X. (eds.) Cryptographic Hardware and Embedded Systems, CHES 2010, pp. 428–442. Springer, Berlin (2010)

    Chapter  Google Scholar 

  25. Oren, Y., Renauld, M., Standaert, F.X., Wool, A.: Algebraic side-channel attacks beyond the hamming weight leakage model. In: International Workshop on Cryptographic Hardware and Embedded Systems—CHES 2012, pp. 140–154. Springer (2012)

  26. Oren, Y., Wool, A.: Tolerant algebraic side-channel analysis of aes. IACR Cryptology ePrint Archive, Report 2012/092. http://iss.oy.ne.ro/TASCA-eprint (2012)

  27. Oren, Y., Wool, A.: Side-channel cryptographic attacks using pseudo-boolean optimization. Constraints 21(4), 616–645 (2016). https://doi.org/10.1007/s10601-015-9237-3

    Article  MathSciNet  MATH  Google Scholar 

  28. Pearl, J.: Reverend bayes on inference engines: a distributed hierarchical approach. In: Proceedings of the National Conference on Artificial Intelligence, pp. 133–136 (1982)

  29. Renauld, M., Standaert, F.X.: Algebraic side-channel attacks. In: 5th International Conference on Information Security and Cryptology, pp. 393–410. Springer (2009)

  30. Renauld, M., Standaert, F.X., Veyrat-Charvillon, N.: Algebraic side-channel attacks on the aes: Why time also matters in dpa. In: Cryptographic Hardware and Embedded Systems—CHES 2009, pp. 97–111. Springer (2009)

  31. Rossi, F., van Beek, P., Walsh, T. (eds.): Handbook of Constraint Programming, Foundations of Artificial Intelligence, vol. 2. Elsevier, Amsterdam (2006)

  32. Soos, M., Nohl, K., Castelluccia, C.: Extending sat solvers to cryptographic problems. In: 12th International Conference on Theory and Applications of Satisfiability Testing, SAT ’09, pp. 244–257. Springer, Berlin (2009). https://doi.org/10.1007/978-3-642-02777-2_24

  33. Van Hentenryck, P., Carillon, J.P.: Generality versus specificity: an experience with ai and or techniques. In: 7th AAAI National Conference on Artificial Intelligence, AAAI’88, pp. 660–664. AAAI Press (1988). http://dl.acm.org/citation.cfm?id=2887965.2888082

  34. Van Hentenryck, P., Michel, L.: The objective-cp optimization system. In: Schulte, C. (ed.) Principles and Practice of Constraint Programming, pp. 8–29. Springer, Berlin (2013)

    Chapter  Google Scholar 

  35. Veyrat-Charvillon, N., Gérard, B., Standaert, F.X.: Soft analytical side-channel attacks. In: Sarkar, P., Iwata, T. (eds.) Advances in Cryptology—ASIACRYPT 2014, pp. 282–296. Springer, Berlin (2014)

    Google Scholar 

  36. Wolsey, L.: Integer Programming. Wiley Series in Discrete Mathematics and Optimization. Wiley, Hoboken (1998)

    Google Scholar 

Download references

Acknowledgements

Laurent Michel and Waldemar Cruz were partially supported by Synchrony under Grant #790057267.

Funding

This work was not funded by any agency.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fanghui Liu.

Ethics declarations

Conflict of interest

All authors declare that they have no conflict of interest.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendices

AES IP model

1.1 Auxiliary encoding

As we mentioned earlier, the IP model linearizes all the constraints. To achieve this, auxiliary encoding is needed to linearize several functions such as XOR, substitution box, and xtime.

1.1.1 XOR

A common operation in cryptographic ciphers is the Exclusive OR bit-wise operation. Exclusive OR (\(\oplus \)) is a nonlinear operation performed over a pair of bits \(x,y \in \{0,1\}\). The following set of inequalities are introduced to encode the XOR operation.

$$\begin{aligned}&x + y - 2\cdot x \cdot y - o \le 0\\&x + y - 2\cdot x \cdot y - o \ge 0 \end{aligned}$$

The product \(x \cdot y\) requires a linearized encoding, an additional variable \(z \in \{0,1\}\) is introduced to represent the product and an encoding is introduced to support Multiplication over Booleans.

$$\begin{aligned}&x - z \ge 0\\&y - z \ge 0\\&x + y - z - 1 \le 0 \end{aligned}$$

Clearly, \(z = 1\) forces both x and y to be 1. Conversely, when \(x = y = 1\), then \(z = 1\). However, if either x or y equals to zero, then \(z = 0\). Namely, if any of the Boolean variables are zero, then the product will also be zero. Multiplication over Booleans can be generalized over a set of Boolean variables with the following set of inequalities:

$$\begin{aligned}&\forall i \in 1, \ldots , n: b_{i} - z \ge 0 \end{aligned}$$
(4)
$$\begin{aligned}&\sum b_{i} - z - (n - 1) \le 0 \end{aligned}$$
(5)

1.1.2 Substitution box

In AES, the SubBytes operation relies on a substitution box. A substitution box is a permutation \(\pi : \{0,1\}^{n} \rightarrow \{0,1\}^{n}\) that is defined by a look-up table S. Specifically, the permutation \(\pi \) maps a group of n bits to another group of n bits. This represents a state transformation from a state variable \(x_{i} \in \{0,1\}^{n}\) to \(x_{i+1} \in \{0,1\}^{n}\). Each state variable is represented as a string of literals each representing a single bit. An n-bit state variable is represented as a string of n literals. A byte-length state variable x is represented as \(x_{7}x_{6}x_{5}x_{4}x_{3}x_{2}x_{1}x_{0}\).

Given an input state variable x and an output state variable y, the desired constraint gives the relation \(y = \pi [x]\) which states that the value y must be the \(x^{th}\) entry in the look-up table \(\pi \). Suppose the first row in the table maps the bit-string 00000000 to the bit-string 10011100. When the bits in variable x are equal to 00000000, then the product \(\bar{x_{7}}\bar{x_{6}}\bar{x_{5}}\bar{x_{4}}\bar{x_{3}} \bar{x_{2}}\bar{x_{1}}\bar{x_{0}}\) evaluates to one forcing the bits of y to take on the value 10011100 implied by the product of literals \(y_{7}\bar{y_{6}}\bar{y_{5}}y_{4}y_{3}y_{2}\bar{y_{1}}\bar{y_{0}}\) to evaluate to one as well. To encode the look-up table, each record in the table is represented as follows:

$$\begin{aligned}&\bar{x_{7}}\bar{x_{6}}\bar{x_{5}}\bar{x_{4}}\bar{x_{3}}\bar{x_{2}}\bar{x_{1}}\bar{x_{0}} - y_{7}\bar{y_{6}}\bar{y_{5}}y_{4}y_{3}y_{2}\bar{y_{1}}\bar{y_{0}} \le 0 \\&\bar{x_{7}}\bar{x_{6}}\bar{x_{5}}\bar{x_{4}}\bar{x_{3}}\bar{x_{2}}\bar{x_{1}}\bar{x_{0}} - y_{7}\bar{y_{6}}\bar{y_{5}}y_{4}y_{3}y_{2}\bar{y_{1}}\bar{y_{0}} \ge 0 \end{aligned}$$

It is clear that when the product \(\bar{x_{7}}\bar{x_{6}}\bar{x_{5}}\bar{x_{4}}\bar{x_{3}}\bar{x_{2}}\bar{x_{1}}\bar{x_{0}} = 1\), it forces the product \(y_{7}\bar{y_{6}}\bar{y_{5}}y_{4}y_{3}y_{2}\bar{y_{1}}\bar{y_{0}} = 1\). Similarly, when \(\bar{x_{7}}\bar{x_{6}}\bar{x_{5}}\bar{x_{4}}\bar{x_{3}}\bar{x_{2}}\bar{x_{1}}\bar{x_{0}} = 0\), \(y_{7}\bar{y_{6}}\bar{y_{5}}y_{4}y_{3}y_{2}\bar{y_{1}}\bar{y_{0}} = 0\).

Each n-ary product is linearized with the encoding described in (4)–(5). Overall, the encoding requires \(2 \cdot (n + 1) \cdot 2^{8}\) inequalities for each look-up operation where n is the length of the bit-string.

1.1.3 xtime

xtime \(: \{0,1\}^8 \rightarrow \{0,1\}^8\) is a function transforming an 8-bit input sequence x into an 8-bit output sequence y, i.e., \(y =\)xtime(x) specified as:

$$\begin{aligned} y = \left\{ \begin{array}{ll} (x<< 1) &{}\Leftrightarrow x_7 = 0 \\ (x<< 1) \oplus \mathtt{0x1b} &{}\Leftrightarrow x_7 = 1 \\ \end{array}\right. \end{aligned}$$

that applies a left shift to the 8-bits and subsequent conditional bitwise XOR with value 0x1b if the most significant bit is 1. The operation is described in Sect. 3.2 of the FIPS specification of AES [23]. To linearize the xtime operation, the following bit-level encoding is applied

$$\begin{aligned} y_{i+1}= & {} x_i \oplus x_7\;\; \forall i\in \{0,2,3\} \\ y_{(i+1) \bmod 8}= & {} x_i\;\; \forall i\in \{1,4,5,6,7\} \end{aligned}$$

1.2 AES constraints

  • AddRoundKey is a straightforward XOR operation. It takes in a state \(S_{sr,i,j}\) and a round key \(K_{r,i,j}\), then performs an XOR operation to translate \(S_{sr,i,j}\) to \(S_{sr+1,i,j}\). The linearization of the XOR operation is described above.

  • SubBytes is a nonlinear byte-wise substitution. The mapping of the SubBytes permutation \(\pi :\{0,1\}^{8} \Rightarrow \{0,1\}^{8}\) is defined by a look-up table \(S_{r+1,i} = \pi [S_{r,i}]\), where the permutation \(\pi \) maps a group of 8 bits to another group of 8 bits. This operation transforms a state variable \(S_{sr,i,[0 \ldots 7]}\) to \(S_{sr+1,i,[0 \ldots 7]}\). The linearization of the SubBytes operation is described above.

  • ShiftRows is a logical circular shift on the state variables. The ShiftRows operation does not leak any side-channel information because there are no changes in the values. Therefore, ShiftRows is combined with MixColumns. To combine them, the state variables are shifted based on the rules for ShiftRows and then passed to MixColumns.

  • MixColumns is a more complex operation that applies to a column of the state matrix at a time. At a high-level, it can be represented directly with:

    It is clear how ShiftRows is folded in MixColumns. The 32-bit MixColumns operation is repeated 4 times, once for every column. For an 8-bit processor, the transformation has an efficient implementation using 8-bit words [27], which is used by the IP model. The following shows the four equations for one output column \([o_0,o_1,o_2,o_3]\) based on an input column \([a_0,a_1,a_2,a_3]\):

    The linearization relies on the XOR and xtime encoding which is described in the previous section.

  • Key Expansion is an invertible key derivation function that maps a given cipher key to a series of round keys. The key expansion derives the next round key by applying a series of XOR operations to the current round key with round constants RC and a series of SubBytes substitutions. The following is an example of the derivation of the second round key:

    $$\begin{aligned}&K_{1,0} = SubBytes(K_{0,13}) \oplus K_{0,0} \oplus RC_{0}\\&K_{1,1} = SubBytes(K_{0,14}) \oplus K_{0,1} \\&K_{1,2} = SubBytes(K_{0,15}) \oplus K_{0,2} \\&K_{1,3} = SubBytes(K_{0,12}) \oplus K_{0,3}\\&\forall i\in \{0,\ldots ,11\}\; K_{1,i+4} = K_{1,i} \oplus K_{0,i+4} \end{aligned}$$

Search

1.1 Algorithm

figure r

AES-128 COP model

figure s
figure t

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Liu, F., Cruz, W. & Michel, L. A comprehensive tolerant algebraic side-channel attack over modern ciphers using constraint programming. J Cryptogr Eng 12, 197–228 (2022). https://doi.org/10.1007/s13389-021-00280-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s13389-021-00280-9

Keywords

Navigation