Weak RSA
| Name | Weak RSA |
|---|---|
| Hint | Can you decrypt the message and get the flag? |
| Difficulty | Easy - Retired [0] |
| Rated difficulty | ![]() |
| First blood | alamot |
| Creator | tomtoump |
This time we have two files and the hint:
key.pub:
-----BEGIN PUBLIC KEY-----
MIIBHzANBgkqhkiG9w0BAQEFAAOCAQwAMIIBBwKBgQMwO3kPsUnaNAbUlaubn7ip
4pNEXjvUOxjvLwUhtybr6Ng4undLtSQPCPf7ygoUKh1KYeqXMpTmhKjRos3xioTy
23CZuOl3WIsLiRKSVYyqBc9d8rxjNMXuUIOiNO38ealcR4p44zfHI66INPuKmTG3
RQP/6p5hv1PYcWmErEeDewKBgGEXxgRIsTlFGrW2C2JXoSvakMCWD60eAH0W2PpD
qlqqOFD8JA5UFK0roQkOjhLWSVu8c6DLpWJQQlXHPqP702qIg/gx2o0bm4EzrCEJ
4gYo6Ax+U7q6TOWhQpiBHnC0ojE8kUoqMhfALpUaruTJ6zmj8IA1e1M6bMqVF8sr
lb/N
-----END PUBLIC KEY-----
flag.enc:
(binary encrypted data)
Hint:
Can you decrypt the message and get the flag?
What is with the unhelpful "hints?" Fortunately, the name pretty much gives it away that we're going to be cracking a weak key in RSA. The smallest amount of Googling around "cracking RSA" leads us to RsaCtfTool.
Why reinvent the wheel? Get what we need to make it happen:
git clone https://github.com/Ganapati/RsaCtfTool.git
cd RsaCtfTool
apt-get install libmpc-dev
pip2 install gmpy2
pip2 install -r optional-requirements.txt
git clone https://github.com/hellman/libnum.git
cd libnum
python setup.py build
python setup.py install
apt-get install python3-crypto
apt-get install python3-gmpy2

There it is!
