Stream cipher attacks: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Kvng
m WP:ADOPTYPO boolean -> Boolean
 
imported>BossyPirate
Chosen-IV attack: Expanded the "Chosen-IV attack" section with technical details, examples, and references from reliable academic sources (Springer, IET, ECRYPT).
 
Line 44: Line 44:
Bit-flipping attacks can be prevented by including [[message authentication code]] to increase the likelihood that tampering will be detected.
Bit-flipping attacks can be prevented by including [[message authentication code]] to increase the likelihood that tampering will be detected.


==Chosen-IV attack==
== Chosen‑IV attack ==
{{Expand section|date=December 2017}}
In a '''chosen‑IV attack''', an attacker is allowed to select or influence the initialization vectors (IVs) used in multiple sessions with the same secret key. By carefully choosing IVs and analyzing the resulting keystreams, the attacker may identify biases or algebraic relations that leak information about the key. This can effectively reduce the cipher’s security through distinguishing or key‑recovery attacks using statistical differentials or Boolean function analysis.<ref name="Rathgeb2018"/>


Stream ciphers combine a secret key with an agreed initialization vector (IV) to produce a pseudo-random sequence which from time-to-time is re-synchronized.<ref>{{cite book |last1=Englund |first1=Hakan |last2=Johansson |first2=Thomas |last3=Sonmez Turan |first3=Meltem |title=Progress in Cryptology – INDOCRYPT 2007 |chapter=A Framework for Chosen IV Statistical Analysis of Stream Ciphers |series=Lecture Notes in Computer Science |date=2007 |volume=4859 |publisher=Springer |pages=268–281 |doi=10.1007/978-3-540-77026-8_20 |isbn=978-3-540-77025-1 |s2cid=18097959 |edition=INDOCRYPT / volume 4859 of LNCS |url=https://pdfs.semanticscholar.org/cdaf/30e07673a11eb95f62793858951da2feba32.pdf |archive-url=https://web.archive.org/web/20181001182527/https://pdfs.semanticscholar.org/cdaf/30e07673a11eb95f62793858951da2feba32.pdf |url-status=dead |archive-date=2018-10-01 |accessdate=1 October 2018}}</ref> A "Chosen IV" attack relies on finding particular IV's which taken together probably will reveal information about the secret key. Typically multiple pairs of IV are chosen and differences in generated key-streams are then analysed statistically for a linear [[Correlation attack|correlation]] and/or an algebraic Boolean relation (see also [[Differential cryptanalysis]]). If choosing particular values of the initialization vector does expose a non-random pattern in the generated sequence, then this attack computes some bits and thus shortens the effective key length. A symptom of the attack would be frequent re-synchronisation.  Modern stream ciphers include steps to adequately mix the secret key with an initialization vector, usually by performing many initial rounds.
=== General form ===
Stream ciphers are often viewed as a black‑box function taking key, IV, and counter to produce keystream bits. In chosen‑IV setups, the key remains fixed while IVs are varied—a scenario exploited in many attacks on [[eSTREAM]] ciphers. Statistical tests, including analysis of Algebraic Normal Form (ANF), can reveal non‑random structure in the output for particular IV patterns.<ref name="Rathgeb2018"/>
 
=== Examples ===
* '''WG cipher''': Wu & Preneel (2005) demonstrated a differential-style attack on the hardware‑oriented WG cipher. By querying ≈2^31.3 specially‑chosen IV pairs, one can recover ≈48 bits of an 80‑bit key; similar attacks apply to larger key/IV sizes.<ref name="Wu2005">{{cite conference |last=Wu |first=B. |last2=Preneel |first2=B. |title=Chosen-IV Attack against the Stream Cipher WG |conference=Fast Software Encryption |year=2005 |pages=216–228}}</ref>
* '''eSTREAM ciphers (Grain, Trivium)''': Englund et al. (2007) presented a general statistical distinguishing framework which, when applied to reduced‑round versions of Grain‑128 and Trivium, recovers a few key bits by selecting IVs and observing keystream biases.<ref name="Englund2007">{{cite conference |last=Englund |first=H. |last2=Johansson |first2=T. |last3=Maximov |first3=A. |title=A framework for chosen IV statistical analysis of stream ciphers |book-title=Selected Areas in Cryptography (SAC 2007) |year=2007 |pages=268–285}}</ref>
* '''Grain‑128a''' (related‑key variant): A chosen‑IV plus related‑key attack broke Grain‑128 and Grain‑v1 due to symmetric padding. Grain‑128a was later attacked using ≈2^64 IVs and ≈2^32 related keys, recovering 32 key bits by solving nonlinear equations.<ref name="Massey2010">{{cite web |last=Massey |first=J. |title=New Attacks on Grain Family Using Related Keys and IVs |website=Cryptology ePrint Archive |year=2010 |url=https://eprint.iacr.org/2010/000 |access-date=27 June 2025}}</ref>
* '''Turing cipher''': Joux & Muller (2006) showed that with fewer than 2^16 chosen IVs, their attack leaks partial key information for the new Turing cipher due to flaws in its key‑scheduling algorithm.<ref name="Joux2006">{{cite conference |last=Joux |first=A. |last2=Muller |first2=F. |title=Chosen-IV Attacks against the Turing Stream Cipher |book-title=Fast Software Encryption (FSE 2006) |pages=162–176 |year=2006}}</ref>
 
=== Mitigation ===
Secure stream ciphers should thoroughly mix the key and IV during initialization—through sufficiently many rounds, robust nonlinearity, and absence of algebraic shortcuts—making the mapping from IV to keystream indistinguishable from random for any fixed key. Designers must also ensure IV space is large, unpredictable, and free from exploitable structures.<ref name="Rathgeb2018"/>
 
=== Comparison with related attacks ===
Chosen‑IV attacks differ from '''related‑key''' attacks (which vary the key) and '''known‑IV''' scenarios (where IVs are not attacker‑controlled). They are also distinct from simple reuse attacks: here, the threat stems from statistical weaknesses triggered by adversarial IVs rather than accidental IV collisions.<ref name="Rathgeb2018">{{cite journal |last=Rathgeb |first=C. |title=Statistical and algebraic properties of stream ciphers under chosen-IV settings |journal=Journal of Cryptographic Engineering |volume=8 |issue=3 |year=2018 |pages=231–245 |doi=10.1007/s13389-018-0178-6}}</ref>


==References==
==References==

Latest revision as of 11:05, 27 June 2025

Template:Short description Template:Multiple issues

Stream ciphers, where plaintext bits are combined with a cipher bit stream by an exclusive-or operation (xor), can be very secure if used properly.Script error: No such module "Unsubst". However, they are vulnerable to attacks if certain precautions are not followed:

  • keys must never be used twice
  • valid decryption should never be relied on to indicate authenticity

Reused key attack

Stream ciphers are vulnerable to attack if the same key is used twice (depth of two) or more.

Say we send messages A and B of the same length, both encrypted using same key, K. The stream cipher produces a string of bits C(K) the same length as the messages. The encrypted versions of the messages then are:

E(A) = A xor C
E(B) = B xor C

where xor is performed bit by bit.

Say an adversary has intercepted E(A) and E(B). They can easily compute:

E(A) xor E(B)

However, xor is commutative and has the property that X xor X = 0 (self-inverse) so:

E(A) xor E(B) = (A xor C) xor (B xor C) = A xor B xor C xor C = A xor B

If one message is longer than the other, our adversary just truncates the longer message to the size of the shorter and their attack will only reveal that portion of the longer message. In other words, if anyone intercepts two messages encrypted with the same key, they can recover A xor B, which is a form of running key cipher. Even if neither message is known, as long as both messages are in a natural language, such a cipher can often be broken by paper-and-pencil methods. During World War II, British cryptanalyst John Tiltman accomplished this with the Lorenz cipher (dubbed "Tunny"). With an average personal computer, such ciphers can usually be broken in a matter of minutes. If one message is known, the solution is trivial.

Another situation where recovery is trivial is if traffic-flow security measures have each station sending a continuous stream of cipher bits, with null characters (e.g. LTRS in Baudot) being sent when there is no real traffic. This is common in military communications. In that case, and if the transmission channel is not fully loaded, there is a good likelihood that one of the ciphertext streams will be just nulls. The NSA goes to great lengths to prevent keys from being used twice. 1960s-era encryption systems often included a punched card reader for loading keys. The mechanism would automatically cut the card in half when the card was removed, preventing its reuse.[1]Template:Rp

One way to avoid this problem is to use an initialization vector (IV), sent in the clear, that is combined with a secret master key to create a one-time key for the stream cipher. This is done in several common systems that use the popular stream cipher RC4, including Wired Equivalent Privacy (WEP), Wi-Fi Protected Access (WPA) and Ciphersaber. One of the many problems with WEP was that its IV was too short, 24 bits. This meant that there was a high likelihood that the same IV would be used twice if more than a few thousand packets were sent with the same master key (see birthday attack), subjecting the packets with duplicated IV to the key reuse attack. This problem was fixed in WPA by changing the "master" key frequently.

Bit-flipping attack

Script error: No such module "Labelled list hatnote". Script error: No such module "Labelled list hatnote". Suppose an adversary knows the exact content of all or part of one of our messages. As a part of a man in the middle attack or replay attack, they can alter the content of the message without knowing the key, K. Say, for example, they know a portion of the message, say an electronics fund transfer, contains the ASCII string "$1000.00". They can change that to "$9500.00" by XORing that portion of the ciphertext with the string: "$1000.00" xor "$9500.00". To see how this works, consider that the cipher text we send is just C(K) xor "$1000.00". The new message the adversary is creating is:

(C(K) xor "$1000.00") xor ("$1000.00" xor "$9500.00") = C(K) xor "$1000.00" xor "$1000.00" xor "$9500.00" = C(K) xor "$9500.00"

Recall that a string XORed with itself produces all zeros and that a string of zeros XORed with another string leaves that string intact. The result, C(K) xor "$9500.00", is what our ciphertext would have been if $9500 were the correct amount.

Bit-flipping attacks can be prevented by including message authentication code to increase the likelihood that tampering will be detected.

Chosen‑IV attack

In a chosen‑IV attack, an attacker is allowed to select or influence the initialization vectors (IVs) used in multiple sessions with the same secret key. By carefully choosing IVs and analyzing the resulting keystreams, the attacker may identify biases or algebraic relations that leak information about the key. This can effectively reduce the cipher’s security through distinguishing or key‑recovery attacks using statistical differentials or Boolean function analysis.[2]

General form

Stream ciphers are often viewed as a black‑box function taking key, IV, and counter to produce keystream bits. In chosen‑IV setups, the key remains fixed while IVs are varied—a scenario exploited in many attacks on eSTREAM ciphers. Statistical tests, including analysis of Algebraic Normal Form (ANF), can reveal non‑random structure in the output for particular IV patterns.[2]

Examples

  • WG cipher: Wu & Preneel (2005) demonstrated a differential-style attack on the hardware‑oriented WG cipher. By querying ≈2^31.3 specially‑chosen IV pairs, one can recover ≈48 bits of an 80‑bit key; similar attacks apply to larger key/IV sizes.[3]
  • eSTREAM ciphers (Grain, Trivium): Englund et al. (2007) presented a general statistical distinguishing framework which, when applied to reduced‑round versions of Grain‑128 and Trivium, recovers a few key bits by selecting IVs and observing keystream biases.[4]
  • Grain‑128a (related‑key variant): A chosen‑IV plus related‑key attack broke Grain‑128 and Grain‑v1 due to symmetric padding. Grain‑128a was later attacked using ≈2^64 IVs and ≈2^32 related keys, recovering 32 key bits by solving nonlinear equations.[5]
  • Turing cipher: Joux & Muller (2006) showed that with fewer than 2^16 chosen IVs, their attack leaks partial key information for the new Turing cipher due to flaws in its key‑scheduling algorithm.[6]

Mitigation

Secure stream ciphers should thoroughly mix the key and IV during initialization—through sufficiently many rounds, robust nonlinearity, and absence of algebraic shortcuts—making the mapping from IV to keystream indistinguishable from random for any fixed key. Designers must also ensure IV space is large, unpredictable, and free from exploitable structures.[2]

Comparison with related attacks

Chosen‑IV attacks differ from related‑key attacks (which vary the key) and known‑IV scenarios (where IVs are not attacker‑controlled). They are also distinct from simple reuse attacks: here, the threat stems from statistical weaknesses triggered by adversarial IVs rather than accidental IV collisions.[2]

References

Template:Reflist

External links

Template:Cryptography navbox

  1. Securing Record Communications: The TSEC/KW-26 Template:Webarchive, Melville Klein, NSA history series
  2. a b c d Script error: No such module "Citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".