IV: 69bb375aa919c72aa561dd7b7ffacf66
Ciphertext: "c28ea025d10186510855d083747d6435c808d9857075abd9bfc54b094e60eaf3"
Plaintext: "SEND ENCRYPTED DATA"
I want to be able to change the resulting Plaintext to "SEND THE DATA", which if I understand correctly would involve altering the IV in this case.
I have read about the bit flipping and how this attack works, I am just having troubles implemeting it in this scenario, please help.
below the encryption (at the server side- we were given the code), includes the padding used,
def encrypt(plaintext):
log.info("[%d] encrypt data command invoked" % (client_id))
iv = Random.new().read(AES.block_size)
# add padding
if (len(plaintext) % 16 != 0):
plaintext += b"_" * (16 - len(plaintext) % 16)
cipher = AES.new(shared_key, AES.MODE_CBC, iv)
ciphertext = cipher.encrypt(plaintext)
return hexlify(iv) + b"," + hexlify(ciphertext) + b"\n"
def no_tranform(plaintext):
log.info("[%d] send data command invoked" % (client_id))
return hexlify(plaintext) + b"\n"
commands = {"SEND ENCRYPTED DATA": encrypt,
"SEND THE DATA": no_tranform}
Also you can see that the only allowed commands are "SEND ENCRYPTED DATA" and "SEND THE DATA" and I would like the latter.