# AlexCTF 2017 - CR4 Poor RSA

Category: writeupsTags: alexctf-2017 crypto

## CR4 Poor RSA

Crypto - 200 Points

This time Fady decided to go for modern cryptography implementations, He is fascinated with choosing his own prime numbers, so he picked up RSA once more. Yet he was unlucky again!

flag.b64 file

```
Ni45iH4UnXSttNuf0Oy80+G5J7tm8sBJuDNN7qfTIdEKJow4siF2cpSbP/qIWDjSi+w=
```

key.pub file

```
-----BEGIN PUBLIC KEY-----
ME0wDQYJKoZIhvcNAQEBBQADPAAwOQIyUqmeJJ7nzzwMv5Y6AJZhdyvJzfbh4/v8
bkSgel4PiURXqfgcOuEyrFaD01soulwyQkMCAwEAAQ==
-----END PUBLIC KEY-----
```

### Writeup

Just like CR3, this challenge was based on RSA.

Looking with OpenSSL at the public key we can see the public exponent `e`

and the modulus `n`

.

```
openssl rsa -pubin -inform PEM -text -noout < key.pub
Public-Key: (399 bit)
Modulus:
52:a9:9e:24:9e:e7:cf:3c:0c:bf:96:3a:00:96:61:
77:2b:c9:cd:f6:e1:e3:fb:fc:6e:44:a0:7a:5e:0f:
89:44:57:a9:f8:1c:3a:e1:32:ac:56:83:d3:5b:28:
ba:5c:32:42:43
Exponent: 65537 (0x10001)
```

The modulus `n`

wasn’t very big so we searched on factordb.

Bingo. factordb entry for our modulus.

*At this moment, some other teams already solved this challenge before us, so thank you if you posted the factored modulus on factordb!*

The same magic as with CR3

The flag is `ALEXCTF{SMALL_PRIMES_ARE_BAD}`