Post

HackTheBox Ransom Challenge

Explore the basics of cybersecurity in the Ransom Challenge on Hack The Box. This easy-level Challenge introduces encryption reversal and file handling concepts in a clear and accessible way, perfect for beginners.

https://app.hackthebox.com/challenges/166

Description

We received an email from Microsoft Support recommending that we apply a critical patch to our Windows servers. A system administrator downloaded the attachment from the email and ran it, and now all our company data is encrypted. Can you help us decrypt our files?

Exploitation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

def decrypt_file(encrypted_file_path, output_file_path):
    KEY = "SUPERSECURE"
    key_length = len(KEY)
    try:
        with open(encrypted_file_path, 'rb') as f:
            encrypted_data = f.read()
        decrypted_data = bytearray()
        for i in range(len(encrypted_data)):
            decrypted_byte = encrypted_data[i] - ord(KEY[i % key_length])
            decrypted_data.append(decrypted_byte & 0xFF)
        with open(output_file_path, 'wb') as f:
            f.write(decrypted_data)
        print(f"Successfully decrypted {encrypted_file_path} to {output_file_path}")
    except Exception as e:
        print(f"Error during decryption: {str(e)}")

if __name__ == "__main__":
    decrypt_file('login.xlsx.enc', 'out.zip')
1
2
3
python poc
unzip out.zip
rg "HTB"

Summary

The Ransom Challenge on Hack The Box is an easy-level reverse engineering puzzle that introduces basic file decryption techniques. Participants decrypt a file encrypted with a simple XOR-like algorithm using a fixed key (SUPERSECURE), then extract the hidden flag from the recovered data. Ideal for beginners, it provides hands-on experience with encryption reversal and file manipulation, offering a practical introduction to basic cryptographic concepts.

This post is licensed under CC BY 4.0 by the author.