CBC bit-flipping
Let's recall the CBC decryption formula again: P_i = D(K, C_i) XOR C_(i-1). Notice — the plaintext of the i-block is XORed with the previous ciphertext block. Therefore, if an attacker changes one bit in C_(i-1), exactly that bit changes in P_i!
This means that CBC does not protect integrity. Even without knowing the key, an attacker can change the plaintext of the next block to any desired value (in return, the previous block becomes unrecognizable — this is a certain "price" of the attack).
The site gives the user the following cookie (hex):
fc02a05adddf198cef202f9327abc4078ca3e911b64243c2744574ceb4c77925
9c480af9cb5928f027c6195bae9ebbef
Cookie structure:
cookie = IV (16 bayt) || C1 (16 bayt) || C2 (16 bayt)
P1 = "foydalanuvchi=me"
P2 = "hmon&admin=false"
Your task: modify C1 so that the second block becomes the following upon decryption:
P2' = "hmon&admin=true;"
Write the 16 bytes of the new C1 in lowercase hex format and assemble the flag:
BAYROQ{A3S_bitflip_<C1 ning yangi hex qiymati>}
The key is not given to you and is not needed — this is the most beautiful part of the attack. Just XOR.