W4502 Capture the Flag II

From Coder Merlin
Revision as of 12:11, 2 December 2020 by MagicPizzaBox (talk | contribs) (added plumbing forensics writeup)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

This page will serve as a writeup for the CTF II competition problems.

CautionWarnIcon.png
This writeup is incomplete. Writeups for the rest of the problems will be added shortly.

Cryptography[edit]

Telegraph[edit]

[25 Points] -- .-. / -- --- .-. ... . / .... .- -.. / .- / .... --- .-. ... . / --- ..-. / -.-. --- ..- .-. ... .
Hint: Your answer should have underscores separating the words.

By examining the challenge name and the dots and dashes, we can assume that the flag is encoded using morse code. When putting this in an online translator, we get "MR MORSE HAD A HORSE OF COURSE". If we format this, we get this flag: ahsCTF{mr_morse_had_a_horse_of_course}.

Racecar[edit]

[25 Points] ahsCTF{ti_esrev3r_t$uj}
Hint: racecar is an interesting word

Since "racecar" is a palindrome (same forward and backward), we can guess that the flag is reversed. If we reverse "ti_esrev3r_t$uj", we get "ju$t_r3verse_it". When we format this in the flag format, we get ahsCTF{ju$t_r3verse_it}.

Base 2 to the 6th[edit]

[50 Points] I don’t know how to convert bases for my computer science class. Can you help me out and do this problem for me so I don’t fail?

We also receive a file with this text: "YWhzQ1RGe2lfbGlrZV9iaWdfYmFzZXNfYW5kX2lfY2Fubm90X2xpZX0=". The characters used in this encoded message appear to be base64, and the challenge name also hints at base64 (2^6 = 64). If we put this in an online base64 decoder, we get ahsCTF{i_like_big_bases_and_i_cannot_lie}.

Message Mayhem[edit]

[275 Points] I received this message over my unreliable Wi-Fi, but it doesn’t make any sense.
Hint: The message seems to have been repeated on every line but some characters are corrupted.

We also get a file called message.txt which contains this:

ahsCTF{923fw3d2-3fw0ejdwoedpk3fe
a_#}?}5nJgxbU4.StN~oi_qn3WbV~qjl
[}ZCuR{8PAVW0XD~4Y8o9]X/P_'Uv9/S
y#GC1Uwb:Ksb#nDl3pzow_>|7O|\{NsM
Ofs6K*9b)[ndUcFrfX_4s*bXaYbo#0A*
]%sf#g{bag_{oZv%U/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n$GvV_&ldAM3]gH}
1dZL$FPh!h"x4LC?30#oEk]z-]}YAeaa

By viewing the hint and looking very closely at the characters on each line of the message we realize that the message was repeated 101 times but some characters were incorrect. We find that there seems to be similar characters in the same positions of each line (lots of "a"s in the 0th indexes, "h"s in the 1st index, etc.). We can write a simple Python script to decode this:

import statistics

f = open("message.txt", "r")
arr = [""] *32

for _ in range(0, 101):
    msg = f.readline()
    for j in range(0, 32):
         arr[j] += msg[j]

flag = ""
for i in arr:
    flag += statistics.mode(i)

print(flag)

This script starts by opening message.txt and creating an array of 32 empty strings because there are 32 characters per line. The script then loops through every line and for every line it loops through every character and adds that character to the corresponding position in the array. The array will now have 32 strings that each have a length of 101. The last loop in the script loops through the array and uses the statistics import to find the most common character and append it to the flag. This program outputs ahsCTF{b!g_bUnCh3$_of_b@d_bYt3s}.

Forensics[edit]

Plumbing[edit]

[75 Points] I haven't cleaned up my computer in a while, but I need to find the flag. The problem is, there's way too much junk. https://github.com/markamirkan/temprevshell/raw/main/plumbing.zip

The download link provides a zip file called plumbing.zip.

We can start by unzipping this file so we can work with it. We get a folder called plumbing which contains many folders within it and each of those folders has many files within it. The names and contents of the folders and files seem to be random. We can use the grep command to search the contents of files.

john-williams@codermerlin:~/plumbing$  grep -r ahsCTF .

The -r option is used to search recursively through all of the folders for "ahsCTF" in the current directory (represented by "."). After running this command we get an output containing ahsCTF{itsAMe_mario}.

CautionWarnIcon.png
This writeup is incomplete. Writeups for the rest of the problems will be added shortly.