Skip to main content

AES 256 ECB

Example from Vulnhub

https://www.vulnhub.com/entry/prime-1,358/

In this challenge, a script outputs an AES-256 encrypted file and a hint in key.txt

The hint says to hash the word "ippsec" with the MD5 algorithm This is the key to decrypt the hash



Hash

Base 64 encoded output of a hashed value

nzE+iKr82Kh8BOQg0k/LViTZJup+9DReAsXd/PCtFZP5FHM7WtJ9Nz1NmqMi9G0i7rGIvhK2jRcGnFyWDT9MLoJvY1gZKI2xsUuS3nJ/n3T1Pe//4kKId+B3wfDW/TgqX6Hg/kUj8JO08wGe9JxtOEJ6XJA3cO/cSna9v3YVf/ssHTbXkb+bFgY7WLdHJyvF6lD/wfpY2ZnA1787ajtm+/aWWVMxDOwKuqIT1ZZ0Nw4=


Cracking the Hash with the Key

openssl enc -a -d -in enc.txt \
-K '33363661373463623363393539646531376436316462333035393163333964310a' \
-aes-256-ecb 2>/dev/null
  • -a input is base64
  • -d decoding
  • -in input file
  • -K key to decrypt (must be in hex notation)
    • The initial key -- MD5 hash of "ippsec" -- is not valid hex
    • echo <md5hash> | xxd -p to output the string in hex bytes
  • -aes-256-ecb cipher