Post

HackTheBox Quantum Conundrum Writeup

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import socket
import sys
try:
    host, port = sys.argv[1].split(':')
    port = int(port)
except IndexError:
    print(f'Usage: python {sys.argv[0]} <ip:port>')
    exit(1)
instructions = '{"type": "hadamard", "register_indexes": [1]};{"type": "cnot", "register_indexes": [1, 2]};{"type": "cnot", "register_indexes": [0, 1]};{"type": "hadamard", "register_indexes": [0]}'
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((host, port))
    data = s.recv(4096)
    print(data.decode())
    s.sendall(instructions.encode() + b'\n')
    while True:
        data = s.recv(4096)
        if not data:
            break
        print(data.decode())

This simulates a quantum computer on the server side of a non-quantum computer, which may take 1-3 minutes to complete.

Summary

The Quantum Conundrum Challenge on Hack The Box is a very-easy-level challenge focused on simulating quantum computing operations. The provided Python script interacts with a remote server, sending quantum instructions (like Hadamard and CNOT gates) over a socket connection. The challenge demonstrates basic concepts of encryption reversal and file handling while simulating quantum computations, which may take a few minutes to complete.

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