5
$\begingroup$

How can I alter the plaintext before decryption by changing the IV?

I know what the value of the plaintext should be. I also know the value of the IV (initial vector). The IV and the AES block are both 16 bytes long.

What I am trying to do is change what the plaintext will be into something meaningful. "SEND ME THE DATA ENCRYPTED" is the plaintext and "8f6f27b5dbfa2ba8367262bda7154d95" is IV.

I want to change the word "ENCRYPTED". I can change everything before using by changing the IV it but I cannot change it.

This the message encrypted:

IV: 8f6f27b5dbfa2ba8367262bda7154d95
CT: 798e0ff8b06cc27c1591a4088531a64a9b76a9be87a3e944c6e7000f24f5b9f9
$\endgroup$
6
$\begingroup$

So if you consider ASCII encoding you have two plain text blocks: "SEND ME THE DATA" and " ENCRYPTED" + padding (which we will ignore). Note the space before "ENCRYPTED".

Now if you change the IV you will indeed only change the first block. What you should however do is to change the first block of the ciphertext. That is used as vector (not the initialization vector, but the next vector) for the CBC decryption of the next block.

enter image description here

As you can see, each bit or byte that you change will be directly reflected in the plaintext. So if you want to flip a single bit in the plaintext you simply flip the bit at the same position in the previous ciphertext block.

So in the end you may want to end up with something like:

IV: 8f6f27b5dbfa2ba8367262bda7154d95
CT: 798f04f8b06cc27c1591a4088531a64a9b76a9be87a3e944c6e7000f24f5b9f9
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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