# ciphertexts [InterKosenCTF 2020] ###### tags: `InterKosenCTF2020` `crypto` ## 概要 同じ平文$m$を異なる$e$, $N$でplain RSAとして暗号化している。 $c_1, c_2, N_1, N_2, e_1, e_2$が貰える。 特徴としては、$e_1$と$e_2$が近いことと、$N_1 | N_2$なことが挙げられる。 ## 解法 $c_1 = m^{e_1} \mod N_1$ $c_2 = m^{e_2} \mod N_2$ だが、$N_1 | N_2$なので $c_2 \mod N_1 = m^{e_2} \mod N_1$ が求まり、Common Modulus Attackが適用できる。 ```python= from ptrlib import * m = common_modulus_attack([c1, c2 % n1], [e1, e2], n1) print(int.to_bytes(int(m), byteorder='big', length=m.bit_length() // 8 + 1)) ``` おわり。 ``` KosenCTF{HALDYN_D0M3} ``` ## 感想・意見 - warmupで良さそう - 初心者にとって非自明ながらも、CMAの条件を理解していれば解ける良い感じの問題だと思う