New Form of Permutation Bias and Secret Key Leakage in Keystream Bytes of RC4

Subhamoy Maitra, Goutam Paul

Abstract

This research uncovers a previously unidentified form of internal permutation bias in the RC4 stream cipher, specifically within the nested state $S[S[y]]$. The authors demonstrate that these biases persist longer than previously assumed, leaking secret key information into the 256th and 257th keystream bytes. Through a combination of theoretical recurrence relations and large-scale simulations, the study provides a framework for exploiting these long-range biases in cryptanalysis.

Introduction

RC4 is a widely used stream cipher composed of two main components: the Key Scheduling Algorithm (KSA) and the Pseudo-Random Generation Algorithm (PRGA). While the initial state of RC4 has long been known to exhibit biases—where certain permutation bytes correlate with linear combinations of the secret key—it was generally believed that these biases dissipated as the cipher progressed. This paper challenges that assumption by identifying "long-range" biases that reappear late in the keystream.

The Nested Permutation Bias

A central contribution of this work is the analysis of the nested permutation state $S[S[y]]$. Unlike traditional analysis focusing on $S[y]$, the authors discover that $S[S[y]]$ exhibits a unique bias profile. Specifically, the probability $P(S[S[y]] = f_y)$ does not monotonically decrease; instead, it increases during the middle stages of the KSA before eventually declining.

Extracted figure from page 5 of New Form of Permutation Bias and Secret Key Leakage in Keystream Bytes of RC4

This "Nested Discovery" suggests that the internal state retains more structure from the secret key than previously modeled, providing a new avenue for side-channel and statistical attacks.

Propagation and Keystream Leakage

The authors developed a mathematical framework to track how these internal permutation biases propagate into the output keystream bytes ($z_r$). By deriving complex recurrence relations, they proved that biases "reappear" at the 256th and 257th bytes—points where the cipher has completed a full cycle of its internal state.

Probability distributions of bias events across different indices, demonstrating the decay and persistence of secret key correlations.

The research highlights that if an attacker can determine the internal index $j$ (e.g., via power analysis), the propagation of these biases becomes even more pronounced, significantly simplifying the task of secret key recovery.

Experimental Results

To validate their theoretical findings, the researchers conducted extensive simulations using massive datasets of randomly generated 128-bit keys:

  • 10 million keys for initial bias observation.
  • 100 million keys to construct detailed keystream bias tables.
  • 1 billion keys to confirm specific leakage scenarios.

The results confirmed that the 256th and 257th keystream bytes are significantly biased. For instance, an attacker utilizing these new $S[S[y]]$ biases alongside existing ones can guess the first keystream byte ($z_1$) with a 27% advantage over random guessing. Furthermore, observing the first 32 bytes of the keystream yields a 40% advantage in recovering key-related information.

Conclusion

While the absolute magnitude of these biases remains small (e.g., 0.0053 vs. 0.0039 for random), they are cryptographically significant. This work demonstrates that RC4's state evolution is less "randomizing" than once thought. Future research may extend this analysis to deeper nesting levels, such as $S[S[S[y]]]$, to uncover further "ghost" biases in the keystream.

Summary updated

BibTeX
@inproceedings{maitra2008new,
  author = {Subhamoy Maitra and Goutam Paul},
  title = {{New Form of Permutation Bias and Secret Key Leakage in Keystream Bytes of RC4}},
  booktitle = {Fse},
  year = {2008},
  doi = {10.1007/978-3-540-71039-4\_16},
}
Figure