247CTF - The Encrypted Flag
Decrypt an OpenSSL-encrypted file. The file was encrypted with
openssl enc using a password.
Vulnerability
OpenSSL's enc command uses EVP_BytesToKey for password
derivation, which is relatively weak compared to modern key derivation
functions. Common passwords can be cracked with a good wordlist.
Solution
Step 1: Identify the encryption
1 | file encrypted_flag.enc |
Step 2: Convert to crackable format
1 | openssl2john encrypted_flag.enc > hash |
Step 3: Crack the password
1 | john hash --wordlist=rockyou.txt |
The retained john --show line contains the complete
password *7¡Vamos!; neither its prefix nor the non-ASCII
punctuation may be dropped. UTF-8 bytes must be preserved. The salted
header alone does not identify cipher, digest or whether PBKDF2 was
used. AES-256-CBC is the recorded candidate below; the attachment and
matching KDF settings are unavailable, so decryption has not been
reproduced.
Step 4: Decrypt
1 | printf '%s' '*7¡Vamos!' > password.txt |