Challenge 39

Welcome to challenge Challenge 39. You need to guess the secret that is hidden in Java, Docker, Kubernetes, Vault, AWS or GCP.

Insecure Encryption Key - Part 1

A developer encrypted a secret using AES and stored its base64 encoded value in a file. But where to leave the key? What about just using the filename as the encryption key instead? That way, every secret can have its own key easily! Can you find the secret?

The challenge file is called secrchallenge.md and can be found in the executables folder.

Answer to solution :

This challenge can be solved by decrypting the base64 encoded secret in secrchallenge.md. You can do this either by:

  1. Using an online aes decryption tool like https://www.devglan.com/online-tools/aes-encryption-decryption

    • Copy the contents of the secrchallenge.md file and paste it into the textbox of the decryptor.

    • Ensure the input format is Base64 and the cipher mode is ECB.

    • Use secrchallenge.md as decryption key and click on Decrypt to get the secret.

  2. Using the terminal

    • Launch the terminal while you are in the executables directory.

    • Type in echo -n "secrchallenge.md" | xxd -p to convert the plaintext key to a hexadecimal key.

    • Then, use the obtained decryption key to decrypt the file by typing openssl enc -a -d -aes-128-ecb -in secrchallenge.md -K 736563726368616c6c656e67652e6d64 -out decrypted.md

    • Copy the secret from the decrypted.md file in the executables folder.

Why should we not use the filename as the encryption key?

There have been multiple scenarios where the contents of files were encrypted using the filename itself, which allows attackers to easily decrypt its contents easily. It is often perceived as an easy way to keep the key close to the content, without reusing the same encryption key everywhere.

But as you can tell by now, this is not a good idea. An attacker has the key the moment the file is in his possession.