In this post, I’ll walk you through solving the ”Verify” challenge, where we explore remote server access, checksum verification, and decryption.
Challenge Overview
In this challenge, we’re given access to a remote server. Our mission? Identify a specific file based on a checksum and decrypt it to find the flag.
Step 1: Connecting to the Remote Server
We start by logging into the server with SSH (Secure Shell), a protocol that allows secure remote access to another computer. Here’s the command we used ( which was given in the challenge) :
ssh -p 59766 ctf-player@rhea.picoctf.net
- The ‘-p 59766’ part specifies the port to connect to.
- ‘ctf-player@rhea.picoctf.net’ is the username and the address of the remote server.
When you’re prompted with a security message about the server’s authenticity, type `yes` and press Enter. Once connected, enter the password provided in the challenge.
Step 2: Checking What’s on the Server
After logging in, we list the files available on the server to understand what we’re working with:
ls
We see three items here: `checksum.txt`, a `decrypt.sh` script, and a `files` directory. Each plays a role in the challenge.
ls files
ls list all the files present in the ‘file’ directory.
Step 3: View the Checksum Value
The `checksum.txt` file contains a hash value (a unique string generated from a file’s content) that we’ll use to identify the correct file. To view it, we use:
cat checksum.txt
We’ll use this checksum to find a matching file in the `files` directory.
Step 4: Calculate the SHA-256 Hash for Each File
Our goal is to match the `checksum.txt` value with one of the files in the `files` directory. We can generate SHA-256 hashes for all files there using:
sha256sum files/*
This command calculates a hash for each file, helping us find the one with a matching checksum.
Step 5: Filtering for the Matching Hash
With several files and hashes in front of us, we’ll use the `grep` command to quickly find the one that matches the checksum from `checksum.txt`:
sha256sum files/* | grep "467a10447deb3d4e17634cacc2a68ba6c2bb62a6637dad9145ea673bf0be5e02"
We see that the file `files/c6c8b911` matches our checksum!
Step 6: Checking the File Type
The next step is to figure out what kind of file we’re dealing with. We use the `file` command to check:
file files/c6c8b911
This tells us the file is encrypted with OpenSSL, which means we’ll need a password to decrypt it.
Step 7: Decrypting the File
The challenge conveniently provides a script called `decrypt.sh`, which is likely designed to help us decrypt this file. We run it with the target file as input:
./decrypt.sh files/c6c8b911
And there it is! The flag for this challenge is `picoCTF{trust_but_verify_c6c8b911}`.