Tags: rsa crypto wiener 

Rating: 3.0

Challenge: Ron, Adi and Leonard
----------------------------------------
Category: Cryptography
----------------------------------------
100 points
----------------------------------------
Description: You think you have me figured out don't you!?
----------------------------------------

Comments: easy and quick!!!!
----------------------------------------

```

File: rsa.txt

rsa.txt:
n = 744818955050534464823866087257532356968231824820271085207879949998948199709147121321290553099733152323288251591199926821010868081248668951049658913424473469563234265317502534369961636698778949885321284313747952124526309774208636874553139856631170172521493735303157992414728027248540362231668996541750186125327789044965306612074232604373780686285181122911537441192943073310204209086616936360770367059427862743272542535703406418700365566693954029683680217414854103

e = 57595780582988797422250554495450258341283036312290233089677435648298040662780680840440367886540630330262961400339569961467848933132138886193931053170732881768402173651699826215256813839287157821765771634896183026173084615451076310999329120859080878365701402596570941770905755711526708704996817430012923885310126572767854017353205940605301573014555030099067727738540219598443066483590687404131524809345134371422575152698769519371943813733026109708642159828957941

c = 305357304207903396563769252433798942116307601421155386799392591523875547772911646596463903009990423488430360340024642675941752455429625701977714941340413671092668556558724798890298527900305625979817567613711275466463556061436226589272364057532769439646178423063839292884115912035826709340674104581566501467826782079168130132642114128193813051474106526430253192254354664739229317787919578462780984845602892238745777946945435746719940312122109575086522598667077632
```

```shell
PS D:\Securite-Informatique\RSHack-master\RSHack-master> python rshack.py

~~~~~~~~~~~~~~~~~~~~~~~~~
RSHack v2.0
Zweisamkeit
GNU GPL v3
~~~~~~~~~~~~~~~~~~~~~~~~~

List of the available attacks:

1. Wiener Attack
2. Hastad Attack
3. Fermat Attack
4. Bleichenbacher Attack
5. Common Modulus Attack
6. Chosen Plaintext Attack

List of the available tools:

a. RSA Public Key parameters extraction
b. RSA Private Key parameters extraction
c. RSA Private Key construction (PEM)
d. RSA Public Key construction (PEM)
e. RSA Ciphertext Decipher
f. RSA Ciphertext Encipher

[*] What attack or tool do you want to carry out? 1

***** Wiener Attack *****

[*] Arguments ([-h] -n modulus -e exponent):

-n 744818955050534464823866087257532356968231824820271085207879949998948199709147121321290553099733152323288251591199926821010868081248668951049658913424473469563234265317502534369961636698778949885321284313747952124526309774208636874553139856631170172521493735303157992414728027248540362231668996541750186125327789044965306612074232604373780686285181122911537441192943073310204209086616936360770367059427862743272542535703406418700365566693954029683680217414854103 -e 57595780582988797422250554495450258341283036312290233089677435648298040662780680840440367886540630330262961400339569961467848933132138886193931053170732881768402173651699826215256813839287157821765771634896183026173084615451076310999329120859080878365701402596570941770905755711526708704996817430012923885310126572767854017353205940605301573014555030099067727738540219598443066483590687404131524809345134371422575152698769519371943813733026109708642159828957941

~~~~~~~~~~~~~~~~~~~~~~~~~
Wiener Attack
Zweisamkeit
GNU GPL v3 License
~~~~~~~~~~~~~~~~~~~~~~~~~

[+] Private exponent: 108642162821084938181507878056324903120999504739411128372202198922197750954973

[+] Private key:

-----BEGIN RSA PRIVATE KEY-----
MIIDOwIBAAKBwE8bgV9pjqm0Wp+54kl24kVMFcfdrKWuEmvhTgT8F+Z59/xBiUri
oz3Y2yCElUajAlXbIsVui5fc+yY3H0sBarDYk4+jcug/bF+tlmyDUNyWOO/x8hR5
1s3uT1FWTPMygRUJ+a2IPRB+gAlBQ9SvXr5ZVyrerwgU6wzHNNbWTELkV+EruJTs
2z23aKpUh2W66lbS8uwZSXMJTprRUfWml36DWYWS34U9994IPwwjQrMrti3HDI4R
oBobgAClro1l1wKBwAYeBRQaEP+OSyDPESSoP7m86Il5GkTRLkYfz3tXUmZEyN/P
PPcFLbI9bGqt9uGIEbg+jo7MFsa8Yl5R6e5/jbp9kUbNo722s7Y/uMD6F+r0Lr9u
Nc+/2MqWUuFnvTOqcjLTKMWBv4Mlv9YGhtBry1kkj3mrzAbOTKEQtziIc7eQRDSG
nkaIQdhD1Fdbu4FMtIjsdd+UEQMw4NcJrykkxJrI6jXoG8AMpOklmRD3ToH/fD4V
m3EYQrdyxFoDmEx69QIhAPAxSPmZeoCOyf4FGVj9Y/i/FHAzHkGrubolwuikSrvd
AoGAdKCoou9Yvf3qyp5cUuAJ4aywD0fRaFVe1e0JgjNMLcsRU75yaXMnAKsFBGWJ
aQNFnRJ3Dzw6aM/jazO5f15eDBWiBJFrcbrkh0njiC4DvrTOMLTPGxQBfQqyZBVE
vZY4Z8RM1imdcU1U/yiYqdLZcvaby7ks1+aA//Jfg10UyF0CQQCtpHv+zCS6Mbh3
WNLdUk79GD8/VnICF95RTqj2xtI6Qd7oZMT5ddz4xQlXVjyl5BvrKgKfaKl4cJKD
ZKFxI3PDAiEA8DFI+Zl6gI7J/gUZWP1j+L8UcDMeQau5uiXC6KRKu90CIQDwMUj5
mXqAjsn+BRlY/WP4vxRwMx5Bq7m6JcLopEq73QKBgB3qDdcyP9sGEaxNb/86HWYC
McmxK/b/2DwkSTE4VesfIFjImsbCfnxDBs65OX9kLVeQA9Goi951wzJmfUFOIZbc
Dy3YftAGBo8HAuarceWkjQZa/Cmi29VXCgYJbWK6cV3FfbdgwRo6xMFbCmG8r9bP
Q/QvB6a49Hq43IOc0E5K
-----END RSA PRIVATE KEY-----
```

