Infernoctf_2019 Really Secure Algorithm Again

LeeDoHyun · December 30, 2019

간단한 RSA문제 입니다.

e = 65537
N = 25693197123978473
encflag = ['0x2135d36aa0c278', '0x3e8f43212dafd7', '0x7a240c1672358', '0x37677cfb281b26', '0x26f90fe5a4bed0', '0xb0e1c482daf4', '0x59c069723a4e4b', '0x8cec977d4159']

주워진 값을보면 enc값이 8개가 주워지는데 일반적인 RSA와 똑같은 방식으로 풀립니다.

from Crypto.Util.number import *

'''
e = 65537

N = 25693197123978473

encflag = ['0x2135d36aa0c278', '0x3e8f43212dafd7', '0x7a240c1672358', '0x37677cfb281b26', '0x26f90fe5a4bed0', '0xb0e1c482daf4', '0x59c069723a4e4b', '0x8cec977d4159']
'''
e = 65537
n = 25693197123978473
p = 150758089
q = 170426657
phi = (p - 1) * (q - 1)
d = inverse(e, phi)

c0 = 0x2135d36aa0c278
c1 = 0x3e8f43212dafd7
c2 = 0x7a240c1672358
c3 = 0x37677cfb281b26
c4 = 0x26f90fe5a4bed0
c5 = 0xb0e1c482daf4
c6 = 0x59c069723a4e4b
c7 = 0x8cec977d4159

flag0 = long_to_bytes(pow(c0, d, n))
flag1 = long_to_bytes(pow(c1, d, n))
flag2 = long_to_bytes(pow(c2, d, n))
flag3 = long_to_bytes(pow(c3, d, n))
flag4 = long_to_bytes(pow(c4, d, n))
flag5 = long_to_bytes(pow(c5, d, n))
flag6 = long_to_bytes(pow(c6, d, n))
flag7 = long_to_bytes(pow(c7, d, n))

print flag0,flag1,flag2,flag3,flag4,flag5,flag6,flag7
flag is : infernoCTF{RSA_k3yS_t00_SmAll}

Twitter, Facebook