Skip to content

[Challenge 0] Discord

Justin Chadwell edited this page Oct 23, 2020 · 2 revisions

To get started, we're given the starting clue:

Welcome back to HTM!

This year's CTF is full of mystery, intrigue and surprises... eh, not really, it's just meant to be a bit fun!

But, I have heard whispers that there's a bot on the discord server who's giving out flags... Seems quite dodgy to me, who'd be crazy enough to do something like that?

When we look at the discord, we see a bot called FlagBot, with the status text "Playing Capture the Flag in DMs".

Since the bot seems to be taking messages in it's direct messages, it makes sense to send it a simple message.

It replies with a "command not found" error. If we look at the format of the error message, it looks very similar to the message given by a shell like bash/zsh when we try and run a program that doesn't exist. If we didn't know this right away, we could've googled "command not found" and found references like this. This implies that we're using some sort of Linux environment, though because of the "fakeshell", we assume it's probably a bit different than a normal one.

We can run a common command, ls to list files and see what exists.

There are two things listed, data and bin. In Linux, bin is where programs are traditionally stored, while data is custom, and looks like it might have some useful information.

We can try and ls both of these:

In the data folder, we can see a file called flag! That looks promising! We can also see the list of programs installed in bin, which includes cat which is used to print the contents of a file.

So, let's cat the flag!

Hm, the flag doesn't appear to be there, let's keep looking. Let's try cating the programs themselves, to see if we can work out how they work.

If we look at the code for ls, we can see that it has an option -a that enables the option show_hidden.

Let's try running ls again in the data folder, to see if there are any hidden files.

We find a .hidden file, which looks right:

And we find the flag "HTM{C0M3_1_c0m3_4ll}"!

Clone this wiki locally