This is a RSA challenge in the set of 8 RSA challenges.

The given file:

from Crypto.Util.number import *

msg=b'UDCTF{REDACTED}'
pt=bytes_to_long(msg)
e=3

p1=getPrime(512)
q1=getPrime(512)
N1=p1*q1

ct1=pow(pt,e,N1)

p2=getPrime(512)
q2=getPrime(512)
N2=p2*q2

ct2=pow(pt,e,N2)

p3=getPrime(512)
q3=getPrime(512)
N3=p3*q3

ct3=pow(pt,e,N3)

print(N1)
print(N2)
print(N3)
print(e)
print(ct1)
print(ct2)
print(ct3)

We notice that the public exponent e is reused and small. This will failed under Chinese remainder theorem.

The basic is that

If e is reused to encrypt e times, we can recover the plaintext

Solve script:

N = n1* n2*n3
N1 = N//n1
N2 = N//n2
N3 = N//n3

u1 = inverse(N1,n1)
u2 = inverse(N2,n2)
u3 = inverse(N3,n3)

result = (u1*c1*N1)+(u2*c2*N2)+(u3*c3*N3)
result%=N

# compute pow(result,1/3) in sage
m = 782235796730035462393079835848937167969563928296009875471696331363399373471699466158499918210463231116190077
print(long_to_bytes(m))

# UDCTF{ch1n3se_r3m4ind3r_th30r3m_f0r_th4_w1n!}