2020.06.27 redpwn

Redpwn 2020 Crypto - 4k-rsa

CTF writeup: A large RSA modulus made of smaller primes is factorization's bulk discount in redpwnCTF 2020's 4k-rsa. Recover the factors and decryption exponent.

Event
redpwn
Category
crypto
Topic
RSA
Published
Markdown source Attached files Read article
Cite

Copy this citation into your bibliography, or download the BibTeX file.

Download .bib

4k-rsa

Description

Plain text
Only n00bz use 2048-bit RSA. True gamers use keys that are at least 4k bits long, no matter how many primes it takes...

Files

4k-rsa-public-key.txt which contains a n, e, c triple

Seems like there are a lot of primes in the factorization of n, since the factorization process is influenced directly by the size of prime factors and not the size of the number being factored itself, it should be fairly doable by alpetron.ar

Alpertron displays the 1,225-digit RSA modulus as a product of many small prime factors.

It took about half an hour to factor, one may engage to other activities or alternatively try if the factors are available on factordb.
Anyways, once finished factoring, alpetron produces both the factors and the Euler’s totient phi which will be used to compute d

Plain text
d = pow(e,-1,phi) # on python3.8
# or gmpy2.invert(e,phi) 
m = pow(c,d,n)
print(bytes.fromhex(hex(m)[2:]).decode())

And hurray, we have our flag

flag{t0000_m4nyyyy_pr1m355555}