Bits and Bytes Security

Hack The Box / Challenges / Crypto / Decode Me

Looking at the file contents:

$ cat Decode.txt 
993gmULBNujjrZCDev3W8kAVaLkXiyHhCL3500188bA=

gAAAAABboRUb0FsuiYBk1tsXRDr6KAzU1xrNSUv7grB-G-dAEeyqj99kUebz466I2VcH5xDa5HEc5KkbgTklQ7tm9JCRPlJtRng1Ns3VEvbrk7B835OINfPnRbc-UIOnnCmW3CgMdMtf5wGLN299AZEzxIvuy71WC5d9xJDchyiORycuzCth95-4nTKphlNQQ2ko3DX72RxWeEjwt3mavnFXqcOCkGxUhJYmFltz_6ND56VGTrXZi_CK5xLODOX4sj1GNwN_CrU3sJ0obTdA2wF5OaDZLbA1GBPfK0PDlC9WxoUf85K0tFXKfqbt3c5YqtqfytNG5gTkbDFM2NjE7BveBf1DP9ca8g==

This reminds me (not at first sight) of a previous challenge with similar text characters, also splitting two sections. It was using an unknown cipher at the time for me, Fernet.

This seems to be the case, using the first part as the key and the second as the message we get:

$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.fernet import Fernet
>>> f = Fernet(bytes("993gmULBNujjrZCDev3W8kAVaLkXiyHhCL3500188bA=",encoding='utf8'))
>>> f.decrypt(bytes("gAAAAABboRUb0FsuiYBk1tsXRDr6KAzU1xrNSUv7grB-G-dAEeyqj99kUebz466I2VcH5xDa5HEc5KkbgTklQ7tm9JCRPlJtRng1Ns3VEvbrk7B835OINfPnRbc-UIOnnCmW3CgMdMtf5wGLN299AZEzxIvuy71WC5d9xJDchyiORycuzCth95-4nTKphlNQQ2ko3DX72RxWeEjwt3mavnFXqcOCkGxUhJYmFltz_6ND56VGTrXZi_CK5xLODOX4sj1GNwN_CrU3sJ0obTdA2wF5OaDZLbA1GBPfK0PDlC9WxoUf85K0tFXKfqbt3c5YqtqfytNG5gTkbDFM2NjE7BveBf1DP9ca8g==",encoding='utf8')
... )
b'RCdgTl45OFs8O3tGMlZVNTRRPythcUw6bVxJNmlYJmYkMEBSeFBfdSldeHFwdW5tM3Fwb2htZmUrTGJnZl9eXSNhYFleV1Z6VFNYUVZVTnJMUVBPTkdrS0QsSEFlKERDPDtfPz5+fTVZOTg3dzUuUjJyMC8oJyZKKikoJyYlfHtBeX53djx6eXhxWTZ0c1VUcG9oLnk='

Output seems to be a base64 encoded string, let’s decode it:

>>> d=f.decrypt(bytes("gAAAAABboRUb0FsuiYBk1tsXRDr6KAzU1xrNSUv7grB-G-dAEeyqj99kUebz466I2VcH5xDa5HEc5KkbgTklQ7tm9JCRPlJtRng1Ns3VEvbrk7B835OINfPnRbc-UIOnnCmW3CgMdMtf5wGLN299AZEzxIvuy71WC5d9xJDchyiORycuzCth95-4nTKphlNQQ2ko3DX72RxWeEjwt3mavnFXqcOCkGxUhJYmFltz_6ND56VGTrXZi_CK5xLODOX4sj1GNwN_CrU3sJ0obTdA2wF5OaDZLbA1GBPfK0PDlC9WxoUf85K0tFXKfqbt3c5YqtqfytNG5gTkbDFM2NjE7BveBf1DP9ca8g==",encoding='utf8'))
>>> import base64
>>> print(base64.b64decode(d))
b"D'`N^98[<;{F2VU54Q?+aqL:m\\I6iX&f$0@RxP_u)]xqpunm3qpohmfe+Lbgf_^]#a`Y^WVzTSXQVUNrLQPONGkKD,HAe(DC<;_?>~}5Y987w5.R2r0/('&J*)('&%|{Ay~wv<zyxqY6tsUTpoh.y"


00000000: 4427 604e 5e39 385b 3c3b 7b46 3256 5535  D'`N^98[<;{F2VU5
00000010: 3451 3f2b 6171 4c3a 6d5c 4936 6958 2666  4Q?+aqL:m\I6iX&f
00000020: 2430 4052 7850 5f75 295d 7871 7075 6e6d  $0@RxP_u)]xqpunm
00000030: 3371 706f 686d 6665 2b4c 6267 665f 5e5d  3qpohmfe+Lbgf_^]
00000040: 2361 6059 5e57 567a 5453 5851 5655 4e72  #a`Y^WVzTSXQVUNr
00000050: 4c51 504f 4e47 6b4b 442c 4841 6528 4443  LQPONGkKD,HAe(DC
00000060: 3c3b 5f3f 3e7e 7d35 5939 3837 7735 2e52  <;_?>~}5Y987w5.R
00000070: 3272 302f 2827 264a 2a29 2827 2625 7c7b  2r0/('&J*)('&%|{
00000080: 4179 7e77 763c 7a79 7871 5936 7473 5554  Ay~wv<zyxqY6tsUT
00000090: 706f 682e 79                             poh.y

Now, it seems the output characters are all printable characters however, it contains lots of symbols and is not readable.

Tested with Z85 a 85 long alphabet encoder, but no luck since it doesn’t use “()” characters for example.

The uuencode looked promissing, but also didn’t work because “{}” characters are not used.

The different alphabets for binary-to-text encoders are:

            `^~<>|_,;: ?/. ' ()[]{}@$*\&#%+023456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
ascii85     `^~<=>-,;:!?/.'"()[]  @$*\&#%+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
base32                                      =234567ABCDEFGHIJKLMNOPQRSTUVWXYZ
base36                                   0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
base58                                    123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
base64                                  =0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
uuencode      ^<=>_-,;:!?/.'"()[]@$*\&#%+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ

This challenge wasn’t strange to me, and looking at other challenges I came across this Inferno challenge which was using esoteric programming language. Looking for more information I found this:

Malboge: An esoteric language that looks a lot like Base85… but isn’t. Often has references to “Inferno” or “Hell” or “Dante.” Online interpreters like so: http://www.malbolge.doleczek.pl/

Using a Malboge code simulator, we get the flag:

HTB{U_g0t_th1$}