# CH01 - 500pts

## Briefing

> Download the files and find a way to retrieve the encrypted data. Contents: 1.pub, 2.pub, m1.enc, m2.enc

Challenge Files:

* [ch01.zip](https://github.com/HHousen/NCS-Competition/tree/e3a1ab990b675bd865fdddd9e5fa5cd7895b3b02/Crypto/CH01/ch01.zip)

## Solution

1. Searching for "rsa two messages different exponents" finds [this Crypto StackExchange answer](https://crypto.stackexchange.com/a/62042) which links to [this other Crypto StackExchange answer](https://crypto.stackexchange.com/a/16285) which mentions a "common modulus attack."
2. [Mathematical Attacks on RSA Cryptosystem](https://thescipub.com/pdf/jcssp.2006.665.671.pdf) states: "A Common Modulus attack can be used to recover the plaintext when the same message is encrypted to two RSA keys that use the same modulus. This algorithm works if and only if message sends with the same modulus and relatively prime encryption exponents." You can learn more by reading this article [RSA Attacks: Common Modulus](https://infosecwriteups.com/rsa-attacks-common-modulus-7bdb34f331a5).
3. Searching for a Python script to conduct this attack finds [HexPandaa/RSA-Common-Modulus-Attack](https://github.com/HexPandaa/RSA-Common-Modulus-Attack).
4. We can run this tool using `python3 rsa-cm.py -c1 ch01/m1.enc -c2 ch01/m2.enc -k1 ch01/1.pub -k2 ch01/2.pub` to get the flag: `Flag: shaRinGisCaRinG-010`.

### Flag

`shaRinGisCaRinG-010`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ncs2021.haydenhousen.com/crypto/ch01.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
