Say I have the text
user:123 encrypted with
AES/ECB/PKCS5Padding, resulting in the ciphertext
vnjlWxfkYuTK3juNY38NKQ==. How difficult is it to modify the ciphertext in order to get another meaningful 3-digit numerical value? Is it similar in difficulty to brute-forcing the encryption key?
If I just modify one byte of the ciphertext I get garbled data in the entire block, so I need quite an elaborate change to the ciphertext in order to affect just the value part in a meaningful way. Just how elaborate would this change be?
Background: I come fairly often across cases in which encryption is used as a means to "secretly" transmit data between applications, most of the times using some mode of AES encryption. In most of these cases it is however more critical that the data does not get modified in transit or by the user, as opposed to not being readable.
Example: User X is logged into application A, and goes via a link, with parameters containing the user identity, to application B. The link parameters are AES/ECB encrypted, using a key that is known to both applications. HTTPS is used by both applications, so the threat of the parameters being read by a third party is covered. More important is that the user cannot change their identity and impersonate another user.
I would like to point out this common misconception to the developers and architects of applications A and B, that encryption means that data can't be changed, by showing an attack scenario where the ciphertext is changed, so that upon decryption, valid data is received. This way they can understand better that in such cases an authenticated encryption algorithm is a must.