How to break AES/CBC/PKCS5 when key and IV are reused? I'm doing a code review for a crypto solution that reuses the same key with a constant IV.  I want to demonstrate that this is not the right way to do things by figuring out the key and decrypting all of their test data.


I have access to lots of ciphertext.
I know the same key is used.
I know the same IV is used.
Cipher is AES/CBC/PKCS5
Plaintext is 16 bytes.
Ciphertext is 32 bytes (PKCS5 padding?)
I can put whatever plaintext I want through the system and then get that ciphertext.


What's the high-level pseudo code or process to break this system?
Well, there is no really good way; the encryption of the plaintext is $E_k( Plaintext \oplus IV)$ (followed by 16 bytes which are a deterministic function of the first ciphertext block). The AES function $E_k$ is designed to be totally unpredictable if you don't know the key, there's nothing to leverage there. The only thing that allows you to gain any advantage is that the encryption function itself is deterministic; that is, about the best you have available is:


Make a guess as to what the plaintext might be
Ask that be encrypted
Check to see if that ciphertext happens to match anything on your list
Rinse and repeat


Not by any means an ideal solution; however it's the best option you have available.

Now, if the plaintext had been longer than 16 bytes, you could use the above procedure to confirm a guess on the first 16 bytes of the plaintext, and then work on the next 16 bytes -- with your specified parameters, that's not an option.