```shell
PS D:\Securite-Informatique\RSHack-master\RSHack-master> python rshack.py

~~~~~~~~~~~~~~~~~~~~~~~~~
RSHack v2.0
Zweisamkeit
GNU GPL v3
~~~~~~~~~~~~~~~~~~~~~~~~~

List of the available attacks:

1. Wiener Attack
2. Hastad Attack
3. Fermat Attack
4. Bleichenbacher Attack
5. Common Modulus Attack
6. Chosen Plaintext Attack

List of the available tools:

a. RSA Public Key parameters extraction
b. RSA Private Key parameters extraction
c. RSA Private Key construction (PEM)
d. RSA Public Key construction (PEM)
e. RSA Ciphertext Decipher
f. RSA Ciphertext Encipher

[*] What attack or tool do you want to carry out? e

***** RSA Decipher *****

[*] Argument ([-h] -n modulus -d private_exponent -c ciphertext):

-n 744818955050534464823866087257532356968231824820271085207879949998948199709147121321290553099733152323288251591199926821010868081248668951049658913424473469563234265317502534369961636698778949885321284313747952124526309774208636874553139856631170172521493735303157992414728027248540362231668996541750186125327789044965306612074232604373780686285181122911537441192943073310204209086616936360770367059427862743272542535703406418700365566693954029683680217414854103 -d 108642162821084938181507878056324903120999504739411128372202198922197750954973 -c 305357304207903396563769252433798942116307601421155386799392591523875547772911646596463903009990423488430360340024642675941752455429625701977714941340413671092668556558724798890298527900305625979817567613711275466463556061436226589272364057532769439646178423063839292884115912035826709340674104581566501467826782079168130132642114128193813051474106526430253192254354664739229317787919578462780984845602892238745777946945435746719940312122109575086522598667077632
[+] The plaintext is: 194664885563228364493253577984786532516518879700404366133072425368037400553414800204901

[+] The interpreted plaintext: d4rk{r3p34t3ed_RsA_1s_f0r_n00bs}c0de
```

Original writeup (https://github.com/Ne0Lux-C1Ph3r/WRITE-UP/blob/master/Hackcon2018/Crypto/Ron_Adi_and_Leonard.md).