Symmetric Starter

Modes of Operation Starter

Challenge website: https://aes.cryptohack.org/block_cipher_starterarrow-up-right

In this challenge, we are given a simple implementation of AES-ECB, where we can just decrypt the encrypted flag with the given decrypt() function.

from Crypto.Cipher import AES


KEY = ?
FLAG = ?


@chal.route('/block_cipher_starter/decrypt/<ciphertext>/')
def decrypt(ciphertext):
    ciphertext = bytes.fromhex(ciphertext)

    cipher = AES.new(KEY, AES.MODE_ECB)
    try:
        decrypted = cipher.decrypt(ciphertext)
    except ValueError as e:
        return {"error": str(e)}

    return {"plaintext": decrypted.hex()}


@chal.route('/block_cipher_starter/encrypt_flag/')
def encrypt_flag():
    cipher = AES.new(KEY, AES.MODE_ECB)
    encrypted = cipher.encrypt(FLAG.encode())

    return {"ciphertext": encrypted.hex()}

Here is the solution. I used python's requests library to connect to the website directly.

Flag: crypto{bl0ck_c1ph3r5_4r3_f457_!}

Password as Keys

Challenge website: https://aes.cryptohack.org/passwords_as_keysarrow-up-right

Here, the flag was encrypted with a random password from a wordlist.

My approach to solve it is to bruteforce each password to decrypt the flag. We can decrypt the flag using the decrypt endpoint from the website, or we can do it locally. Doing it locally is much faster. Here is the solver script.

Flag: crypto{k3y5__r__n07__p455w0rdz?}

Last updated