0
$\begingroup$

This question already has an answer here:

I am building on this answer. Essentially I have an initialisation vector $iv$, a ciphetext $c$ and a plaintext $p$. The plaintext was encrypted using AES CBC. The aim is to modify the first 4 characters of the plaintext so that it becomes $p_{target}$.

Ex:

$p$ = 'SEND_DOGGOS_LOVE'

$c$ = 0x63fd039cc488dd7d937677b322a7763c

$iv$ = 0xa9e459b1a2e68cd7db06cf24b7e0bde8

$p_{target}$ = 'CATS_DOGGOS_LOVE'

My understanding was that to achieve that, I can change the $iv$ by simply xoring the first 4 chars of $iv$ with the result of $xor($'CATS','SEND'$)$. This however doesn't seem to work as I get a nonsensical plaintext. What am I missing?

$\endgroup$

marked as duplicate by kelalaka, AleksanderRas, Maarten Bodewes Jul 15 at 9:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ You are talking about bit-flipping attack. See also this Bit Flipping Attack on CBC Mode. Also, your error might be on your code, which is not a related question here $\endgroup$ – kelalaka Jul 12 at 8:43
  • $\begingroup$ OK thanks, meaning my understanding of the attack is correct, based on the answer in the link? $\endgroup$ – S. L. Jul 12 at 8:53
  • $\begingroup$ Yes, we can also see from this; normally $C_1 \oplus IV = P_1$ if you modify the $ IV_{new} = IV \oplus P_x \oplus P_1$ then you can see that $C_1 \oplus IV \oplus P_x \oplus P_1 = P_x$ . $\endgroup$ – kelalaka Jul 12 at 9:09
  • $\begingroup$ OK yes, makes sense. I rewrote it from scratch and I found the issue, it was indeed code-related. Thank you! $\endgroup$ – S. L. Jul 12 at 11:10
  • $\begingroup$ Also, Possible duplicate of Alter plaintext in block cipher AES in CBC mode $\endgroup$ – kelalaka Jul 12 at 19:02

Browse other questions tagged or ask your own question.