Black box attack method and system for Yoroi-core
Through the black box attack method and system for Yoroi-core, the input and output characteristics of the lookup table are used to divide the lookup table into sets and restore the lookup table, which solves the problem of being unable to confirm the security of the encryption process in the existing technology and realizes the security of the encryption process in the black box scenario. The encryption algorithm security assessment and key replacement prompts below enhance the security of the encryption process.
Patent Information
- Application Number
- CN202411015580.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-15
AI Technical Summary
When the existing technology uses the Yoroi algorithm for encryption, it cannot effectively confirm the security of the encryption process, resulting in the inability to change the key in time. The attacker's ability requirements are too high and the attack process is not universal.
Provides black box attack methods and systems for Yoroi-core. Through the cooperation of user clients and attack clients, the input and output characteristics of the lookup table are used to divide the lookup table into sets and restore the lookup table to determine the security of the encryption algorithm and remind the user to change the password. key.
Confirm the security of the encryption algorithm in a black box scenario, weaken the attacker's ability, provide reasonable key replacement opportunities, and enhance the security of the encryption process.
Smart Images

Figure CN118784209A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of security assessment of encryption algorithms, and in particular to a black box attack method and system for Yoroi-core. Background Art
[0002] Symmetric cryptography is an important means of information encryption. When analyzing the security of encryption algorithms, the attack scenarios can be divided into black-box attacks, gray-box attacks, and white-box attacks according to the capabilities of the adversary. In the black-box scenario, the attacker can only see the input (plaintext) and output (ciphertext) of the encryption algorithm. In the gray-box scenario, the attacker can access some information in the encryption process, that is, it is assumed that the attacker can passively obtain information such as the time and power consumption used in the encryption and decryption process through side-channel analysis attacks. In the white-box scenario, the attacker has the ability to fully control the encryption program, can dynamically execute the encryption algorithm, observe the operation of the algorithm, and even modify the implementation of the algorithm.
[0003] White-box encryption was first proposed by Chow et al. in 2002, and they also gave white-box implementations of AES and DES. The main idea is to combine some operations in the round function of the algorithm into a table, in which the round key and mask are combined, and reversible coding is added before and after each table for protection. Since their pioneering work, many designs to improve the security of white-box encryption algorithms have been proposed, but they have all been broken without exception. In 2016, Joppe et al. proposed a general differential computation analysis (DCA) that can implement key extraction attacks on most existing white-box implementations in gray-box scenarios.
[0004] In order to effectively resist key extraction attacks, a white-box encryption algorithm based on a lookup table was proposed. Its lookup table is obtained by a small encryption algorithm, and the key is hidden in the lookup table. The difference from the scheme of Chow et al. is that its lookup table is calculated by a small-scale encryption algorithm with a key, and the lookup table does not need to be coded for protection. This design can reduce the security of resisting key extraction attacks in white-box scenarios to the security of resisting key extraction attacks in black-box scenarios. Under this design, the main security goal becomes resisting code extraction attacks. Code extraction attacks are an attack in white-box scenarios. It extracts the source code of the encryption program and attempts to use the extracted code to reproduce a program with the same encryption and decryption functions as the original program.
[0005] Bogdanov and Isobe proposed a security concept for code extraction attacks: spacehardness, which measures the ability of an algorithm to resist code extraction attacks by evaluating the amount of code that an attacker needs to extract from the encryption program in order to obtain the functions of the encryption algorithm. This amount of code is called the threshold κ. When the amount of leaked code does not exceed the threshold κ, the encryption algorithm is secure. Block ciphers that meet space hardness are called space-hard block ciphers. After this concept was proposed, many space-hard block ciphers were proposed, such as SPACE, WhiteBlock, and SPNbox. Although these block cipher algorithms can effectively resist code extraction attacks, they still have obvious disadvantages in dealing with the problem of continuous code leakage. Attackers can continuously extract the code of the encryption program for a considerable period of time, and the amount of code leakage will always reach the threshold κ, endangering the security of the encryption program.
[0006] To solve the problem of continuous leakage, Koike and Isobe proposed an updateable space-hard algorithm Yoroi. The algorithm mainly consists of two parts, Yoroi-core and AES layer. Yoroi-core is implemented by a lookup table. The AES layer is used to protect the black box security at the end of the algorithm. Yoroi-core adopts the design method of partial linear layer. The output of the lookup table is divided into high m bits and low t bits. Only the low t bits pass through the affine layer and the linear layer. The output of the high m bits is directly used as the input of the next round of the lookup table. At this time, a permutation is added to the high m bits output by the lookup table, and the inverse of this permutation is added to the high m bits input to the lookup table in the next round to keep the algorithm function unchanged. Then the two permutations are respectively compounded into the lookup table of their rounds. When the amount of leaked information reaches the threshold κ, the m-bit permutation is updated to update the lookup table. At the same time, the function of the encryption program can be realized without changing the lookup table when the lookup table is updated. Therefore, when the code leakage reaches the threshold κ, the lookup table used by the Yoroi algorithm is updated, and part of the code previously obtained by the attacker will be invalid or even erroneous information.
[0007] Todo and Isobe analyzed the Yoroi algorithm and proposed a hybrid attack model. This attack model is divided into two stages. Stage one is the white box scenario. They assume that a white box attacker has invaded the encryption algorithm. This attacker can view the lookup table used by the encryption algorithm at will and even modify the encryption program, but the amount of information that can be transmitted to the outside of the encryption program is limited. Stage two is the black box scenario. In this scenario, there is a black box attacker who receives the information transmitted by the white box attacker and attacks the algorithm in the black box scenario. Their attack can restore an algorithm equivalent to the original algorithm without exceeding the threshold claimed by the designer of the Yoroi algorithm for security.
[0008] The inventors discovered that in the prior art, when technicians use the Yoroi algorithm to encrypt plain text, they are unable to confirm whether the Yoroi algorithm encryption process is secure. When using the existing white box attack method to attack the Yoroi algorithm, the attacker's ability requirements are very high, and the existing attack process is not universal. As a result, when R&D personnel use the Yoroi algorithm for encryption, they are unable to confirm when the encryption process based on the Yoroi algorithm needs to change the key. Summary of the invention
[0009] In order to address the deficiencies of the prior art, the present invention provides a black-box attack method and system for Yoroi-core; the present invention believes that in the first stage of Todo and Isobe's attack model, the attacker they assume can view the lookup table and modify the algorithm at will, which is too powerful and difficult to achieve in actual scenarios, and the black-box attacker is highly dependent on the information transmitted by the white-box attacker.
[0010] On the one hand, a black box attack method for Yoroi-core is provided, including:
[0011] The user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption on the original plaintext data to obtain the ciphertext data;
[0012] Attacking the client, in the first R rounds of encryption processing, each round performs the following steps:
[0013] (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection;
[0014] (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set;
[0015] (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property;
[0016] (4) Restore the lookup table of the current round;
[0017] Repeat (1) to (4) until the lookup table for all rounds is restored;
[0018] The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. A prompt to change the key is sent to the user client. If they are inconsistent, it means that the black box attack fails and the current encryption algorithm is secure.
[0019] On the other hand, a black box attack system for Yoroi-core is provided, including:
[0020] The user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption on the original plaintext data to obtain the ciphertext data;
[0021] Attacking the client, in the first R rounds of encryption processing, each round performs the following steps:
[0022] (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection;
[0023] (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set;
[0024] (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property;
[0025] (4) Restore the lookup table of the current round;
[0026] Repeat (1) to (4) until the lookup table for all rounds is restored;
[0027] The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. A prompt to change the key is sent to the user client. If they are inconsistent, it means that the black box attack fails and the current encryption algorithm is secure.
[0028] The above technical solution has the following advantages or beneficial effects:
[0029] When the Yoroi algorithm is used for encryption, it is possible to confirm whether the Yoroi algorithm encryption process is safe. When the encryption process is successfully attacked, or the encryption process is no longer safe, the user client is reminded to change the key in time. In the attack of the present invention, the attacker's ability is weakened. Specifically, in the attack process of the present invention, it is only necessary to implement a DCA attack in a gray box scenario on the algorithm to obtain the key of the last AES layer of the algorithm. The other attack processes are all in a black box scenario, which can provide users who use the Yoroi algorithm for encryption with a more reasonable opportunity to modify the key. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0031] Figure 1 is a flow chart of the method of embodiment 1;
[0032] Figure 2 This is a pre-processing flow chart before the start of the method process of Example 1;
[0033] Figure 3 A processing flow chart of each round in the method flow of embodiment 1;
[0034] Figure 4 is the truncated difference classifier of the first embodiment, Δ represents a non-zero difference;
[0035] Figure 5 The truncated difference distinguisher for collecting plaintext and ciphertext pairs of the first embodiment;
[0036] Figure 6 This is the process of finding the correct replacement in Example 1;
[0037] Figure 7 The discriminator of the first embodiment is used to classify the lookup table input according to whether the high m bits of the output are the same. DETAILED DESCRIPTION
[0038] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0039] Terminology explanation:
[0040] The Yoroi algorithm is an updateable white-box algorithm proposed by Yuji Koike and Takanori Isobe at TCHES2021. For its specific implementation, please refer to the paper "Yoroi: Updatable Whitebox Cryptography". Yoroi-core refers to the table lookup part of the Yoroi algorithm. The Yoroi algorithm mainly consists of two parts, Yoroi-core and AES layer. Its block length is 128-bit. The Yoroi algorithm has two versions, Yoroi-16 and Yoroi-32.
[0041] The encryption algorithm Yoroi-16 uses a 16-bit lookup table, with 8 lookup tables in each round. The algorithm has 8 rounds in total. Only the lower 4 bits of the lookup table output pass through the linear layer, and the upper 12 bits are directly output to the next round.
[0042] The encryption algorithm Yoroi-32 uses a 32-bit lookup table, with 4 lookup tables per round and a total of 16 rounds. Only the lower 4 bits of the lookup table output pass through the linear layer, and the upper 28 bits are directly output to the next round.
[0043] Embodiment 1
[0044] This embodiment provides a black box attack method for Yoroi-core;
[0045] Black box attack methods for Yoroi-core include:
[0046] The user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption on the original plaintext data to obtain the ciphertext data;
[0047] Attacking the client, in the first R rounds of encryption processing, each round performs the following steps:
[0048] (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection;
[0049] (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set;
[0050] (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property;
[0051] (4) Restore the lookup table of the current round;
[0052] Repeat (1) to (4) until the lookup table for all rounds is restored;
[0053] The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. A prompt to change the key is sent to the user client. If they are inconsistent, it means that the black box attack fails and the current encryption algorithm is secure.
[0054] Among them, the steps of the first R rounds of encryption processing are the same, all using Yoroi-core encryption, and the R+1 round of encryption processing uses AES encryption. For details of the steps of the Yoroi-core encryption method, please refer to Chapter 4 of the paper "Yoroi: Updatable Whitebox Cryptography".
[0055] Figure 3 This is a processing flow chart of each round in the method flow of embodiment 1.
[0056] The following definitions and lemmas are given as some theoretical foundations of the attack process.
[0057] Definition 1: (Equivalent mapping of matrices). The present invention refers to two mappings F I , F O : is a finite field A pair of equivalent mappings on a p×p matrix M is a pair of equivalent mappings if the two mappings satisfy:
[0058]
[0059] Lemma 1: For A p×p circulant matrix M on any affine transformation A I : in There is always a radiation transformation A O : in A I With A O is a pair of equivalent mappings of a circulant matrix M.
[0060] Proof: A I With A O It is a pair of equivalent mappings of a circulant matrix M, which can be obtained:
[0061]
[0062] From the above formula, we can deduce Therefore c = a -1 , At the same time, because the matrix M is a circulant matrix, Each element in is a constant, that is
[0063] The linear layers of Yoroi-16 and Yoroi-32 are both circulant matrices. Therefore, if the present invention adds a pair of equivalent mappings of the matrix before and after the linear layer of the Yoroi encryption algorithm, the function of the linear layer will remain unchanged. At the same time, because the affine layer of the Yoroi algorithm adds a constant, the present invention can derive the following lemma.
[0064] Lemma 2: For the affine layer and linear layer of the i-th round of Yoroi algorithm Circulant Matrix M t , the present invention can define a set of affine transformations Meet M t (c+x)=A O °M t ·(c+AI (x)), where and Both Affine transformation on .
[0065] Proof: Since Yoroi's affine layer adds the same constant to the last t bits of the lookup table output, it can be viewed as According to Lemma 1, the set that satisfies the above conditions exist.
[0066] According to the above lemma, the present invention proposes an equivalent alternative to the Yoroi algorithm.
[0067] Theory 1: The present invention can construct an equivalent algorithm of the Yoroi algorithm. The only difference between this equivalent algorithm and the original algorithm is the lookup table, which can be expressed as:
[0068]
[0069] Where E i is an m-bit permutation, T 1 ,T 2 ,T 3 is the lookup table in the original algorithm, and is chosen according to Lemma 2, and R is the number of rounds of the algorithm.
[0070] Proof: During encryption, the lookup table of Some of them can be used by the next round of lookup table of The high m bits of the Yoroi lookup table output do not pass the linear layer, so E i Can be cancel out; according to Lemma 2, and will also cancel each other out, so the above algorithm has the same function as the original algorithm.
[0071] Definition 2: (Affine equivalence of permutations) For two t-bit permutations π 1 ,π 2 , if there exists a t-bit affine transformation L that satisfies These two permutations are called affine equivalent permutations. Affine equivalent permutations form an affine equivalence class.
[0072] There are 2 on t bits t There are 2 different permutations, and there are 2 affine transformations on t bits. t (2 t -1) species, so these 2 tThe permutation can be divided into two according to definition 1 t ! / 2 t (2 t -1)=(2 t -2)! Affine equivalence classes.
[0073] Lemma 3: From each affine equivalence class, select a representative to represent the entire affine equivalence class: among the t-bit permutations, select the permutations that satisfy π(0) = 0, π(1) = 1, and do not restrict the rest. There are (2 t -2)! These permutations represent all permutations on t bits.
[0074] Proof: Assume two different permutations π 1 ,π 2 Satisfy π 1 (0) = 0, π 1 (1) = 1, π 2 (0) = 0, π 2 (1) = 1 belong to the same affine equivalence class, then there is an affine transformation L(x) = ax + b between them, where a, a≠0, that is, π 1 =L°π 2 , from which we get:
[0075] π 1 (0) = aπ 2 (0)+b=0,
[0076] π 1 (1) = aπ 2 (1)+b=1,
[0077] From the above two equations, we can get a=1, b=0, so π 1 ,π 2 It is the same permutation, so the assumption does not hold.
[0078] In the subsequent attack process, the present invention needs to traverse all t-bit permutations. According to the above definition and lemma, the present invention only needs to find one representative from each affine equivalence class during the traversal process, so the traversal space can be expanded from 2 t ! Reduce to (2 t -2)! .
[0079] Furthermore, before the encryption algorithm Yoroi-16 or Yoroi-32 is used to perform R+1 rounds of encryption processing on the original plaintext data, the method further includes: before the user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to encrypt the original plaintext data, generating a lookup table T i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k .
[0080] Furthermore, the user client generates a lookup table T before encrypting the original plaintext data using the encryption algorithm Yoroi-16 or Yoroi-32. i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k ,include:
[0081] like Figure 2 As shown, the algorithm is preprocessed before execution to generate a lookup table T i : Generate a lookup table T before encrypting using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Execute 16 rounds of small group SPN structure algorithm to generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Perform 32 rounds of small group SPN structure algorithm on encryption algorithm Yoroi-32 to generate nonlinear permutation S i ;
[0082] The steps of the algorithm of the 16-round small group SPN structure and the algorithm of the 32-round small group SPN structure for each round of the small group SPN structure are the same;
[0083] The algorithm of each round of small group SPN structure includes the following steps:
[0084] The input data is first processed by the S-box, and then the processing result of the S-box is processed by the linear layer MC, and then the processing result of the linear layer MC is processed by the XOR round key AK i Processing, i represents the round number;
[0085] Among them, the input data is first processed by the S-box, which is the S-box used in AES;
[0086] Among them, the processing result of the S box is processed by the linear layer MC, and the MC of Yoroi-32 and Yoroi-16 are:
[0087]
[0088] Among them, the round key AK i The master key is obtained through the key expansion function (KDF):
[0089]
[0090] Then, use the AES algorithm or PRESENT algorithm with small groups to generate the block cipher E k , and the inverse of the block cipher D k ; The original packet length of the AES algorithm for small packets is 128 bits, and the packet length here is 12 bits or 28 bits;
[0091] Based on block cipher E k , and the inverse of the block cipher D k Generate a lookup table:
[0092]
[0093] Where I is a t-bit identity mapping.
[0094] It should be understood that the small-scale AES algorithm (Small Scale Variants of the AES), for details, see the paper "Small Scale Variants of the AES" C. Cid, S. Murphy & M. JB Robshaw.
[0095] It should be understood that the PRESENT algorithm, for specific details, see the paper "Small Scale Variants Of The Block Cipher PRESENT" by Gregor Leander.
[0096] It should be understood that the key expansion function (KDF), for details, see the paper "Recommendation for Key Derivation Using Pseudorandom Functions" Lily Chen.
[0097] The structure of Yoroi algorithm is as follows Figure 1 As shown, E k is a block cipher, D k is its inverse, E k The key in is independent of S i The algorithm ends with a full round of AES to protect the black box security.
[0098] from Figure 1 It can be seen that only the low t bits of the Yoroi-core lookup table output pass through the linear layer. Therefore, if the lookup table outputs a low t bit difference of 0, the difference will not spread. Based on this feature, we find a truncated difference distinguisher (such as Figure 4 and Figure 5 As shown): for an input pair (P 1,P 2 ), if the difference of this pair is only in the first n in bit is not 0, then the probability that the difference of t bits is 0 after the first lookup table output in the first round is 2 -t , and this is the case in every subsequent round, so the probability of this truncated difference distinguisher is 2 -t(R-1) , much higher than random probability Therefore, for a differential input pair that satisfies the truncated differential divider input (P 1 ,P 2 ), if their output is (C 1 ,C 2 ) also satisfies the output difference of the truncated difference classifier, so it is considered that this pair satisfies this truncated difference route. Further, it is considered that (P 1 ,P 2 ) in the first n in The bits go through the lookup table T 1 The last t bits of the output of are the same. Therefore, this truncated differential distinguisher can be used to convert the lookup table T 1 The input is classified according to the value of the lower t bits of its output. The specific steps include:
[0099] (11): Construct contains A plaintext set; the plaintexts in the plaintext set have the following structure: in Bit value traversal The remaining bits are randomly assigned a fixed value. The attacker client then asks the encryption machine of the user client to obtain the corresponding ciphertext. The encryption machine, when input with plaintext, returns the ciphertext.
[0100] (12): The attacker client pairs the collected ciphertexts and obtains the difference between the ciphertext pairs. If the ciphertext pairs are only in the first n in If the difference of the bits is not 0 and the other bits are 0, it is considered that the plaintext pair corresponding to the current ciphertext pair is the first n in The difference of the last t bits output by the lookup table is 0; the difference of the ciphertext pair is the result of bit-by-bit XOR of the two ciphertexts;
[0101] (13): Repeat (11) to (12) and convert the lookup table T 1 The input is divided into two parts according to whether the output low t bits are the same. t subsets, the elements in the same subset pass through T 1 The last t bits of the output are the same, and the elements in different subsets are 1 The last t bits of the output are different, but the specific values are unknown. Suppose the subsets are in After the elements in the lookup table are output, the t bit is i. When i is unknown, use ρi Instead of i.
[0102] It should be understood that because 2 t The value of the last t bits of the elements in the subset after the lookup table output is unknown, and it is necessary to traverse all possible values and select the correct one. t The elements in the subsets are 1 The last t bits of the output are assigned a value, which can be any value, and an n in bit input, t bit output lookup table In the lookup table Then add t bits of permutation (such as Figure 6 As shown), traversing all possible t-bit permutations is equivalent to traversing 2 t The subsets correspond to the values of the last t bits. According to Lemma 3, traversing (2 t -2)! By permuting, we can recover an algorithm that is functionally equivalent to the original algorithm. t -2)! One of the permutations is correct, called the correct permutation, and the rest are incorrect permutations.
[0103] An encryption machine is a system that accepts plaintext and returns the corresponding ciphertext. It is an encryption program used by the user client. An attacker can provide plaintext to this encryption machine, and the encryption machine will return the encrypted ciphertext. A decryption machine is a system that accepts ciphertext and returns the corresponding plaintext. It is a decryption program used by the user client. An attacker can provide ciphertext to this decryption machine, and the decryption machine will return the decrypted plaintext.
[0104] Furthermore, (2) based on the elements in each set, the value of the lower t bits of the corresponding set is restored. In this process, the first round of output differences are used only in the first n in The pair of bits that are active is called the correct pair. The correct pair is input to In the process, it is correctly permuted and finally passes through the linear layer. The output of the linear layer must satisfy the requirement that only the first t bits are active, and the correct input In the process of error permutation, and finally through the linear layer, the probability that the output of the linear layer is only active in the first t bits is much less than 1. Under Yoroi-16, this probability is about 2. -23.08 , under Yoroi-32, this probability is about 2 -14.57 By choosing 4 correct pairs, we can pick the correct permutation from among all possible permutations.
[0105] Further, (2) based on the elements in each set, the value of the lower t bits of the corresponding set is restored, and the specific steps include:
[0106] (21): To obtain 4 correct pairs, construct a Yoroi-core ciphertext set with a set size of 2t(R-2)+1.5-m , the ciphertext in the set has the following form: the first n in The bits are different, and then The bits are the same, query the decryption machine, obtain the plaintext corresponding to the ciphertext in the set, and call the plaintext the original plaintext;
[0107] (22): Expand each original plaintext in (21) by first checking the first n in The set to which the bit belongs Use the same The other elements in are replaced, because the set The size is 2 m , each original plaintext can be expanded to 2 m plaintext, called 2 m The plaintext is the extended plaintext, and the encryption machine is queried to obtain the ciphertext corresponding to the extended plaintext;
[0108] If the extended plaintext is obtained by extending the same original plaintext, the extended plaintext is of the same type; if the extended plaintext is obtained by extending different original plaintexts, the extended plaintext is of different types;
[0109] (23): Verify the original plaintext of (21) to determine whether the original plaintext can form a correct pair. If so, output the correct pair. The verification process is as follows: Pair the ciphertexts of different types of extended plaintexts. If the original plaintext pair is a correct pair, the ciphertext pair of the extended plaintext is 2 -t(R-2) The probability that the difference is satisfied only in the first n in Bit active, if the original plaintext pair is not the correct pair, the ciphertext pair of the expanded plaintext is The probability that the difference is satisfied only in the first n in Bit active, Yoroi-32 and Yoroi-16 both meet 2 m =2 t(R-2) Therefore, any two original plaintexts can be expanded into a plaintext pair that can form exactly 2 t(R-2) So, if the difference between the extended plaintext and the ciphertext is only in the first n in If the bit is active, the original pair corresponding to this extended pair is considered to be the correct pair;
[0110] (24): Set a counter for each candidate permutation and input the correct pair into , then passes through the candidate permutation, and finally passes through the linear layer. Observe the output of the linear layer. If the linear layer output difference is only active in the first t bits, add 1 to the counter of this permutation. The final counter value is equal to the permutation of the number of correct pairs, which is the correct permutation.
[0111] It should be understood that (2 t -2)! permutations, which come from: Select a representative from each affine equivalence class to represent the entire affine equivalence class: Among the t-bit permutations, select the permutations that satisfy π(0) = 0, π(1) = 1, and do not restrict the rest. There are a total of (2 t -2)! , (2 t -2)! permutations represent all permutations on t bits.
[0112] It should be understood that the linear layer refers to the components used in the algorithm encryption process. All components of the algorithm are divided into two categories, linear and non-linear.
[0113] Under the premise that there are 4 correct pairs, after step (24), the value of the counter corresponding to the correct substitution must be 4, and the counters corresponding to the incorrect substitutions all obey the Poisson distribution parameter. The success rate of selecting the correct substitution in step (24) is:
[0114]
[0115] Among them, Φ p (τ,λ) represents the probability that a random variable with parameter λ is greater than τ, N s The value of (2 t -2)! ≈2 36.34 ,λ s The average probability of adding 1 to an incorrect permutation for each correct pair is about 2 under Yoroi-16. -23.08 , under Yoroi-32, the value is about 2 -14.57 , substituting into the success rate calculation formula, the success rate is about 100% under Yoroi-16 and Yoroi-32.
[0116] Through the above method, the correct substitution is obtained. At this time, the low t bits of the lookup table output are restored, that is, t bits are restored. The subscript of .
[0117] Furthermore, the input of the lookup table in (3) is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to satisfy the permutation property. The specific steps include:
[0118] (31) Let a correct pair be in:
[0119]
[0120] Calculate the correct difference of the low t bits through the lookup table, expressed as Construct two blocks of size 2 2m Plaintext set, let the plaintext in the first set be:
[0121]
[0122] Among them, P 1 ,1-Traverse the collection The elements in P 1 ,2-Traverse the collection The elements, i, j in are all arbitrary; the plaintext in the second set:
[0123]
[0124] Among them, P 2 ,1-Traverse the collection The elements in P 2 ,2-Traverse the collection The elements in is the correct input for one of the plaintexts in the kth lookup table, represents the set of t bits i after the lookup table output, and queries the encryption machine to obtain the corresponding ciphertext;
[0125] (32) Pair the ciphertexts in the first set with those in the second set. If the plaintexts in the first set and the second set satisfy P 1 ,2- and P 2 ,2-After the lookup table outputs the same high m bits, then this pair is also a correct pair, and their output difference is only in the first n in The probability of a bit being active is 2 -t(R-2) , otherwise their output differences are only in the first n in The probability of a bit being active is Each P 1 ,2- and P 2 ,2-pairs were detected 2 2m times, so if the output differential meets only the first n in Bit active pair, then P 1 ,2- and P 2 ,2-After the lookup table outputs the same high m bits, P 1 ,2- and P 2 ,2-values are grouped into one set;
[0126] (33) Repeat steps (31) and (32). When repeating (31), replace the values of i and j in the corresponding step. The values of i and j can be different from the previous values. Merge the sets with intersections in (32). Finally, we get 2 m There are different sets of elements in each set. After the lookup table is completed, the output high m bits are the same, but the specific value is unknown, so a random value is assigned to it because the high m bits do not pass the linear layer.
[0127] According to the lookup table output high m bit classification, we get 2 m Different collection processes require data complexity of 2 for Yoroi-16 and Yoroi-32 respectively. 32.49 , 2 64.43 .
[0128] At this point, the first round of the lookup table is completely recovered, and the recovery method for subsequent rounds is the same. When recovering the second round, the first round can be ignored. The recovery of subsequent rounds is negligible compared to the first round because the number of rounds is reduced, the probability of the distinguisher is increased, and the corresponding complexity is reduced. Yoroi-core can recover round by round, and the key of the AES layer is also recovered through the DCA attack, and the algorithm can be completely recovered. Figure 7 It is a classifier for classifying the lookup table input according to whether the high m bits of the output are the same in the first embodiment. r ,i-represents the correct input to the i-th lookup table.
[0129] Embodiment 2
[0130] This embodiment provides a black box attack system for Yoroi-core, including:
[0131] The user client, based on the generated data, uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption processing on the original plaintext data to obtain ciphertext data; wherein the steps of the first R rounds of encryption processing are the same, and the R+1 round of encryption processing uses AES encryption processing;
[0132] Attacking the client, in the first R rounds of encryption processing, each round performs the following steps:
[0133] (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection;
[0134] (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set;
[0135] (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property;
[0136] (4) Recover a round of lookup table;
[0137] Repeat (1) to (4) until the lookup table for all rounds is restored;
[0138] The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. The user client is prompted to change the key of the encryption algorithm. If they are inconsistent, it means that the black box attack has failed and the current encryption algorithm is secure.
[0139] The system includes: a user client generates a lookup table T before encrypting the original plaintext data using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k . The step details of each step in the second embodiment are consistent with those in the first embodiment and are not repeated here. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. The black box attack method against Yoroi-core is characterized by: include: The user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption on the original plaintext data to obtain the ciphertext data; Attacking the client, in the first R rounds of encryption processing, each round performs the following steps: (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection; (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set; (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property; (4) Restore the lookup table of the current round; Repeat (1) to (4) until the lookup table for all rounds is restored; The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. A prompt to change the key is sent to the user client. If they are inconsistent, it means that the black box attack fails and the current encryption algorithm is secure.
2. The black box attack method for Yoroi-core as claimed in claim 1, characterized in that: Before the encryption algorithm Yoroi-16 or Yoroi-32 is used to perform R+1 rounds of encryption processing on the original plaintext data, the method further includes: before the encryption algorithm Yoroi-16 or Yoroi-32 is used to encrypt the original plaintext data, the user client generates a lookup table T i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k .
3. The black box attack method for Yoroi-core as claimed in claim 2, characterized in that: The user client generates a lookup table T before encrypting the original plaintext data using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k ,include: Preprocessing before algorithm execution generates lookup table T i : Generate a lookup table T before encrypting using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Execute 16 rounds of small group SPN structure algorithm to generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Perform 32 rounds of small group SPN structure algorithm on encryption algorithm Yoroi-32 to generate nonlinear permutation S i ; The steps of the algorithm of the 16-round small group SPN structure and the algorithm of the 32-round small group SPN structure for each round of the small group SPN structure are the same; The algorithm of each round of the small group SPN structure includes the following steps: firstly subjecting the input data to S-box processing, then subjecting the processing result of the S-box to linear layer MC processing, and then subjecting the processing result of the linear layer MC to XOR processing.
4. The black box attack method for Yoroi-core as claimed in claim 3, characterized in that: The input data is first processed by the S-box, which is the S-box used in AES. The processing result of the S-box is processed by the linear layer MC. The MCs of Yoroi-32 and Yoroi-16 are: The processing result of the linear layer MC is processed by the XOR round key, and the round key AK i Obtained from the master key through the key expansion function: Then, use the AES algorithm or PRESENT algorithm with small groups to generate the block cipher E k , and the inverse of the block cipher D k ; Based on block cipher E k , and the inverse of the block cipher D k Generate a lookup table: Where I is a t-bit identity mapping.
5. The black box attack method for Yoroi-core as claimed in claim 1, characterized in that: The input to the lookup table is divided into two parts according to whether the output low t bits are the same. t The specific steps include: (11): Construct contains A plaintext set; the plaintexts in the plaintext set have the following structure: in Bit value traversal The remaining bits are randomly assigned a fixed value. The attacker's client then asks the encryption machine of the user's client to obtain the corresponding ciphertext. The encryption machine, when input with plaintext, returns the ciphertext: (12): The attacker client pairs the collected ciphertexts and obtains the difference between the ciphertext pairs. If the ciphertext pairs are only in the first n in If the difference of the bits is not 0 and the other bits are 0, it is considered that the plaintext pair corresponding to the current ciphertext pair is the first n in The difference of the last t bits output by the lookup table is 0; the difference of the ciphertext pair is the result of bit-by-bit XOR of the two ciphertexts; (13): Repeat (11) to (12) and divide the input of the lookup table T1 into two groups according to whether the output low t bits are the same. t The elements in the same subset have the same t bits after being output by T1, while the elements in different subsets have different t bits after being output by T1, but the specific values are unknown. Suppose the subsets are in After the elements in the lookup table are output, the t bit is i. When i is unknown, use ρ i Instead of i.
6. The black box attack method for Yoroi-core as claimed in claim 1, characterized in that: Restore the 2 t The elements in the set are searched in table T i Output the value of the lower t bits. The specific steps include: (21): Construct a Yoroi-core ciphertext set. To obtain the correct pair, the set size is 2 t(R-2)+1.5-m , the ciphertext in the set has the following form: the first n in The bits are different, and the last n in (l-1) bits are the same, query the decryption machine, obtain the plaintext corresponding to the ciphertext in the set, and call the plaintext the original plaintext; (22): Expand each original plaintext in (21) by first checking the first n in The set to which the bit belongs Use the same The other elements in are replaced, because the set The size is 2 m , each original plaintext can be expanded to 2 m plaintext, called 2 m The plaintext is the extended plaintext, and the encryption machine is queried to obtain the ciphertext corresponding to the extended plaintext; If the extended plaintext is obtained by extending the same original plaintext, the extended plaintext is of the same type; if the extended plaintext is obtained by extending different original plaintexts, the extended plaintext is of different types; (23): Verify the original plaintext of (21) to determine whether the original plaintext can form a correct pair. If so, output the correct pair. Pair the ciphertexts of different types of extended plaintexts. If the original plaintext pair is a correct pair, the ciphertext pair of the extended plaintext is 2 -t(R-2) The probability that the difference is satisfied only in the first n in Bit active, if the original plaintext pair is not the correct pair, the ciphertext pair of the expanded plaintext is The probability that the difference is satisfied only in the first n in Bit active, any two original plaintexts expanded into a plaintext pair that forms exactly 2 t(R-2) pairs, so if the difference between the extended plaintext and the ciphertext appears only in the first n in If the bit is active, the original pair corresponding to this extended pair is considered to be the correct pair; (24): Set a counter for each candidate permutation and input the correct pair into , then passes through the candidate permutation, and finally passes through the linear layer. Observe the output of the linear layer. If the linear layer output difference is only active in the first t bits, add 1 to the counter of this permutation. The final counter value is equal to the permutation of the number of correct pairs, which is the correct permutation.
7. The black box attack method for Yoroi-core as claimed in claim 1, characterized in that: The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to satisfy the permutation property. The specific steps include: (31) Let a correct pair be in: Calculate the correct difference of the lower t bits of the lookup table, expressed as (ζ1, ζ2, ..., ζ1); construct two 2 2m Plaintext set, let the plaintext in the first set be: Among them, P1[1] traverses the set Elements in, P1[2] traverses the collection The elements, i, j in are all arbitrary; the plaintext in the second set: Among them, P2[1] traverses the set Elements in, P2[2] traverses the collection The elements in is the correct input for one of the plaintexts in the kth lookup table, represents the set of t bits i after the lookup table output, and queries the encryption machine to obtain the corresponding ciphertext; (32) Pair the ciphertexts in the first set with those in the second set. If the plaintexts in the first set and the second set satisfy that the high m bits of the outputs of P1[2] and P2[2] after the lookup table are the same, then this pair is also a correct pair. The difference between their outputs is only in the first n bits. in The probability of a bit being active is 2 -t(R-2) , otherwise their output differences are only in the first n in The probability of a bit being active is Each pair of P1[2] and P2[2] is tested 2 2m Therefore, the output differential satisfies only the first n in For pairs with active bits, we assume that the high m bits of the outputs of P1[2] and P2[2] after the lookup table are the same, and classify the values of P1[2] and P2[2] into one set; (33) Repeat steps (31) and (32). When repeating (31), replace the values of i and j in the corresponding step. The values of i and j can be different from the previous values. Merge the sets with intersections in (32). Finally, we get 2 m There are different sets of elements in each set. After the lookup table is completed, the output high m bits are the same, but the specific value is unknown, so a random value is assigned to it because the high m bits do not pass the linear layer.
8. The black box attack system against Yoroi-core is characterized by: include: The user client uses the encryption algorithm Yoroi-16 or Yoroi-32 to perform R+1 rounds of encryption on the original plaintext data to obtain the ciphertext data; the attack client performs the following steps in each round of the first R rounds of encryption: (1) The input of the lookup table is divided into two parts according to whether the output low t bits are the same. t A collection; (2) Based on the elements in each set, restore the value of the low t bits of the corresponding set; (3) The input of the lookup table is divided into two parts according to whether the high m bits of the output are the same. m A set is then assigned any value to it to satisfy the permutation property; (4) Restore the lookup table of the current round; Repeat (1) to (4) until the lookup table for all rounds is restored; The attack client decrypts the ciphertext data based on the recovered lookup table to obtain the decrypted plaintext, and determines whether the decrypted plaintext is consistent with the original plaintext. If they are consistent, it means that the black box attack is successful and the current encryption algorithm is not secure. A prompt to change the key is sent to the user client. If they are inconsistent, it means that the black box attack fails and the current encryption algorithm is secure.
9. The black box attack system for Yoroi-core as claimed in claim 8, characterized in that: The system includes: a user client generates a lookup table T before encrypting the original plaintext data using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k .
10. The black box attack system for Yoroi-core as claimed in claim 9, characterized in that: The user client generates a lookup table T before encrypting the original plaintext data using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Generate nonlinear permutation S for encryption algorithm Yoroi-32 i ; Generate block cipher E k , and the inverse of the block cipher D k ,include: Preprocessing before algorithm execution generates lookup table T i : Generate a lookup table T before encrypting using the encryption algorithm Yoroi-16 or Yoroi-32 i ; Execute 16 rounds of small group SPN structure algorithm to generate nonlinear permutation S for encryption algorithm Yoroi-16 i ; Perform 32 rounds of small group SPN structure algorithm on encryption algorithm Yoroi-32 to generate nonlinear permutation S i ; The algorithm of the 16-round small group SPN structure has the same steps as the algorithm of each round of the 32-round small group SPN structure; the algorithm of each round of the small group SPN structure includes: firstly processing the input data by S-box, then processing the processing result of the S-box by the linear layer MC, and then processing the processing result of the linear layer MC by XOR.
