In RSA, a small e value can be problematic, but what about N? Can you decrypt this?

How RSA works

  1. cd≑m(modn)
  2. me≑c(modn)
  3. d≑eβˆ’1(modΟ•(n))

here

m is message(plaintext), and
c
is ciphertext

If

n is small, we can crack it
(tool 1: https://www.dcode.fr/euler-totient tool 2: http://factordb.com/)
and know what
p
and
q
are.
After acquiring
p
and
q
, we can calculate
Ο•(n)=(pβˆ’1)(qβˆ’1)
, then calculate d=pow(e,-1,phin) using Python.

proof of RSA

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

(source: https://drive.google.com/file/d/1EURAqSaG2Mn0w0j70rI0Ph100CzXANty/view)

Writeup

  1. Use FactorDB to get the value of
    p
    and
    q

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More β†’
  2. Use Python to decode it
from Crypto.Util.number import * p=1593021310640923782355996681284584012117 q=521911930824021492581321351826927897005221 c=240986837130071017759137533082982207147971245672412893755780400885108149004760496 e=65537 n=p*q phin=p*q-p-q+1#(p*q-1)-(q-1)-(p-1) d=pow(e,-1,phin) m=pow(c,d,n) print(m) print(long_to_bytes(m))

Output:

β”Œβ”€β”€(kaliγ‰Ώkali)-[~]
└─$ /bin/python /home/kali/code/rsa.py
13016382529449106065927291425342535437996222135352905256639592405461024281868413
b'picoCTF{sma11_N_n0_g0od_23540368}'

Easier way

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

note that βœ” P,Q computed with N (FactorDB database) is mentioned