Knowledge Base · general

OpenSSL enc cheatsheet

generaltechnique notetechniqueopenssl-enc

openssl enc quick reference for CTF crypto (symmetric decrypt with salted passwords).

How it works

  • openssl enc -d -aes-256-cbc -pbkdf2 -iter 100000 -md sha256 -pass pass:PW -in in.enc -out out.
  • Files with a Salted__ header are openssl enc output (8-byte salt follows the magic).
  • Older output uses EVP_BytesToKey; if -pbkdf2 fails, drop it.
  • Always specify the cipher — openssl enc -d with no cipher copies bytes through unchanged (silent no-op).
  • Verify success with a magic-byte check (1f 8b for gzip).

Detection & defence

  • Brute-force cipher/digest/iteration combinations and test with file magic, not by eye.
  • Confirm output with file/cmp, not just ‘no error’.