Hackthebox | Crypto | Brainy’s Cipher

Al Francis
2 min readJun 29, 2019

--

The paragraph below opened the challenged

Brainy likes playing around with esoteric programming. He also likes math and has therefore encrypted his very secure password with a popular encryption algorithm. Claiming that his password cannot be retrieved now, he has sent the ciphertext to some of his friends. Can you prove to Brainy that his password can actually be recovered?

From there I got a clue and search online regarding Esoteric Programming. The challenge is more on Crypto so I dig more on “Esoteric Programming Decoder” which return two results that caught my attention.

  1. https://www.dcode.fr/ook-language
  2. https://www.dcode.fr/brainfuck-language

I opened the brainy.txt file provided in the challenge

You may see the actual content here:

https://github.com/laet4x/hackthebox/blob/master/crypto/brainys-cipher/brain.txt

I used the content from brainy.txt to the two decoders above but the brainfuck language decoder give a more positive response

Here’s the decoded content for reference

https://github.com/laet4x/hackthebox/blob/master/crypto/brainys-cipher/brain-decrypted.txt

I noticed the five key RSA values: “p, q, dp, dq, and c” which led me to searched about RSA Cryptography on wikipedia and get a hint about Chinese Remainder Algorithm.

Another reference help me about RSA https://www.di-mgt.com.au/crt_rsa.html

Then I continue my search about modular inverse https://stackoverflow.com/questions/4798654/modular-multiplicative-inverse-function-in-python

which is a big help so I came up with this python code to get the flag.

Voila!

--

--

Al Francis
Al Francis

Written by Al Francis

Co-Founder of Kalasag and Project Access Granted Society. A Certified Ethical Hacker,EC-Council Certified Incident Handler and Certified Blockchain Developer.

No responses yet