Elsevier

Information Sciences

Volume 177, Issue 7, 1 April 2007, Pages 1715-1727
Information Sciences

Finding an internal state of RC4 stream cipher

https://doi.org/10.1016/j.ins.2006.10.010Get rights and content

Abstract

The RC4 is a stream cipher widely deployed in software applications due to its simplicity and efficiency. The paper presents a cryptanalytic attack that employs the tree representation of this cipher and introduces an abstraction in the form of general conditions for managing the information about its internal state. In order to find the initial state, the tree of general conditions is searched applying the hill-climbing strategy. The complexity of this attack is lower than that of an exhaustive search. The attack is derived from a general cryptanalytic approach for a class of table-shuffling ciphers, whose next-state function permutes the table entries. Incorporating the general conditions in the existing backtracking algorithm, the estimated complexity of the cryptanalytic attack is decreased below the best published result but the RC4 still remains a quite secure cipher in practice.

Introduction

The RC4 is a stream cipher widely deployed in software applications due to its simplicity and efficiency. The RC4 Keystream generator (Ron’s code #4, RSA Data Security Inc., 1987) is based on the table-shuffling principle and is designed for fast software implementation [14]. It is used in many commercial products, including Lotus Notes, Oracle Secure SQL, Microsoft Windows, as well as some standards such as Secure Sockets Layer standard SSL 3.0.

The RC4 is, in fact, a family of algorithms parameterized by a positive integer n, which denotes the width of a table entry and the width of output symbol in bits, as well (usually n = 8). The initial table is derived from a secret key. The table varies slowly in time steps by swapping two entries indexed by two pointers, while all other entries in the table remain the same. Then, the output function determines the position in the table whose value is used as the output symbol. A sequence of output symbols makes the stream, which is XORed with the plaintext to generate the final ciphertext. Since the output sequence depends on the initial table only, the knowledge of this table enables generating the output sequence without knowing the secret key.

The cryptanalysis research of the RC4 stream cipher has been mainly devoted to the statistical analysis of the RC4 output sequence [1], [3], [4], [7], [10], [11], or to the RC4 initialization weaknesses [2], [5], [13] that can serve for the RC4 distinguishing. It is still an open question if these results can be used in the RC4 practical cryptanalysis. Although this stream cipher was published in 1994, concrete cryptanalytic algorithms have been very rare in the literature up to now. Actually nowadays, the most important algorithms for decipherment of RC4 are an algorithm formulated by Knudsen et al. [6] and the other, very similar one, by Mister and Tavares [9]. These algorithms exploit the combinatorial nature of RC4 to reduce the search space as an improvement over the exhaustive search. Although without a real threat for the security of the cipher, the mentioned algorithms could be used in completing the internal state, given some additional information [8].

In this paper, the efforts regarding RC4 stream cipher cryptanalysis are devoted to finding maximum amount of information about the current state available at a given time and to formulating a cryptanalytic attack based on this information. Therefore, we propose the tree representation [16] of the RC4 algorithm which contains a set of trees, each for one output symbol. The nodes and branches of these trees encompass all possible information at a given time. However, since the trees are progressively large, we could not exploit practically all available information in the attack. This problem is immanent in all other attacks. In our algorithm we propose an analytical abstraction named the general conditions of the tree information in order to consider a reasonable amount of information [15]. Each general condition practically represents all conditions from a subtree. The general conditions are organized into the tree structure. Our algorithm searches this tree applying the hill-climbing strategy to find the internal state. The information gained from general conditions can also be used in other attacks on RC4 cipher and increase their efficiency. In this paper we suggest the modification of the backtracking algorithm that is given in Ref. [6].

The rest of the paper is organized in the following way. The general approach to the cryptanalysis of the stream ciphers based on table permutation is described in Section 2 with corresponding subsections about tree representation of information, the search algorithm and complexity analysis. Section 3 describes how the general approach is applied to the RC4 cryptanalysis. Section 4 presents the modified backtracking algorithm where corresponding subsections show the modification of general conditions, the effects of modified conditions examination and the complexity analysis. Conclusions are given in Section 5.

Section snippets

General approach

The stream ciphers based on the table-shuffling principle use a relatively big table that slowly varies in time under the control of itself. In this paper we consider a class of table-shuffling based stream ciphers where the next-state function permutes the internal state table entries, and the output function determines a position of output symbol in the table. As can be seen, the previous internal state directly affects the next one. Although it does not seem so at first sight, the swapping

Attacking the RC4

The proposed general approach is applied to the cryptanalysis of the RC4 stream cipher. As given in [14], the internal state of RC4 at time t consists of a permutation table St of 2n different n-bit values and of two n-bit pointers it and jt. For the pointers i0 and j0 initialized to zero, the RC4 algorithm can be described asit=t,jt=jt-1+St-1(t),St(t)=St-1(jt),St(jt)=St-1(t),Zt=St(St(t)+St(jt)).As can be seen, a new table is generated in each iteration by the permutation of two elements of the

Improving the backtracking algorithm

This section presents the incorporation of our approach based on the general conditions into the RC4 attack given in [6] in strive to further improve its efficiency that was the best published one until now. In the first subsection we present the modification of the original algorithm. Since in the modified backtracking algorithm the general conditions are used in a specific environment implied by the original algorithm, they can be simplified in a way presented in Section 4.2. The effects of

Conclusions

We have proposed the general approach to the cryptanalysis of a class of table-shuffling based stream ciphers, which promotes an idea of using all information available at a given time. The information is organized into the trees from which the general conditions are analytically extracted. After that, the general conditions are, according to their probabilities, ordered into the tree of general conditions, which is searched using the hill-climbing strategy in order to reconstruct the initial

References (16)

  • R.R. Yager

    OWA trees and their role in security modeling using attack trees

    Information Science

    (2006)
  • E. Biham et al.

    Impossible fault analysis of RC4 and differential fault analysis, Fast Software Encryption 2005

    Lecture Notes in Computer Science

    (2005)
  • S. Fluhrer et al.

    Weakness in the key scheduling algorithm of RC4, Selected Areas in Cryptography 2001

    Lecture Notes in Computer Science

    (2001)
  • S. Fluhrer et al.

    Statistical analysis of the alleged RC4 Keystream Generator, Fast Software Encryption 2000

    Lecture Notes in Computer Science

    (2000)
  • J. Golić

    Linear statistical weakness of alleged RC4 Keystream Generator, Advances in Cryptology – EUROCRYPT ‘97

    Lecture Notes in Computer Science

    (1997)
  • A. Grosul, D. Wallach, A related-key cryptanalysis of RC4, Rice University, Technical Report TR-00-358, June...
  • L. Knudsen et al.

    “Analysis methods for (alleged) RC4”, Advances in Cryptology – ASIACRYPT ‘98

    Lecture Notes in Computer Science

    (1998)
  • I. Mantin

    Predicting and distinguishing attacks on RC4 Keystream generator, Advances in Cryptology – EUROCRYPT 20 05

    Lecture Notes in Computer Science

    (2005)
There are more references available in the full text version of this article.

Cited by (31)

  • RC4 encryption - A literature survey

    2015, Procedia Computer Science
View all citing articles on Scopus

This work has been partially supported by the Ministries of Science and Technology of Serbia (# IT.1.24.0041) and Spain (# TIC2003-09061-C03-02 and the “Ramon y Cajal” program).

1

Tel.: +381 11 2774 024; fax: +381 11 2776 583.

2

Tel.: +34 91 3367322; fax: +34 91 3367323.

View full text