> For the complete documentation index, see [llms.txt](https://writeups.ayweth20.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://writeups.ayweth20.com/2022/404ctf/crypto/un-simple-oracle-2-2.md).

# Un simple oracle \[2/2]

**Category:** Cryptanalysis - **Points:** 991 - **Difficulty:** Medium - **Solves:** 106

**Description:**

Bonjour agent, Suite à votre récente découverte, nous avons pu extraire beaucoup d'informations de ce serveur. Malheureusement, ce service a fermé il y a une semaine, et vient juste de réouvrir après ce qui a été vraisemblablement une mise à jour de sécurité, et il ne semble plus possible d'accéder au secret. Pourriez-vous faire quelque chose?

`nc challenge.404ctf.fr 30594`

**Solution:**

For the second part of this challenge, we do not have the modulus. So we have to calculate it. We have E(x)=x^65537−k⋅n, for some integer k (which will be different for different values of x), and the unknown modulus n. Hence, x^65537−E(x) will always be a multiple of n. So, compute:

gcd(E(2)^2 − E(4), E(3)^2 − E(9))

By applying this method, we can then find n and thus repeat the Chosen Plaintext Attack operation to find the flag.

<details>

<summary>🚩 FLAG</summary>

```
404CTF{L3_m0dul3_357_t0uj0ur5_7r0uv4bl3}
```

</details>
