BabyEncryption | HTB | Write up

kshitij kumar
2 min readJun 2, 2021
Hack The Box official website

So hey guys, back again with a new write-up of Hack the Box’s BabyEncryption challenge. This box is of cryptography category.

You have to find the flag by decrypting the cipher text which is provided by them. In order to decrypt the flag they also provide a python script which is none of our use means you need to modify the script and then execute it. I’m new to HTB, so I don’t know whether they follow the same rules for this type of challenges or they did it for this challenge only.

So without wasting the time let’s start…

Unzipping the file

Password :- hackthebox

After unzipping the file we have two more files, “chall.py” which is the python script to decrypt the cipher text & “msg.enc” which contains the cipher text.

Let's have a look at the content of these files…

If you execute the script it will throw errors as follows…

After wasting few seconds in fixing the error I give up and decided to modify the script…

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def decryption(msg):
pt = []
for char in msg:
char = char — 18
char = 179 * char % 256
pt.append(char)
return bytes(pt)

with open(‘msg.enc’) as f:
ct = bytes.fromhex(f.read())

pt = decryption(ct)
print(pt)

Still thinking will this new script work…??

Let's execute it …

Not so hard, we got the flag…

HTB{l00k_47_y0u_r3v3rs1ng_3qu4710n5_c0ngr475}

For any queries just message me on Instagram @ig._.anshu

--

--