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 |
Step 4: Decrypt
1 | openssl enc -d -aes-256-cbc -in encrypted_flag.enc -pass pass:"Vamos!" -out flag |