Professional Documents
Culture Documents
Many times we have heard that IDA is a better disassembler than Wdasm, and that it is
the best disassembler that exists which is correct, and in spite of not using it frequently,
we will see in this first example some tips for IDA, and some differences with the
listing it shows us in OLLY and in Wdasm.
To practice, we will use a typical example where we note the differences in a crackme
made in VC++ or that is to say level 1 from contest 34. (Attached to this tute)
We open it with WDASM, and we see the names of the imported functions that it shows
us.
Something odd with the name and little information, almost all of them are numbers,
which doesnt permit us to deduce much about what each one is. In OLLY it is not very
different.
This doesnt help much. Now we load it in IDA, we use the new version 4.30 FULL
that is on my FTP, once it is up we go to OPEN FILE we select the file and in the
options window we never forget to put the check on LOAD RESOURCES.
I suppose that it isnt the same to know that the function is DoMessageBoxA which is
#2512, so all the names have a name that tells us what the function does.
If we go to 402010 in OLLY we see that the listing is incomprehensible and it does not
clarify if it is a part of the data or of the code.
In IDA on the same position:
Not only is this part identified by data (idata) at the beginning, it also tells us they are
imported functions from MFC42.dll (IMPORTS from MFC42.dll)
The Strings in IDA are found by going to the tab STRINGS. They are seen here:
Going to the STRINGS window it gives us much more than the sad four that it shows us
in WDASM .
Also, if in the STRINGS window of IDA we make a right click and go to Refresh (or
Setup) there are options that permit us to obtain more STRINGS
We uncheck STRICT ASCII strings, and add in ALLOWED string types the types of
strings that we want to look for: C and UNICODE are the classics as shown in the
image.
IDA shows us on 401628 the jump: Jmp [402010] that takes us directly to the Function
DoMessageBox according to the reference from the import table that we saw before.
Well there are a lot of imported functions with numbers but it does not say much. Now
we see in IDA:
.text:00401B10
.text:00401B10 ; S U B R O U T I N E
.text:00401B10
.text:00401B10
.text:00401B10 sub_401B10 proc near ; DATA XREF: .rdata:00402580o
.text:00401B10 mov ecx, [ebp-10h]
.text:00401B13 jmp ??1CDialog@@UAE@XZ ; CDialog::~CDialog(void)
.text:00401B13 sub_401B10 endp
.text:00401B13
.text:00401B18
.text:00401B18 ; S U B R O U T I N E
.text:00401B18
.text:00401B18
.text:00401B18 sub_401B18 proc near ; DATA XREF: .rdata:00402580o
.text:00401B18 mov ecx, [ebp-10h]
.text:00401B1B add ecx, 60h
.text:00401B1E jmp ??1CEdit@@UAE@XZ ; CEdit::~CEdit(void)
.text:00401B1E sub_401B18 endp
.text:00401B1E
.text:00401B23
.text:00401B23 ; S U B R O U T I N E
.text:00401B23
.text:00401B23
.text:00401B23 sub_401B23 proc near ; DATA XREF: .rdata:00402580o
.text:00401B23 mov ecx, [ebp-10h]
.text:00401B26 add ecx, 0A0h
.text:00401B2C jmp ??1CEdit@@UAE@XZ ; CEdit::~CEdit(void)
.text:00401B2C sub_401B23 endp
.text:00401B2C
.text:00401B31
.text:00401B31 ; S U B R O U T I N E
.text:00401B31
.text:00401B31
.text:00401B31 sub_401B31 proc near ; DATA XREF: .rdata:00402580o
.text:00401B31 mov ecx, [ebp-10h]
.text:00401B34 add ecx, 0E0h
.text:00401B3A jmp ??1CString@@QAE@XZ ; CString::~CString(void)
.text:00401B3A sub_401B31 endp
.text:00401B3A
.text:00401B3F
.text:00401B3F ; S U B R O U T I N E
.text:00401B3F
.text:00401B3F
.text:00401B3F sub_401B3F proc near ; DATA XREF: .rdata:00402580o
.text:00401B3F mov ecx, [ebp-10h]
.text:00401B42 add ecx, 0E4h
.text:00401B48 jmp ??1CString@@QAE@XZ ; CString::~CString(void)
.text:00401B48 sub_401B3F endp
.text:00401B48
.text:00401B4D ; ---------------------------------------------------------------------------
.text:00401B4D
.text:00401B4D loc_401B4D: ; DATA XREF: sub_401210+2o
.text:00401B4D mov eax, offset stru_402580
.text:00401B52 jmp loc_40188E
.text:00401B52 ; ---------------------------------------------------------------------------
As we see the subroutines are separated, the names of the functions are there, some we
dont know but having the name, we can find them quickly by doing a search in google
for the name of the function (Cedit,Cdialog,CString)
We see to the right the arrows that indicate where it is jumping but there are more if we
put the pointer of the mouse on _40198A Below the listing, the area it is jumping to
appears without having to go there.
By passing the mouse over many parts of the listing; without doing anything, it shows
us explanations of the code.
align 10h
.text:004018A0 public start
.text:004018A0 start db 55h ; U
.text:004018A1 db 8Bh ;
.text:004018A2 db 0ECh ;
.text:004018A3 db 6Ah ; j
.text:004018A4 db 0FFh ;
.text:004018A5 db 68h ; h
.text:004018A6 db 0E8h ;
.text:004018A7 db 24h ; $
.text:004018A8 db 40h ; @
.text:004018A9 db 0 ;
.text:004018AA db 68h ; h
.text:004018AB db 26h ; &
.text:004018AC db 1Ah ;
.text:004018AD db 40h ; @
.text:004018AE db 0 ;
.text:004018AF db 64h ; d
.text:004018B0 db 0A1h ;
.text:004018B1 db 0 ;
.text:004018B2 db 0 ;
.text:004018B3 db 0 ;
.text:004018B4 db 0 ;
Well I made this to see the inverse case when in a program, we have an undefined area,
we select it and make a right click and select ANALYZE SELECTED AREA (or hit the
C key) and it gives a window to analyze or force that this section is code. Well here
there isnt much to force. Only with analyze it returns to what it was.
The famous Xrefererences are references to a part of the listing from another aspect. If
we see in some part of the listing:
That means that there is a reference to this point from other places in the listing. Also,
putting the mouse pointer on the XREF it shows us the code from which this part is
being called.
Well I believe this first approach to IDA is sufficient, of course this is only 1 percent of
the possibilities that you have but for beginning to handle it, it will do.
Ricardo Narvaja