DES Fixed Points in IoT Hacking Study
DES Fixed Points in IoT Hacking Study
ABSTRACT Fixed points can be defined as EK (P) = P for a key K and plaintext P where E is the encryption
function. For the Data Encryption Standard (DES) algorithm there are four weak keys, such that EK (EK (P)) =
P for all P. For each weak key there are 232 fixed points where all the sixteen round keys are the same. While
there is a high probability that DES has fixed points for non-weak keys, nobody has reported such (P, K )
pairs until now. Performing 1000 × 256 DES encryption operations using 256 Xilinx Spartan-6 parallel
cost-effective FPGAs we answer the question of Judy H. Moore and Gustavus J. Simmons: we report the
first known DES fixed points where all round keys are different. A case study is presented where an IoT
based Sensor Device Authentication Algorithm (SDAA) can be exploited using DES fixed points.
INDEX TERMS Cryptography, DES fixed points, RIVYERA FPGA, DES cracking.
keys we have Assuming that the EK selection behaves like a random one,
about (1 − e−1 ) × 100 ≈ 63.2% of all keys have at least one
DESK1 (P) = DESK2 (P) = 0xF02D67223CEAF91C. fixed point. An ideal block cipher should behave as a random
Distinguished points allowed finding such collisions much permutation, and as n grows, the probability distribution of
faster than brute-force, and it was not necessary to check the the number of fixed points of a random permutation of a set
whole 256 key space. Applying the theory of distinguished of size n approaches the Poisson distribution with expected
points does not contribute too much to finding fixed points value 1. From the linearity of expectation the expected num-
in a block cipher, however posing an interesting question: ber of fixed points in a randomly selected EK permutation
Is it possible to replace multiple DES encryptions with a is 1 and we recall that 37% of the EK selection should have
single one? no fixed points at all. In a random permutation fixed points are
uniformly distributed and we should have no better approach
C. DES IS NOT A GROUP for finding them than an exhaustive search. In case of DES
In 1992 Campbell and Wiene [9] proved that the set of DES there are 264 ! permutations of 64-bit blocks. We have 256
permutations (encryption and decryption for each DES key) DES keys, so DES selects 256 permutations from all the
is not closed under functional composition. This was a very possible 264 ! permutations. If DESK selection behaves like
important result, and implied that multiple DES encryption is a random one, then 1 − e−1 = 62.3% proportion of all
not equivalent to single DES encryption. This result means keys have at least one fixed point. Encrypting all possible
that TripleDES with independent keys cannot be replaced 264 plaintext P with N randomly chosen different key K
with one single DES encryption. The authors also showed that (which is N × 264 DES encryptions) we have a fixed point
the size of the subgroup generated by the set of DES permu- with 1 − e−N probability. For N = 2 we already have
tations is greater than 102499 , which is too large for potential 86% probability. If we fix a plaintext P and brute-force the
attacks on DES which would exploit a small subgroup. whole 256 key space then one can expect that every one out
of 512 plaintexts will encrypt to the same ciphertext with
D. BRUTE-FORCE 86.47% probability (512 × 256 = 2 × 264 ). Performing
After 45 years of the DES standardization, it seems that we 1000 × 256 DES operations we expect approximately 2-3
still do not have any practical cryptanalysis technique to find fixed points with high probability. This is the theory for
fixed points in the DES algorithm for non-weak keys better random permutations, and there is no guarantee that DES has
than brute-force. What is the expected amount of computation this property. There is a chance that some underlying structure
we need to perform to expect at least one fixed point (if any) of the DES algorithm prevents the existence of fixed points.
in a block cipher? Can we solve this problem using currently To answer this question and to perform such a huge amount of
available computational resources? To demonstrate the diffi- DES operations we need extraordinary computing resources.
culty of the problem, we discuss the probability distribution
of fixed points in the next Section. IV. EXPERIMENTAL SETUP
The Cost-Optimized Parallel Code Breaker FPGA hardware
III. MATHEMATICAL BACKGROUND ON FIXED POINTS architecture (COPACOBANA) [10] was introduced in the
Derangement is a permutation of the elements of a set, such annual Conference on Cryptographic Hardware and Embed-
that no element appears in its original position, in other words, ded Systems (CHES) in 2006. The original hardware con-
a derangement is a permutation that has no fixed points. sisted of 120 FPGAs of type Xilinx Spartan3-1000 and
For m ≥ 0 and 0 ≤ r ≤ m, let Dm,r be the number of was able to check approximately 48 billion DES keys per
permutations of {1, . . . , m} that have exactly r fixed points, second. Thus, the whole 256 key space can be checked in
then we have 17.37 days. To find fixed points for non-weak keys one
m!
m needs to do an exhaustive key search on the entire 256 key
Dm,0 = !m = , Dm,r = · Dm−r,0 space several times. Performing 512 × 256 DES encryptions
e r
and finding only one fixed point with high probability with
We note that for m = 0 and r = 0 we have D0,0 = 1. The COPACOBANA would take 24.37 years.
probability of a randomly chosen permutation having exactly
Dm,r
r fixed points is m! . As the size of the permuted set grows, A. THE RIVYERA CLUSTER
we have the following limit
RIVYERA FPGA hardware architecture is the direct succes-
Dm,r e−1 sor of COPACOBANA [11]. The key features of RIVYERA
lim = . S6-LX150 server are:
m→∞ m! r!
The limit of the probability that a randomly selected EK • 128 Xilinx Spartan–6 LX150 (XC6SLX150) FPGA
permutation is a derangement (r = 0) is modules.
m
X (−1)i • Optimized DES cracking functionality
!m
lim = lim = e−1 ≈ 0.367879. • 820 billion DES keys/sec
m→∞ m! m→∞ i! • 1280 Watt consumption
i=0
For this particular research we were able to use two RIVY- Assuming that the DESK selection behaves like a random
ERA S6-LX150 servers equipped with 256 Xilinx Spartan–6 one, the probability that one of the keys select the iden-
LX150 FPGA modules which can be seen in Figure 2. tity permutation is 2k × 1/(2n !), which is very unlikely for
k = 56 and n = 64.
Theorem 1: There is no such DES key where the DESK
transformation generates the identity permutation.
Proof 1: Fix a random P ∈ P plaintext. Calculate
C = DESK (P) for all the 256 possible K ∈ K keys. It is
enough to find one P where the mapping DESK (P) always
generates a ciphertext C 6= P for all keys K . For P =
0x0000000000000000 we have DESK (P) 6= P for all the
possible 256 DES keys from which the theorem follows.
This particular question required only 256 DES operations
to solve. Using our test environment the whole experiment
took 12.3 hours to complete.
known DES fixed points where all round keys are different
to the research community. The second motivation was to
solve a cryptographic challenge and crack a unique n-cascade
DES algorithm reverse engineered from a smart sensor. In this
section we are going to present a short case-study adopted
from a penetration testing project conducted by the author
in 2019. We show that inappropriate cryptographic design
could lead to the full exploitation of a complex infrastructure.
A. INTERNET OF THINGS
The number of connected devices worldwide is exponen-
tially growing. The expression Internet of Things (IoT) can
TABLE 4. DES fixed point for non-weak keys.
be defined as a pervasive and ubiquitous network which
enables monitoring and control of the physical environment
by collecting, processing, and analyzing the data generated
by sensors or smart objects [13]. By 2025, forecasts suggest
that there will be more than 75 billion IoT connected devices
in use. In a complex environment where a high number of
embedded devices are connected to each other the protec-
C. VERIFICATION EXAMPLE tion of each device is extremely crucial. Due to the diverse
Searching DES fixed points took more than 5 months using nature of IoT devices, a key challenge in the design of IoT
the RIVYERA FPGA cluster, however one can easily verify systems is ensuring appropriate device identification and
a DES fixed point using a single notebook. The openssl authentication. The potential of attacks against these devices
enc -des-ecb command can be used to validate is underestimated [14], and most of the classical cyberattacks
DESK (P) = P easily: echo 9fe10d2e8c496143 | can be performed much more easily on these infrastructures.
xxd -r -p | openssl enc -des-ecb -nopad This trend can be observed in IoT cryptographic protocols
-K 5d460701328f2962 | xxd -p. too. A failure to follow cryptographic best practices by IoT
The OpenSSL 1.1.1n output for all the four DES fixed manufacturers is leaving a high proportion of the devices
points can be seen in Figure 3. vulnerable to cyber attacks. [15]. In a complex infrastructure
many different types of sensors and devices are being used
VI. CASE STUDY: CRACKING THE N-CASCADE DES for backward compatibility. Because of this one can still find
ALGORITHM algorithms which are based on old primitives such as DES,
The motivation of this paper was twofold. To answer the MD5 or SHA1. As a consequence IoT infrastructures can be
question of Moore and Simmons [4] and present the first an easy target for attackers.
and
K2 = 0x5D460701328F2962
which is a DES fixed point.
Then we have DESK2 (m) = m. This can easily be
verified by OpenSSL: echo 9fe10d2e8c496143 |
xxd -r -p | openssl enc -des-ecb -nopad
-K 5d460701328f2962 | xxd -p. The sensor returns
SDAA(m, K2 ) = m ⊕ K1 ⊕ SID
= 0x3D862E8F0EC34360
The sensor unique identifier is
SID = 0x7700AA0011002200.
From this we have the embedded K1 secret key which is
0xD56789A1938A0023. Having the embedded key K1 we
do not need access to the original IoT device, one can create a
fake one and can calculate SDAA(m, K2 ) using the K1 secret
key. Using a single DES fixed point one can compromise
as many sensors as needed to take control over the whole
smart-home IoT environment.
VII. CONCLUSION
DES Fixed points can be defined as DESK (P) = P for a key K
and a plaintext P. In this paper we answered the question
of Judy H. Moore and Gustavus J. Simmons and presented
the first publicly known DES fixed points for non-weak keys
Listing 1. Python3 implementation of SDAA bypass.
where all round keys are different. After 45 years of the
DES standardization, it seems that we still do not have any
practical cryptanalysis technique to find fixed points in the
DES algorithm for non-weak keys better than brute-force.
in every round:
Assuming that the DESK selection behaves like a random one,
DESK2 [DESK2 (x) ⊕ DESK−1 (x) ⊕ x] = DESK2 (x) = x about 63.2% of all keys should have at least one fixed point.
2
Computational results suggests that indeed DESK selection
or behaves like a random permutation. We have successfully
found two DES fixed points (which immediately leads two
DESK−1
2
[DESK2 (x) ⊕ DESK−1
2
(x) ⊕ x] = DESK−1
2
(x) = x more fixed points because of the DES key complement
property) using two RIVYERA S6-LX150 server equipped
It does not matter what is the ith bit of the key K1 . Applying with 256 Xilinx Spartan–6 FPGA modules.
64 rounds we still have x = m in the last round. After In complex IoT infrastructures many different types of
64 rounds SDAA returns with m ⊕ K1 ⊕ SID which leaks sensors and devices are being used, and for backward
out the K1 embedded secret key (m and SID is known by the compatibility some algorithms are using old cryptographic
attacker). Then key K1 can be used to calculate SDAA(m, K2 ) primitives such as DES or 3DES. We have presented a
without the presence of a valid IoT device. The SDAA vulnerable algorithm called Sensor Device Authentication
bypass method is implemented in python which can be seen Algorithm (SDAA) which can be exploited using DES fixed
in Listing 1. points. To the best of our knowledge this is the first published
example exploiting DES fixed points in the wild.
2) EXAMPLE The DES 56-bit key is no longer considered secure, and
The first step is to modify m and K2 (challenge) sent by IMP the small key size makes DES vulnerable against brute-force
to the target sensor. This can be achieved using MITM attack attacks. 3DES provides a simple method of increasing the
on the network (the communication between IMP and sensors key size of the original DES using three independent keys.
is using self-signed certificates). The attacker sends the fake However 3DES has a significantly larger key size, it seems
challenge to the target sensor, namely that the theory of distinguished points and key-collision pairs
can be used to find fixed points for 3DES. We plan to continue
m = 0x9FE10D2E8C496143 our research in this direction.