PicoCTF — Wave a Flag!
Hello, everyone! I hope you are doing well and having an amazing time! It’s me again and this is going to be the second CTF room that I am going to be solving. This is PicoCTF, as you can tell by reading the title. Without further ado, let’s get into it!
First, what we need to do is visit the site by copying this URL into our browser. Login to it, and if you do not have an account create one which I demonstrated in my previous write on how to do it. https://zuber-kariye.medium.com/my-first-ctf-picoctf-obedient-cat-a92a544f83f
After you have created this account, you are going to visit this link which will take you to the specific room that we will be working on. This challenge is in a general category, which is based on binary, and the room is called “Wave a Flag!”
Here they asked us a question saying “Can you invoke help flags for a tool or binary? This program has extraordinarily helpful information…”. Let's download this file and save it in our directory.
Before we do anything, let’s first download the file by clicking that blue link.
We can see our file has been downloaded in the Download directory.
Now, let’s move that file into our current directory so we can work with it. Also, let’s verify if the file has been moved into our directory using the $ ls -l command in the terminal.
If you look at the right side, there are number buttons “Hints” which help us further by looking at them. Let’s click on each one of them just to see how they can help us further. As you can see from the first “hint” it says this program will only work on a Linux machine which I already have because I am using a Ubuntu desktop for this room.
The second “hint” basically tells us that we can also use the wget command in the terminal to download the file like so… wget https://mercury.picoctf.net/static/beec4f433e5ee5bfcd71bba8d5863faf/warm
I have already downloaded the file using the link that they provided me.
The third “hint” suggests that we should run this as $ ./warm but we need to give it execution permission on the file since it’s a binary file that we can run in the terminal.
Before we do that let's give it a look at the file and explore it a little bit. I will be using two different commands/utilities that will help us further, such as the file and strings command.
The file command returns just a little bit of information regarding the type of file and its architecture. This is an executable file as you can see it. Let’s use the strings command to further explore it.
Before I even go further, we can see some functions after using strings command in the terminal to find out more, such as, “printf” function in the screen, which means the program is going to display something if we give it executable permission when we run the file.
Let’s go down a little bit to see more information, as I went down, there were some really interesting strings that were plain text which gave us more information. It gave us how to run the file and get more help when we run it using the -h tag in the terminal. This means we can run the file when we give it permission and also use the -h to get more help just like this $ ./warm -h
I don’t know if you are able to see this, but it also gave us the flag in plain text without doing anything. Now I am going to give permission on this file so I can run it. This is how it’s done → $ sudo chmod +x warm
Then run the file as $ ./warm
Again, it gave us the same output that we found earlier when we used the “strings” command. Let’s pass the “-h” tag at the end to get more from this program.
We got the actual flag after doing that.
To submit the flag, simply go back to the box, enter the flag in the input field as shown below, and click submit.
This is the end of this box. I hope you gain something from it. I am just a beginner at CTF and in the tech field in general, so feel free to leave comments and feedback. Thank you!