I'm going through the Matasano crypto challenges (also known as cryptopals) and I recently got stuck in the following challenge: http://cryptopals.com/sets/2/challenges/11
The goal of the challenge is detecting the block cipher mode in AES encryption: ECB or CBC.
I saw the following post that discusses this matter, but it doesn't truly solves the problem: https://stackoverflow.com/questions/17382438/how-to-detect-block-cipher-mode
The only flaw that I know of that can help detecting the mode of operation is that ECB is stateless, i.e. similar plaintext blocks convert to similar ciphertext blocks. But in the challenge it is specified that we need to add a random number of bytes (between 5 and 10) before and after the plaintext, which causes similar blocks to slide a bit so the ciphertext result doesn't necessarily contain similar blocks. Does anyone have any hint or solution to this problem?