0
$\begingroup$

I have some files that are encrypted using an unknown key and it's using the CBC method to encrypt the files.

When I XOR two files together the first two bytes are always the same, but different for each files (make sense for each file)

From that is it possible to recover the real key? First bytes of the file :

1a 1a 14 54 08 0b 02 59 

When xoring it to a another file using the same key the first few bytes are :

3a e5 1f 01 3a e5 1f 01  

Another beginning of xoring with different file

bf fb 22 10 bf fb 22 10  

As you can see the pattern repeats for those only 8 bytes. It does that for every file that I xor. Does that mean the key length is 4? And from that how can I recover the text ?

$\endgroup$

closed as off-topic by otus, e-sushi Apr 8 '16 at 19:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Requests for analyzing or deciphering a block of data are off-topic here, as the results are rarely useful to anyone else." – e-sushi
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You say "XOR cipher" and use stream-cipher, but also say CBC. Which cipher is really used? AES-CBC? I don't see a pattern, but a pattern in the beginning would likely have to do with IV generation. $\endgroup$ – otus Apr 8 '16 at 7:25
  • $\begingroup$ The file was encrypted using only XOR nothing else with CBC technique where you used previous block to encrypt the next block. $\endgroup$ – Maxime Roussin-Bélanger Apr 8 '16 at 7:32
  • $\begingroup$ What does "using only XOR" mean? Do you mean $c_i = p_i \oplus c_{i-1} \oplus k$ with a constant key $k$? $\endgroup$ – otus Apr 8 '16 at 7:52
  • $\begingroup$ More like $c_1 = p_1 \oplus k$ and then $c_i =p_i \oplus c_{i-1}$ $\endgroup$ – Maxime Roussin-Bélanger Apr 8 '16 at 11:42
1
$\begingroup$

The "XOR cipher" described does not encrypt more than the first block, even if you do not reuse keys. The subsequent blocks can be "decrypted" by the attacker simply by undoing the XOR – there is no secret involved.

Decrypting the first block and finding the key does require more than one message. It is a case of the many-time pad and can be solved either using a known plaintext or by crib-dragging as described in the link above.

$\endgroup$
  • $\begingroup$ So If I use a key once to start and xor the first 4 bytes. If I xor those 4 bytes with the key to create a new key and encrypt the next four bytes. It's still the same? $\endgroup$ – Maxime Roussin-Bélanger Apr 8 '16 at 21:23
  • $\begingroup$ @MaximeRoussin-Bélanger, not exactly the same. In that case the attacker can still XOR away the previous block, but is left with a normal many-time pad, requiring crib-dragging or the like to break. $\endgroup$ – otus Apr 9 '16 at 5:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.