Danish Christmas CTF 2021 by NC3/Police – Intermediary – Hej Verden!

Next challenge in the intermediary category is called "Hej Verden!" meaning "Hello World!". In the challenge description we are provided a .txt-file.

NC3 Challenge: Hej Verden

Downloading the file and looking into it we are provided with a very weird string that "the elfs in the attic" doesn't understand.

++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>++.>+.+++++++..+++.<<++++++++++++++.------------.>+++++++++++++++.>.+++.------.--------.<<+.

Indeed this is very strange and not something I remember seeing before. What do we do? Well, let us ask good old Google:

Hej Verden - google-search

Arh! The programming language "Brainf*ck". I remember from way back in the days when I first started learning coding in Python, one of my friends had a lot of fun with that language and telling me that the language mainly was created to be strange, weird and hard for the human brain to code in.

A quick search on the Internet and we found an interpreter we can use to make something out of the string.

Hej Verden - Brainf*ck first

Alright - it worked!
Going further in the challenge we are also provided with the weird communication of:

++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>++++++++++.-----------.<-------------------.>++++++++++++++++++++++++.--------.--------------.+++++++++.----------.-----.+++++++.++++++.-------.+++++++++++++.-------------.------.++++++++.------.+++++++++++++++++++++.-----------------.+++++++++++++.+++++++++++.

This is for sure our flag, and using the same technique on that string provides us with a flag:

Hej Verden - Brainf*ck flag

But isn't that too easy? Wouldn't it be funnier if we could use Python as well? Yes, you guessed it - no problem in doing so. Below is a very easy example of a Python-script converting a Brainf*ck string into something making sense.

#!/usr/bin/env python3
import brainfuck  # pip install brainfuck-interpreter

bf = '++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>++++++++++.-----------.<-------------------.>++++++++++++++++++++++++.--------.--------------.+++++++++.----------.-----.+++++++.++++++.-------.+++++++++++++.-------------.------.++++++++.------.+++++++++++++++++++++.-----------------.+++++++++++++.+++++++++++.'

print(brainfuck.evaluate(bf))

Leave a Reply

Your email address will not be published. Required fields are marked *