Baby Time Capsule
EASY
, Crypto
DESCRIPTION: Qubit Enterprises is a new company touting it's propriety method of qubit stabilization. They expect to be able to build a quantum computer that can factor a RSA-1024 number in the next 10 years. As a promotion they are giving out "time capsules" which contain a message for the future encrypted by 1024 bit RSA. They might be great engineers, but they certainly aren't cryptographers, can you find a way to read the message without having to wait for their futuristic machine?
https://app.hackthebox.com/challenges/365
Baby Time Capsule is cryptography challenge. we are given with python source code server.py file.
To solve this we need knowledge of the Chinese remainder theorem.
m=message, e=5, n=public key, c=cipher text
me mod n = c
let's take x = me
x mod n = c
here x module n is remainder c, so we can say that x anc c are congruent modulo.
x ≡ c (mod n)
Here server encrypt same message with different public keys.
x ≡ c1 (mod n1)
x ≡ c2 (mod n2)
x ≡ c3 (mod n3)
The Chinese Remainder Theorem (CRT) is used to solve a set of different congruent equations with one variable but different moduli which are relatively prime.
To find x:
x = (c1 × N1 × N1-1 + c2 × N2 × N2-1 + c3 × N3 × N3-1) mod N
here, N = n1 × n2 × n3
N1 = N / n1
N2 = N / n2
N3 = N / n3
N1 × N1-1 = 1 mod n1
N2 × N2-1 = 1 mod n2
N3 × N3-1 = 1 mod n3
we can use extended euclidean algorithm to find N1-1.
I used python library to perform CRT.
Python code:
flag= HTB{t3h_FuTUr3_15_bR1ghT_1_H0p3_y0uR3_W34r1nG_5h4d35!}
Last updated
Was this helpful?