Skip to content
Zone for Exploration and
Understanding of Security
← All writeups

Hidden Message in a JPEG

CyLab Security Academy · Image forensics · Easy (portfolio rating)

Recover a message hidden in a JPEG by following a clue in its comment field.

1. Read the JPEG comment

Use the original img.jpg. The JPEG comment contains printable text encoded in Base64.

shell
file img.jpg

Output

comment: "c3RlZ2hpZGU6Y0VGNmVuZHZjbVE9" (excerpt)

2. Decode both fields

The first decode names the extraction tool. Only the text after the colon needs a second decode.

shell
clue=$(printf %s c3RlZ2hpZGU6Y0VGNmVuZHZjbVE9 | base64 -d)
printf '%s\n' "$clue"
pass=$(printf %s "${clue#*:}" | base64 -d)

Output

steghide:cEF6endvcmQ=

3. Extract the message

Pass the decoded password to steghide. It writes the embedded message to standard output.

shell
steghide extract -sf img.jpg -p "$pass" -xf -

Output

[REDACTED]

Extraction succeeded. The recovered flag is withheld.

Practice next

Explore more security challenges on CyLab Security Academy.

Explore CyLab Security Academy ↗