<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Stream_cipher_attacks</id>
	<title>Stream cipher attacks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Stream_cipher_attacks"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Stream_cipher_attacks&amp;action=history"/>
	<updated>2026-06-24T06:11:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Stream_cipher_attacks&amp;diff=682436&amp;oldid=prev</id>
		<title>imported&gt;Expert700: polished it for encyclopedic tone, readability, and consistency</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Stream_cipher_attacks&amp;diff=682436&amp;oldid=prev"/>
		<updated>2025-10-21T18:28:28Z</updated>

		<summary type="html">&lt;p&gt;polished it for encyclopedic tone, readability, and consistency&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Methods to break a stream cipher}}&lt;br /&gt;
{{Multiple issues|&lt;br /&gt;
{{More citations needed|date=February 2008}}&lt;br /&gt;
{{More footnotes|date=April 2016}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Stream cipher]]s, where [[plaintext]] bits are combined with a cipher bit stream by an exclusive-or operation ([[xor]]), can be secure if used properly.{{citation needed|date=July 2019}} However, they are vulnerable to attacks if certain precautions are not followed:&lt;br /&gt;
&lt;br /&gt;
* Keys must never be reused.&lt;br /&gt;
* Valid decryption should never be relied on to indicate authenticity.&lt;br /&gt;
&lt;br /&gt;
==Reused key attack==&lt;br /&gt;
[[Stream cipher]]s are vulnerable to attack if the same key is used more than once (a depth of two or greater).&lt;br /&gt;
&lt;br /&gt;
Suppose messages &amp;#039;&amp;#039;A&amp;#039;&amp;#039; and &amp;#039;&amp;#039;B&amp;#039;&amp;#039; of the same length are both encrypted using the same key, &amp;#039;&amp;#039;K&amp;#039;&amp;#039;. The stream cipher produces a string of bits &amp;#039;&amp;#039;C(K)&amp;#039;&amp;#039; of the same length as the messages. The encrypted versions of the messages are:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;E(A) = A xor C&amp;#039;&amp;#039;  &lt;br /&gt;
:&amp;#039;&amp;#039;E(B) = B xor C&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;xor&amp;#039;&amp;#039; is performed bit by bit.&lt;br /&gt;
&lt;br /&gt;
If an adversary intercepts &amp;#039;&amp;#039;E(A)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;E(B)&amp;#039;&amp;#039;, they can compute:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;E(A) xor E(B)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Because &amp;#039;&amp;#039;xor&amp;#039;&amp;#039; is [[commutative]] and has the property that &amp;#039;&amp;#039;X xor X = 0&amp;#039;&amp;#039; (self-inverse):&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;E(A) xor E(B) = (A xor C) xor (B xor C) = A xor B xor C xor C = A xor B&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If one message is longer than the other, the adversary can truncate the longer message to the size of the shorter one, revealing only that portion. In other words, if two messages are encrypted with the same key, an attacker can recover &amp;#039;&amp;#039;A xor B&amp;#039;&amp;#039;, which is a form of [[running key cipher]]. Even if neither message is known, as long as both are in a natural language, such a cipher can often be broken by hand methods. During [[World War II]], British cryptanalyst [[John Tiltman]] accomplished this with the [[Lorenz cipher]] (dubbed &amp;quot;Tunny&amp;quot;). With an average [[personal computer]], such ciphers can usually be broken in minutes. If one message is known, the solution is trivial.&lt;br /&gt;
&lt;br /&gt;
Another situation where recovery is trivial is when [[traffic-flow security]] measures require each station to send a continuous stream of cipher bits, with null characters (e.g. &amp;#039;&amp;#039;LTRS&amp;#039;&amp;#039; in [[Baudot code|Baudot]]) transmitted when there is no real traffic. This is common in military communications. In that case, if the transmission channel is not fully loaded, there is a high likelihood that one of the ciphertext streams will consist only of nulls. The [[NSA]] has taken extensive measures to prevent keys from being reused. In the 1960s, encryption systems often included a [[punched card]] reader for loading keys. The mechanism would automatically cut the card in half when it was removed, preventing reuse.&amp;lt;ref&amp;gt;[https://www.nsa.gov/about/_files/cryptologic_heritage/publications/misc/tsec_kw26.pdf Securing Record Communications: The TSEC/KW-26] {{Webarchive|url=https://web.archive.org/web/20121010011445/https://www.nsa.gov/about/_files/cryptologic_heritage/publications/misc/tsec_kw26.pdf |date=2012-10-10 }}, Melville Klein, NSA history series&amp;lt;/ref&amp;gt;{{rp|p. 6}}&lt;br /&gt;
&lt;br /&gt;
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 systems that use the popular stream cipher [[RC4]], including [[Wired Equivalent Privacy]] (WEP), [[Wi-Fi Protected Access]] (WPA), and [[Ciphersaber]]. One of the problems with WEP was that its IV was too short (24 bits). This meant there was a high likelihood that the same IV would be reused if more than a few thousand packets were sent with the same master key (see [[birthday attack]]), subjecting those packets to the key reuse attack. This problem was addressed in WPA by changing the &amp;quot;master&amp;quot; key frequently.&lt;br /&gt;
&lt;br /&gt;
==Bit-flipping attack==&amp;lt;!-- This section is linked from [[Man-in-the-middle attack]] --&amp;gt;&lt;br /&gt;
{{main|Bit-flipping attack}}&lt;br /&gt;
{{see also|Malleability (cryptography)}}&lt;br /&gt;
Suppose an adversary knows the exact content of all or part of a message. As part of a [[man in the middle attack]] or [[replay attack]], they can alter the content without knowing the key, &amp;#039;&amp;#039;K&amp;#039;&amp;#039;. For example, if they know a portion of the message contains the [[ASCII]] string &amp;#039;&amp;#039;&amp;quot;$1000.00&amp;quot;&amp;#039;&amp;#039;, they can change it to &amp;#039;&amp;#039;&amp;quot;$9500.00&amp;quot;&amp;#039;&amp;#039; by XORing that portion of the ciphertext with the string: &amp;#039;&amp;#039;&amp;quot;$1000.00&amp;quot; xor &amp;quot;$9500.00&amp;quot;&amp;#039;&amp;#039;.  &lt;br /&gt;
&lt;br /&gt;
The ciphertext being sent is &amp;#039;&amp;#039;C(K) xor &amp;quot;$1000.00&amp;quot;&amp;#039;&amp;#039;. The adversary creates a new message:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;(C(K) xor &amp;quot;$1000.00&amp;quot;) xor (&amp;quot;$1000.00&amp;quot; xor &amp;quot;$9500.00&amp;quot;) = C(K) xor &amp;quot;$1000.00&amp;quot; xor &amp;quot;$1000.00&amp;quot; xor &amp;quot;$9500.00&amp;quot; = C(K) xor &amp;quot;$9500.00&amp;quot;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Since a string [[Exclusive or|XORed]] with itself produces all zeros, and a string of zeros XORed with another string leaves that string unchanged, the result &amp;#039;&amp;#039;C(K) xor &amp;quot;$9500.00&amp;quot;&amp;#039;&amp;#039; is what the ciphertext would have been if $9500 were the original amount.&lt;br /&gt;
&lt;br /&gt;
Bit-flipping attacks can be prevented by including a [[message authentication code]], which increases the likelihood that tampering will be detected.&lt;br /&gt;
&lt;br /&gt;
==Chosen-IV attack==&lt;br /&gt;
{{Expand section|date=December 2017}}&lt;br /&gt;
&lt;br /&gt;
Stream ciphers combine a secret key with an agreed initialization vector (IV) to produce a pseudo-random sequence that is periodically re-synchronized.&amp;lt;ref&amp;gt;{{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}}&amp;lt;/ref&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
A &amp;quot;chosen IV&amp;quot; attack relies on finding particular IVs which, taken together, may reveal information about the secret key. Typically, multiple pairs of IVs are chosen and differences in the generated key streams are then analyzed 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 exposes a non-random pattern in the generated sequence, the attack can recover some bits and shorten the effective key length. A symptom of such an attack would be frequent re-synchronization. Modern stream ciphers include steps to adequately mix the secret key with the initialization vector, usually by performing many initial rounds.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.isaac.cs.berkeley.edu/isaac/wep-faq.html Security of the WEP algorithm]&lt;br /&gt;
* [https://eprint.iacr.org/2014/677.pdf &amp;quot;Attacks in Stream Ciphers: A Survey&amp;quot;] – a 2014 overview of different stream cipher attacks&lt;br /&gt;
* [http://www.isical.ac.in/~palash/talks/ASK11-talk.pdf &amp;quot;Attacks on Stream Ciphers: A Perspective&amp;quot;] – talk slides from 2011&lt;br /&gt;
&lt;br /&gt;
{{Cryptography navbox|stream}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cryptographic attacks]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Expert700</name></author>
	</entry>
</feed>