How to Solve a CTF Challenge Hidden in Image Metadata

NIkhil Kumar
3 min readJan 27, 2025

In this Capture the Flag (CTF) challenge, we have an image file that hides a flag within its metadata. Metadata often contains additional information about a file, like author, creation date, or camera details in images. In this case, it contains something more exciting — our flag! This blog post will walk you through how to solve this challenge step by step.

Step 1: Download the Image

The first thing you need to do is download the image file, which in this case is named JNUMap.jpg. It may look like any regular image, but we are about to discover something hidden within it.

Step 2: Analyze the Image’s Metadata

Images, especially JPEGs, store metadata that can include details about the image itself, such as resolution, color profile, and even the software used to edit it. In this challenge, the flag is hidden within this metadata.

To analyze the metadata of the image, we’ll use a tool called ExifTool. ExifTool is a powerful utility for reading, writing, and editing metadata in image files. You can install ExifTool on Linux, macOS, or Windows, and use it in the terminal or command prompt.

Here’s how to run ExifTool on the image:

exiftool JNUMap.jpg

When you run this command, ExifTool will display all the metadata associated with the image. Among the various pieces of information, you’ll find a Comment field that contains a strange-looking string:

Step 3: Decode the Base64 String

The string in the Comment field is base64 encoded, which means it’s a form of encoding often used to store binary data in text format. In this case, the base64 string holds the flag!

To decode the base64 string, you can use a tool like CyberChef or any base64 decoder. CyberChef is a great web-based tool that allows you to decode base64 easily. You can visit it at CyberChef.

Once you decode the string, you’ll find the flag hidden inside:

THM{sfjkcbskjbvjbhvvjfbhblvlxlzv****}

Step 4: Submit the Flag

Congratulations! You have successfully extracted the hidden flag from the image’s metadata. Now you can submit the flag to complete the challenge!

Why Hide Flags in Metadata?

Hiding flags in metadata is a common technique in CTF challenges. It tests the participant’s ability to understand the structure of file formats and use tools to extract information. It’s also a great way to introduce beginners to the concept of data hiding, which can later lead to more complex challenges like steganography.

Conclusion

By analyzing the metadata of an image using ExifTool and decoding a base64 string, you were able to uncover the flag hidden in plain sight. This simple but fun challenge is a great introduction to working with file metadata in CTFs, and it demonstrates how hidden information can be concealed within seemingly ordinary files.

Stay tuned for more challenges, and keep sharpening your CTF skills!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

NIkhil Kumar
NIkhil Kumar

Written by NIkhil Kumar

Cybersecurity enthusiast with skills in penetration testing, vulnerability assessment, and Python. Passionate about strengthening security protocols

No responses yet

Write a response