**Crypto 150 - RSA challenge ** L'auteur du challenge nous dit qu'il à sniffer une connexion et qu'il à intercepter le flag du challenge dans un fichier zip. Il nous explique que la clé publique à permis de chiffré la clé aes qui à elle même permit de chiffrer le ciphermessage. Le fichier zip du challenge contient : unzip rsa.zip aes_key_cipher ciphermessage pub_key Récupération des informations de la clé publique grâce à open ssl : openssl rsa -in pub_key -pubin -text -modulus Public-Key: (2072 bit) Modulus: 00:8d:a5:69:19:b5:26:d4:52:25:ac:ed:4b:e6:45: 22:ce:f0:4a:63:91:0b:9f:6f:fe:a6:b1:12:55:41: 01:3b:e4:5d:48:b6:fb:26:71:b7:54:0e:6a:4e:0b: 55:e3:a9:e4:c4:5a:8d:5f:54:a0:69:9c:65:32:d4: a1:28:7f:ac:b0:08:b1:c5:6e:35:d6:01:dc:2a:9e: 2e:66:51:89:ea:a3:5d:22:d7:be:a2:52:c1:ec:f2: 70:31:ab:65:7d:5b:35:e8:2c:de:70:f8:25:9d:2e: 14:e9:86:f3:62:e3:e8:6e:7b:d8:e4:81:2a:52:f2: e8:cc:2f:69:b8:b0:c9:59:77:8f:db:24:0a:8e:17: cb:95:72:45:70:12:d8:3b:6c:72:72:90:e5:0b:8e: 7d:a2:8f:eb:df:ab:f5:23:da:03:b9:4b:94:32:2a: f4:21:f9:ca:02:ad:e6:04:da:ab:92:cd:9c:28:24: 44:36:f1:15:fd:be:d7:6d:2c:85:00:7a:ca:7f:ce: 49:89:3a:f8:0e:79:55:63:2e:c7:b8:9f:56:fa:b0: 18:76:e0:fe:88:29:9a:37:34:0d:43:9c:b2:e0:1b: 3c:07:e6:0c:88:47:42:1b:fe:04:9d:59:95:40:6b: 26:f4:a0:8b:20:d1:49:b3:c6:1a:ae:a3:53:1d:62: f8:f8:d1:e2:87 Exponent: 65537 (0x10001) Modulus=8DA56919B526D45225ACED4BE64522CEF04A63910B9F6FFEA6B1125541013BE45D48B6FB2671B7540E6A4E0B55E3A9E4C45A8D5F54A0699C6532D4A1287FACB008B1C56E35D601DC2A9E2E665189EAA35D22D7BEA252C1ECF27031AB657D5B35E82CDE70F8259D2E14E986F362E3E86E7BD8E4812A52F2E8CC2F69B8B0C959778FDB240A8E17CB9572457012D83B6C727290E50B8E7DA28FEBDFABF523DA03B94B94322AF421F9CA02ADE604DAAB92CD9C28244436F115FDBED76D2C85007ACA7FCE49893AF80E7955632EC7B89F56FAB01876E0FE88299A37340D439CB2E01B3C07E60C8847421BFE049D5995406B26F4A08B20D149B3C61AAEA3531D62F8F8D1E287 writing RSA key -----BEGIN PUBLIC KEY----- MIIBJTANBgkqhkiG9w0BAQEFAAOCARIAMIIBDQKCAQQAjaVpGbUm1FIlrO1L5kUi zvBKY5ELn2/+prESVUEBO+RdSLb7JnG3VA5qTgtV46nkxFqNX1SgaZxlMtShKH+s sAixxW411gHcKp4uZlGJ6qNdIte+olLB7PJwMatlfVs16CzecPglnS4U6YbzYuPo bnvY5IEqUvLozC9puLDJWXeP2yQKjhfLlXJFcBLYO2xycpDlC459oo/r36v1I9oD uUuUMir0IfnKAq3mBNqrks2cKCRENvEV/b7XbSyFAHrKf85JiTr4DnlVYy7HuJ9W +rAYduD+iCmaNzQNQ5yy4Bs8B+YMiEdCG/4EnVmVQGsm9KCLINFJs8YarqNTHWL4 +NHihwIDAQAB -----END PUBLIC KEY----- Il nous faut convertir notre Modulo (modulus) d'hexa en décimal. Pour cela on utilise le site : [[http://www.mobilefish.com/services/big_number/big_number.php | Convertisseur de grands nombres]] Maintenant que nous avons notre modulo en décimal il faut le factoriser : On utilise le site [[http://factordb.com/ | Factor db]] , enorme base de donnée de factorisation. http://factordb.com/index.php?query=299996217561787292756826251240073744022587364427659002955601969311597453693948323421942282716737653493469667806494795328718748694431287426493332498123774403296361258944222401796946976412532226598881087042326060698386611304550152758781853605660146138394024484376984580234460609993575374222942038026173435262460884234328411077658271473762471945787635582916630508147146325427058379173689622281755189370552117476758492729644576568772220182957835384550972772092654842082706142246481708409910183742375894996805693099913395071166112170527842473265346582564838421321907545834628201837626578791668861148755559537560386588395858682503 Nous obtenons notre P et notre Q que nous utiliserons pour créer la clé privé. Création de la clé privé , nous utilisons le programme get_priv_key.bin (disponible dans notre article sur le rsa , section cryptographie) ./get_priv_key.bin 10038779 29883735617826360432561196061799322808340273695402498944901762386799973751185111597928620872791168477109583526691323250438997481111127899766827469568139153506254222644429407380812644287968908031433014616849923750526494437675154793105999604698952545762191247000953460598590785791138083050034475111582139148840798690192144988714092767034962314220448082671869806890573676881128509669720752123515737259536455327561100082952775090354336935095177947890970881228947747737320060761022999750259487109176912351273565550144434404937703297435658507201458123798206776075248548238249711627044143395493501863997161361711457796649957 65537 > key_priv Genial on à recréé la clé privé. On déchiffre notre clé aes avec notre clé privé rsa. openssl rsautl -decrypt -in aes_key_cipher -out plaintext -inkey key_priv clé aes : rsa_hackerzvoice_for_win Il ne nous reste plus qu'a déchiffrer notre ciphermessage : cat ciphermessage| openssl enc -d -aes-256-cbc -nosalt -pass pass:rsa_hackerzvoice_for_win > flag Attention à bien àjouter l'option -nosalt sinon vous aurez des erreurs. ---------------------------------------------------------------------- hey dude! keep it up! https://www.youtube.com/watch?v=1F81S50xL8I btw, i think the flag for this chall should be: ndh2k16_cac4015707 freeman -----------------------------------------------------------------------