Hi I'm trying to understand the logic behind a CTF challenge basically we are given a program which encrypt some data, we have the following options:

  1. Select encryption mode (EBC, CBC, CTR, OFB, CFB)
  2. Encrypt the flag and see the resulting ciphertext
  3. Encrypt a choosen plaintext and see the resulting ciphertext

Now I think the weakest alg here is ECB, but bruteforce block of 128 bits seems not feasible at all to me.

Each time a plaintext is encrypted a new random IV is used (when needed so for CBC, CBF and OFB).

Which could be a good strategy to attach such program? My objective is finding the plaintext for the flag.

  • $\begingroup$ Temporarily leaving my moderator hat aside (CTFs tend to be off-topic; and in any case you should only expect a hint), some generic ideas applicable to some AES encryption CTFs: Guess the flag, and check the guess. Find a way to make the RNG used to generate the IV fail to perform it's duty. Guess a poorly generated key, and check the guess. Extract the key from an implementation side channel. If some ciphertext can be obtained before the full plaintext is given, exploit that. $\endgroup$
    – fgrieu
    Oct 25, 2022 at 18:28
  • $\begingroup$ Oh I was unaware that CTF are off-topic, anyway I don't think those methods are actually possible I can interact with the program only in those 3 ways, also the IV is generated using urandom. I also forgot to say that I know first 4 bytes of the flag and that I can interact more than once with this program. $\endgroup$ Oct 25, 2022 at 18:39
  • $\begingroup$ I'll give only a single more hint: the weakest alg here is not ECB. Note: CTFs are not fully off-topic (see these meta), especially above a certain threshold of difficulty. However, giving a straight answer to an ongoing CTF, or to this (not so difficult) one would be poor taste. Perhaps I have already said too much. $\endgroup$
    – fgrieu
    Oct 25, 2022 at 18:41
  • 1
    $\begingroup$ What is the goal here? What is it that, if you recover it, you've met the CTF challenge? $\endgroup$
    – poncho
    Oct 25, 2022 at 18:53
  • $\begingroup$ Thanks @fgrieu :) let me try google a bit for other attack vectors on different modes $\endgroup$ Oct 25, 2022 at 18:56


Browse other questions tagged or ask your own question.