10
2
Fork 0

fixed exponents

This commit is contained in:
m3rc1fulcameron 2020-05-26 01:22:46 -04:00
parent 2a87c174cd
commit 5f364e4742
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ Many optimized implementations of AES utilize lookup tables to combine all steps
Many CPUs cache RAM accesses so as to speed up subsequent accesses to the same address. This is done because accessing RAM is quite slow, and accessing cache is quite fast. This behavior would imply that on systems which implement such caching methods, there is a correlation between the amount of time it takes to encrypt a particular plaintext and the occurrences of repeated values of a plaintext byte XORd with a key byte. Accordingly, for every i, j, p<sub>i</sub> ⊕ p<sub>j</sub> in a family (with i, j being byte indexes, p being the plaintext, and families corresponding to which lookup table is being used), we calculate the average time to encrypt such a message over all messages. We then determine if for any pair of characters p<sub>i</sub>, p<sub>j</sub> there is a statistically significant shorter encryption time compared to the average. If so, we can conclude that <sub>i</sub> ⊕ k<sub>i</sub> = p<sub>j</sub> ⊕ k<sub>j</sub> => p<sub>i</sub> ⊕ p<sub>j</sub> = k<sub>i</sub> ⊕ k<sub>j</sub>. From this information, we gain a set of redundant system of equations relating different key bytes at different indexes with each other. It is important to note that in order for this attack to work, we must know at least one key byte in each family in order to actually solve each system of equations. Additionally, due to how cache works, this attack only leaks the most significant q bits (q being related to the number of items in a cache line). Once the set of possible partial keys (accounting for the ambiguity in the least significant bits of each derived byte) has been obtained by the above method, an attacker may brute force the remaining unknown key bytes. Many CPUs cache RAM accesses so as to speed up subsequent accesses to the same address. This is done because accessing RAM is quite slow, and accessing cache is quite fast. This behavior would imply that on systems which implement such caching methods, there is a correlation between the amount of time it takes to encrypt a particular plaintext and the occurrences of repeated values of a plaintext byte XORd with a key byte. Accordingly, for every i, j, p<sub>i</sub> ⊕ p<sub>j</sub> in a family (with i, j being byte indexes, p being the plaintext, and families corresponding to which lookup table is being used), we calculate the average time to encrypt such a message over all messages. We then determine if for any pair of characters p<sub>i</sub>, p<sub>j</sub> there is a statistically significant shorter encryption time compared to the average. If so, we can conclude that <sub>i</sub> ⊕ k<sub>i</sub> = p<sub>j</sub> ⊕ k<sub>j</sub> => p<sub>i</sub> ⊕ p<sub>j</sub> = k<sub>i</sub> ⊕ k<sub>j</sub>. From this information, we gain a set of redundant system of equations relating different key bytes at different indexes with each other. It is important to note that in order for this attack to work, we must know at least one key byte in each family in order to actually solve each system of equations. Additionally, due to how cache works, this attack only leaks the most significant q bits (q being related to the number of items in a cache line). Once the set of possible partial keys (accounting for the ambiguity in the least significant bits of each derived byte) has been obtained by the above method, an attacker may brute force the remaining unknown key bytes.
In the case of Leaky Crypto, a set of 100,000 plaintexts and corresponding encryption times is provided along with the first six bytes of the encryption key. We ran an analyzer program[^1] against these plaintexts to obtain the probable correlation between different indexes in the key with respect to the XOR product of those bytes with plaintext bytes. Per the above, the plaintexts and timing data provided enough information to derive the systems of equations which may be used to solve for key bytes, and the first 6 bytes of the key provided enough information to actually solve said systems of equations. Given the ambiguity of the low bits of each derived key byte, we obtained 2^14^ partial keys with three unknown bytes each. Thus, we reduced the problem of guessing 2^128^ bits to guessing only 2^38^ bits. We fed our derived partial keys into [Hulk](https://github.com/pgarba/Hulk) to brute force the remaining bytes for each candidate partial key. After 30 minutes had passed, we successfully brute forced the key. In the case of Leaky Crypto, a set of 100,000 plaintexts and corresponding encryption times is provided along with the first six bytes of the encryption key. We ran an analyzer program[^1] against these plaintexts to obtain the probable correlation between different indexes in the key with respect to the XOR product of those bytes with plaintext bytes. Per the above, the plaintexts and timing data provided enough information to derive the systems of equations which may be used to solve for key bytes, and the first 6 bytes of the key provided enough information to actually solve said systems of equations. Given the ambiguity of the low bits of each derived key byte, we obtained 2<sup>14</sup> partial keys with three unknown bytes each. Thus, we reduced the problem of guessing 2<sup>128</sup> bits to guessing only 2<sup>38</sup> bits. We fed our derived partial keys into [Hulk](https://github.com/pgarba/Hulk) to brute force the remaining bytes for each candidate partial key. After 30 minutes had passed, we successfully brute forced the key.
[^1]: ```python [^1]: ```python
from itertools import combinations from itertools import combinations