Unlocking CTF Challenges: A Step-By-Step Forensics Guide

NIkhil Kumar
2 min readJan 28, 2025

--

Introduction
Capture The Flag (CTF) challenges are not only fun but an incredible way to sharpen your cybersecurity skills. Recently, I tackled a fascinating forensics CTF challenge on PicoCTF, and I’m here to share what I learned, step-by-step solutions, and some tips to boost your skills in the forensics domain.

Whether you’re a beginner or a seasoned player, this challenge involved working with encrypted files and demonstrated key principles like hash validation and decryption techniques.

The Challenge Setup

The challenge presented us with three files:

  • checksum.txt: Containing a hash value to verify.
  • decrypt.sh: A script to decrypt files.
  • A folder named files with multiple potential targets.

The goal? Find the correct file that matches the hash, decrypt it using the script, and retrieve the flag!

Step 1: Analyzing the Files

To begin, I listed all files using ls to understand the folder's contents:

ls
  • checksum.txt: Contained a SHA-256 hash.
  • decrypt.sh: A bash script leveraging openssl for AES-256 decryption.

A quick look at decrypt.sh revealed how it works:

  1. It takes a filename as input.
  2. Uses openssl to decrypt the file with a predefined key (picoCTF).
  3. Outputs the flag or an error if decryption fails.

Step 2: Matching the Hash

Using sha256sum, I computed hashes for all files in the files directory and matched them against the hash in checksum.txt:

sha256sum files/* | grep <hash_from_checksum.txt>

This command quickly identified the target file as 451fd6**.

Step 3: Decrypting the File

Once I had the file, it was time to decrypt it using decrypt.sh:

./decrypt.sh files/451fd6**

After running the script, the flag was revealed:
picoCTF{trust_but_verify_451f****} 🎉

What I Learned

This challenge reinforced several key cybersecurity skills:

  • Hashing & Verification: SHA-256 is a reliable method to ensure data integrity.
  • Scripting Basics: Understanding how bash scripts work can simplify repetitive tasks.
  • File Decryption: Tools like OpenSSL are vital for encryption and decryption in the real world.
  • Attention to Detail: Each CTF challenge often hides subtle hints in filenames, scripts, or logs.

Tips for Forensics CTF Challenges

  1. Always read the scripts and files provided to understand their purpose.
  2. Use tools like sha256sum, grep, and cat to analyze content efficiently.
  3. Familiarize yourself with encryption techniques like AES-256.
  4. Leverage online resources and forums for guidance if you get stuck.

Next Steps

If you found this challenge walkthrough helpful, be sure to explore more CTF challenges, especially in the forensics domain. They’re an excellent way to practice and expand your skillset.

Check out my YouTube channel for a detailed video walkthrough of this challenge and subscribe for more CTF content!

--

--

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