Weak RSA

Name: Weak RSA
Hint: Can you decrypt the message and get the flag?
Base Points: Easy - Retired [0]
Rated Difficulty:
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:
¢_ïvc[Ûê~çkZÄ1ŠÄ¨Ñ4ÎI¥9VÑÖ¿Æ^GòÂä(…+3Lu"ÚTé$¾ ÉF0ëVP§Ö¾j@ì¸áôÀÉ|jÏä™Øçå…{¾ì,•†ðôüYE©©ïï¬X8xæü,­ïcN&Hl2¹ÓÆå[o¤î+
      
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 (Google Fu) around "cracking RSA" will lead us to:

 

https://github.com/Ganapati/RsaCtfTool

 

Seriously, it's like the third entry on the first page.  Why reinvent the wheel?  So, let's get what we need to make it happen, Cap'n!


  1. git clone https://github.com/Ganapati/RsaCtfTool.git
  2. cd RsaCtfTool
  3. apt-get install libmpc-dev
  4. pip2 install gmpy2
  5. pip2 install -r optional-requirements.txt
  6. git clone https://github.com/hellman/libnum.git
  7. cd libnum
  8. python setup.py build
  9. python setup.py install
  10. apt-get install python3-crypto
  11. apt-get install python3-gmpy2
 
  Showtime!

There it is!