Writeup · SAF Pre-Qualifiers 2026

Fancy Details

forensicseasy-mediumsolvedFlag: safctf{REDACTED}

Overview

The challenge provides photo.jpg, archive.tar.gz.enc, and a web service (not used for the solve). The hinting text points at a detail that “doesn’t quite belong” — an odd metadata field — and at recovering what was left behind by decrypting and extracting an archive. The goal is to derive the password from the image metadata, decrypt the archive, and extract the flag.

Files provided:

File Size Notes
photo.jpg 220,069 bytes 1024x1024 progressive JPEG (JFIF 1.01)
archive.tar.gz.enc 192 bytes openssl enc output (Salted__ header)

photo.jpg shows a stylised glowing folder icon with floating digits (0921, 0121, 0321, …) — decoration, not data.

Prerequisites / Setup

  • exiftool, binwalk, steghide, openssl, tar
  • Python 3 with cryptography and hashlib (for the parameter brute-force)

Recon

Step 1 — Inspect image metadata

Goal: Look for an odd metadata field that could hold a password or hint.

exiftool photo.jpg

Relevant output:

Artist       : qebjffnc
GPS Latitude : 52 deg 28' 48.00"
GPS Longitude: 1 deg 53' 24.00"

Two fields are unusual for a stadium photo:

  • Artist: qebjffnc is not a name — it is ciphertext-looking.
  • The GPS coordinates (~52.48° N, 1.89° W, central Birmingham, UK) are a plausible decoy.

Step 2 — Identify the encrypted file format

Goal: Confirm archive.tar.gz.enc is OpenSSL-encrypted data and learn its layout.

file archive.tar.gz.enc
archive.tar.gz.enc: openssl enc'd data with salted password

Header layout:

Salted__ (8 bytes) | salt (8 bytes) | ciphertext (176 bytes = 11 AES blocks)

The password is not stated anywhere, and the cipher/KDF settings are unknown.

Step 3 — Check the image for hidden embedded data

Goal: Rule out steganography before focusing on metadata.

binwalk photo.jpg
JPEG + TIFF (EXIF) only, nothing embedded

Further checks found nothing: no bytes after the JPEG end-of-image marker (FF D9), steghide extract with several candidate passphrases found no payload, and strings surfaced only qebjffnc as readable text. The image content, GPS point, and digits were noise; the Artist string is the real clue.

Exploitation

Step 4 — Decode the Artist string

Goal: Derive the password from qebjffnc.

Brute-forcing every Caesar shift:

s = "qebjffnc"
for k in range(26):
    print(k, "".join(chr((ord(c)-97+k) % 26 + 97) for c in s))

Shift 13 (ROT13) gives drowssap, which reversed is password.

So the transformation is ROT13, then reverse, and the password is password.

Step 5 — Decrypt the archive

Goal: Find the OpenSSL parameters that produce valid plaintext.

The working combination:

Parameter Value
Cipher AES-256-CBC
KDF PBKDF2
Digest SHA-256
Iterations 100,000
Password password
openssl enc -d -aes-256-cbc -pbkdf2 -iter 100000 -md sha256 \
  -pass pass:password \
  -in archive.tar.gz.enc -out archive.tar.gz

file archive.tar.gz
# gzip compressed data

The cipher/KDF settings were recovered by brute force, testing iteration counts (1000, 10000, 100000, 600000) and digests (sha1, sha256, sha512) and checking for the gzip magic. Result: sha256, 100,000 iterations.

Step 6 — Extract the nested archive

Goal: Unpack archive.tar.gz → nested1.tar → flag.txt.

tar xzf archive.tar.gz     # -> nested1.tar
tar xf nested1.tar         # -> flag.txt
cat flag.txt
safctf{REDACTED}

Flag

safctf{REDACTED}

Recovered from flag.txt inside nested1.tar inside archive.tar.gz, decrypted with the metadata-derived password.

Dead Ends

Attempt Result
steghide extract with password, drowssap, qebjffnc, empty No payload
binwalk / binwalk -e on photo.jpg Nothing embedded
Appended data after JPEG EOI None
GPS coordinates (Birmingham) as password Not needed
Digits in the image (0921, 0121, 0321) Decoration, no use
openssl enc -d without a cipher flag Silent no-op — output identical to input
Default -pbkdf2 (10,000 iterations) bad decrypt

Lessons / Takeaways

  • Metadata first. An odd EXIF field (Artist) held the key — run exiftool before heavier stego tooling.
  • Simple ciphers still appear. Caesar-shift brute force is instant; try ROT13 and reversal, including combinations.
  • Right password, wrong parameters looks like a wrong password. With OpenSSL, the iteration count and digest matter; brute-force them and detect success with a file magic check.
  • Verify “silent success”. A command with no error is not proof it worked.
  • Not every clue matters. The image content, GPS point, and digits were noise.

Mitigations

  • Do not embed passwords or keys in image metadata (EXIF).
  • Use authenticated encryption (e.g. AES-GCM or age) rather than unauthenticated CBC, so tampering is detected.
  • Use a strong, unique password and a modern KDF (argon2id / PBKDF2 with high iteration count).

Techniques

References