Writeup: UUT 2019 - Break The RSA
Information
- category : crypto
- points : 50
Description
Flag is the decryption of the following:
PublicKey= (114869651319530967114595389434126892905129957446815070167640244711056341561089,113)
CipherText=102692755691755898230412269602025019920938225158332080093559205660414585058354
Writeup
We have :
- n: 114869651319530967114595389434126892905129957446815070167640244711056341561089
- e: 113
- ct: 102692755691755898230412269602025019920938225158332080093559205660414585058354
We can see on factordb if n
can be factorized. We get that n is the product of 338924256021210389725168429375903627261
* 338924256021210389725168429375903627349
So now he have :
- p: 338924256021210389725168429375903627261
- q: 338924256021210389725168429375903627349
- phi: 114869651319530967114595389434126892904452108934772649388189907852304534306480
Now we can use The extended euclidian algorithm to calculate d
:
1 | import math |
d : 43711460236635677751571696864313773406118944107922335607895274669461017479457
Now to calculate the clear text t
we need to compute : ct ^ d mod n
. In python we can use pow
with three arguments to do the job. In the last lines we need to convert the clear text which is an int in string, we can use for that thecodecs
library.
Last lines
1 | t = pow(ct,d,n) # computer clear text ct ^ d mod n |
Complete exploit
1 | import math |
Output
1 | d :43711460236635677751571696864313773406118944107922335607895274669461017479457 |
Flag
UUTCTF{easy sH0Rt RSA!!!}