PDA

View Full Version : simple rsa


Donan
February 10th, 2004, 23:05
Hi all! I was looking for a way to learn cripto, speacially RSA and found this crackme. I think its impossible to be more simple. But I have a few (lots) questions... First its TSCube RSA-24 crackme. Can be found at www.crackmes.de and some others site, just use google.
Ive also found a couple of tutorials, but none explain the crackme itself. Only RSA...

Code:

00402871 CALL 004137E8 ;"GetDlgItemTextA" API
00402876 LEA ECX,[ESP+24]
0040287A PUSH ECX
0040287B MOV ECX,EBX
0040287D CALL 004029B0 ;the RSA function!
00402882 TEST EAX,EAX ;check
00402884 JZ 00402912 ;teh jump


Tracing it the call....

Code:

004029CD |. 68 DC004200 PUSH crackme.004200DC ; ASCII "9901"
004029D2 |. 8D8C24 E400000>LEA ECX,DWORD PTR SS:[ESP+E4]
004029D9 |. E8 52E7FFFF CALL crackme.00401130
004029DE |. 68 D0004200 PUSH crackme.004200D0 ; ASCII "12790891"
004029E3 |. 8D4C24 1C LEA ECX,DWORD PTR SS:[ESP+1C]
004029E7 |. C78424 6406000>MOV DWORD PTR SS:[ESP+664],0
004029F2 |. E8 39E7FFFF CALL crackme.00401130
004029F7 |. 68 C8004200 PUSH crackme.004200C8 ; ASCII "8483678"
004029FC |. 8D8C24 7402000>LEA ECX,DWORD PTR SS:[ESP+274]
00402A03 |. C68424 6406000>MOV BYTE PTR SS:[ESP+664],1
00402A0B |. E8 20E7FFFF CALL crackme.00401130
00402A10 |. 68 C0004200 PUSH crackme.004200C0 ; ASCII "5666933"



I can see that 9901 is probably "e". All others numbers are harder to guess.
First question, whats CALL crackme.00401130? Its probably a bignum function but made me wonder at the beginning. The whole crypto stuff is done below and its quite easy to identify some calls such as 00402B1D CALL 00402310 ;RSA-Encrypt!

the rest I have just a little idea...

so how to identify the N and the messages?
Whats the best bignum lib for a beginner?

mike
February 11th, 2004, 00:22
Try http://www.alpertron.com.ar/ECM.HTM for a fast factoring program. That ought to make it clear which of the numbers is n!

ZaiRoN
February 11th, 2004, 06:04
Hi Donan,
this crackme has been discussed in an old thread inside the mini project area: http://www.woodmann.net/forum/showthread.php?t=3950
Maybe it helps you...

ZaiRoN

Donan
February 12th, 2004, 15:57
Hi Zairon and Mike! Thanks for the reply!

The other thread was good to understand what was going on...

Is there a way to find out wich cripto lib was used? Ive tried looking
at imports using IDA but had no luck... with this info I could compile an example and compare it to the program...

anyone got any hints?!

thanks

dONAN

ZaiRoN
February 12th, 2004, 18:37
Hi Donan,
from readme file: "This was coded to test my Bignum library"

ciao,
ZaiRoN