# How can you change the plaintext of the given secret message which is in AES-256 CBC

Say you have the secret message encrypted with AES-256 in CBC mode

``````5a04ec902686fb05a6b7a338b6e07760 14c4e6965fc2ed2cd358754494aceffa
``````

where the first 16 Byte is the initial vector, the second 16 Byte is the ciphertext. The plaintext of the secret message above is (ASCII encoded) `We're blown. Run`

Now my question, how can you change the secret message such that you get the plaintext `Meeting tonight!` if you decrypt it?

I have tried to find some examples on the internet but I couldn't find any : /

However I could find a model that describes how CBC decryption works:

Our plaintext `We're blown. Run` is made up of 16 chracters which means we just have one plaintext block. From the model, we also see that the ciphertext is decrypted and XOR'd such that it creates the ciphertext. As it looks like, there are changes required in the initial vector so we get the desired message `Meeting tonight!`. But how is this done exactly?

• Do you understand what the diagram is showing? If you do, I am pretty confident you should be able to work the answer out on your own with only a little bit of consideration. I'm guessing the point of this exercise is for you go through the deductive process of coming to an understanding on your own, not to simply Google for the right answer. May 31, 2018 at 23:10
• As a hint, you don't need to consider anything in that diagram besides the first block (since you don't have multiple blocks). And you know literally all of the components of that diagram (sans the key, which is irrelevant): the ciphertext, the IV, the plaintext, and the raw output of the decryption function (which can be calculated from the IV and plaintext). May 31, 2018 at 23:13
• As a further hint, what known value would the resulting plaintext be equal to if you set the IV to all zeroes? And what is the result of flipping a single bit of the IV? May 31, 2018 at 23:14
• @StephenTouset Ok so from the diagram we see that the initial vector only used for one XOR and this is done with the plaintext so it has only impact on this block. But if we look at encrypting diagram, we see that it changes the block of ciphertext... About zero initial vector, we need that because the first block doesn't have previous block and we set it zero so the mode can start at all. I understood this correct so far? By the way this is no homework I just try to find an example to understand the diagrams : / May 31, 2018 at 23:22
• Crossposted on crypto which IMO is the (slightly) better place fro it Jun 1, 2018 at 4:04

• Do the encryption yourself! The `openssl` command line utility allows you to specify the key and IV directly as hex values. Any hex editor will allow you to view the ciphertext before and after. As far as I can tell, your method is correct, but it's always more enlightening to see the results with your own eyes. Jun 1, 2018 at 13:19