Skip to main content
4 of 4
added 5 characters in body
kelalaka
  • 49.5k
  • 12
  • 118
  • 205

You have and oracle call of

$$O(\texttt{your-string}) = (\operatorname{AES-128-ECB}(\texttt{your-string} || \texttt{unknown-string})$$

Since you know that the AES has 16-byte block cipher and it uses CBC, request;

$$C = O(\texttt{AAAAAAAAAAAAAAAx})$$ from oracle, where $\texttt{x}$ is the first byte of the random key.

Now ask to oracle these encryptions $$C = O(\texttt{AAAAAAAAAAAAAAA[a..zA..Z]})$$ and see which character is equal to $\texttt{x}$, sat $1$

Now once we determine the $\texttt{x}$, we can move to the next one. Request from Oracle;

$$C = O(\texttt{AAAAAAAAAAAAAAxy})$$

Now ask to oracle these encryptions $$C = O(\texttt{AAAAAAAAAAAAAAx[a..zA..Z]})$$ and see which character is equal to the second byte $\texttt{y}$ of the string, say $2$

With this method, we can get 16 bytes of the secret. What about if there are more. Request

$$C = O(\texttt{AAAAAAAAAAAAAAA1})$$

then request this will provide the next block's encryption as the input

$$\texttt{234567890abcdef}$$, where you know $\texttt{234567890abcde}$ but not $\texttt{f}$, but you got the encryption of this block. Now ask the oracle

$$C = O(\texttt{234567890abcde[a..zA..Z]})$$

to determine the 17th byte $\texttt{f}$, the rest is similar.

kelalaka
  • 49.5k
  • 12
  • 118
  • 205