HackTheBox baby quick maffs Writeup
Explore the basics of cybersecurity in the baby quick maffs 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/316
Description
Wikipedia says "the Rabin cryptosystem has been mathematically proven to be computationally secure against a chosen-plaintext attack as long as the attacker cannot efficiently factor integers", so I created my own cool implementation.
Exploitation
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env python3
def main():
with open('output.txt') as f:
N = int(f.readline())
remainder = int(f.readline())
a, b, c = eval(f.readline())
m1 = pow(2 * remainder, -1, N) * (c - a - remainder ** 2) % N
m = m1 + m1 + remainder
print(bytes.fromhex(hex(m)[2:]).decode())
if __name__ == '__main__':
main()
Summary
The baby quick maffs Challenge on Hack The Box is an easy-level cryptographic puzzle that focuses on modular arithmetic and reverse engineering. Participants are tasked with deciphering a given ciphertext by analyzing mathematical relationships and reconstructing the plaintext. The challenge demonstrates the application of modular inverses and arithmetic operations to recover encrypted data. It’s an excellent exercise for beginners looking to strengthen their understanding of basic cryptographic principles and Python programming.