For an attacker to be able to actually successfully break the security of the bank, we need to make a few assumptions, which I'll state here:
- A stream cipher without proper authentication is used.
- The attacker knows the data format the bank uses.
- The attacker knows the recipient and amount of a transaction (i.e. the interesting values), which he may change.
First we need to consider how a stream cipher works. Most stream ciphers work by taking a key and an initialization vector and expanding this to a long keystream. The keystream $K$ is used to encrypt a message $M$ to the ciphertext $C$ as follows: $C=K\oplus M$ where $\oplus$ denotes bitwise XOR.
Now assume that the message being actually sent by the bank is $M$ containing a valid recipient and a valid transaction amount. Now further assume the attacker wants to replace this by $M'$ where he increases the amount and makes himself the recipient. One nice thing about bitwise XOR is that $a\oplus a = 0$ holds. Now the attacker can calculate the difference $\Delta=M\oplus M'$. He now replaces $C$ by $C'=C\oplus \Delta$. Now observe that $$C'=C\oplus\Delta=(K\oplus M)\oplus (M\oplus M')=K\oplus M'$$ which will decrypt to $M'$ by XOR'ing $K$ in again.
As requested by Maarten in the comments:
The (actual) Example
Assume that 0001001001100101100000001011010010
is the (legitimate) recipient ID.
Assume that 0000010111011100
is the legitimate transaction amount in USD.
Assume that 1001001100100100011110000010001010
is the attacker's ID.
Assume that 1100001101010000
is the attacker's preferred enrichment.
Assume that the message encoding consists of simple concatenation of the recipient ID and amount.
Assume that 01011000011010011001110010010110101100010100011100
is the keystream.
The message $M$ is then 00010010011001011000000010110100100000010111011100
and the (legitimate) ciphertext $C$ is 01001010000011000001110000100010001100000011000000
.
The malicious message $M'$ would be
10010011001001000111100000100010101100001101010000
and therefore the
difference $\Delta$ would be
10000001010000011111100010010110001100011010001100
Thereby $C'$ is
11001011010011011110010010110100000000011001001100
which will be decoded to 10010011001001000111100000100010101100001101010000
which is $M'$ and thereby the attacker will receive 50k USD.