|
ARTeam Tutorial Visit:
http://cracking.accessroot.com
|
http://forum.accessroot.com Solving a problem of Eudora on receiving mail with .ems attachments with viruses. |
| Information | A little tutorial which shows how to solve some problems of the applications through ASM.. |
| Target | Qualcomm Eudora 6.2 |
| Available | http://www.eudora.com |
| Tools | OllyDbg 1.10, ToPo 1.2 Fixed, Heavenstools Resource Tuner |
| Protection | -- |
| level | Beginner |
| Category | Fixing |
| Author(s) | Shub-Nigurrath Nov 2004 |
| Requirements | Windows XP, IE 5.5 and above for best viewing |
|
1. Introduction
|
|
Hi all today's target is Eudora 6.2. The purpose of this
tutorial is not to crack the program indeed but to fix a
little bug it has. It's not a common bug and doesn't
happens to most of the people, but when happens it's
gonna happens each
time and quite frequently. So I thought a solution and then wrote this
tutorial, a simple coockie-tutorial.
Even if you don't use Eudora or you never have had this particular bug I think the tutorial will be interesting because we'll discuss some general issues, so don't close it just now ^__^ During this tutorial I'll explain which is the bug, how it happens and how to solve with the instruments we have. The final result will be a patch of the program which will solve this erroneous behaviour. There are three sections in the
remaining of this tutorial: |
|
2. Description of
the bug
|
|
The first step is to look to how the bug we have works. Each time I check mail with Eudora I receive several mails with viruses, which contains all the types of trojans and strange attachments. Fortunately I have an antivirus installed (McAfee), but particularly one of these attachments's type gives problems to Eudora (and only this one, you'll understand why just few lines below): all the emails with an .ems attachment with viruses inside make Eudora to open a dialog with this message:
The problem arises because McAfee deletes the attachment before Eudora can handle the mail message thus making the program confused for an apparently missing file. Effectively McAfee acts correctly because .ems files are handled by the email clients as parts of the messages thus opening ports for infections (malicious html code or scripts); this is also the reason why this bug happens only for .ems attachments. Anyway this bug is a little annoying because Eudora interrupts the automatic emails retrieving process to wait me for pressing the Ok button..and this might happens several times..grrr!
The solution would be to tell to Eudora developers about
the problem, but I didn't have pay for this program ;-)
or to solve on my own..obviously I chosen the second
one! |
|
3.
Studying the problem
|
|
The solution consists of two parts: The idea is to find the place where the dialog is shown, see how I can skip the visualization of the dialog and continue the mail checking process. First of all let's open OllyDbg and attach it to the Eudora process (which is alrady stopped with the dialogbox shown). Olly complains about the multithreading features of Eudora, well don't care and answer yes to its questions. Now the call stack of Eudora looks like the one below
Well, the program stopped at 0012D768 and the stack is quite clear: the application enters into the systems dlls calling the MFC42.#2514. if you like you can look at the code, but I directl ytell you that the interesting point where to look at is the one pointed by the arrow above, at 00434239. Then you land into this place: 0043421A |.
/75 04 JNZ SHORT Eudora.00434220 ;
this jmp if taken skips the error message So we can consider this call as something like following. ShowErrorDialog(char* message, 10F); now try to retrieve the actual parameters passed to this call. Olly's stack view already has all we need. First of all configure the Olly's stack view as following
now you are ready to analyze Eudora's application stack. You should know that the returning addresses of the subprocedures in ASm are placed into the stack, so you can rebuild the calling tree simply reading the stack. If you scroll a little down the stack's window you should see something like 0012D80C |00444EBC RETURN to Eudora.00444EBC from <JMP.&MFC42.#2514> Double click on it and you land at
0043423E,
which is the instruction right after the call
around which we are working! The most interesting thing there is: 0012D8DC
|0043423E RETURN to Eudora.0043423E from Eudora.00444E84 But what is 10F about? Well, the first idea is to check if it's a dialog resource...follow this idea. What we now have to understand is: "who uses this dialog?". We have two different possibilities and solutions:
Well, fire up a resource editor to find which is the dialog box which has been used by Eudora to show the dialog. I used Resource Tuner, but anyother is good too (e.g. Resource Hacker which is free). Resource Tuner reports that Eudora doesn't have any dialog inside, so the dialog resources must be on another file, a Dll loaded by Eudora. Among the Dlls which have been loaded (in Olly use ALT-E ot see the executable module list) we see one named Eudora32.dll .. sounds interesting, let's see if there's something useful inside. Resource Tuner reports this: dialog resource ID 271 which is equal to 10F..Bingo, this is what we saw in Olly.
Then try to reasum what we did till now: I found the correct dialog which is shown by Eudora, but the problem is that it's used to show any error message, thus will not be enough to skip the dialog, otherwise we wouldn't get any error at all. What we need indeed is a more clever skipping method which will skip the dialog only when the error message is about an .ems missing file.. What we would code in the next section can be described, using a pseudo-code, as following:
if
(message_to_be_shown contains ".ems") then more precisely the idea I had is to give to the ShowErrorDialog() we identified before, a non existent resourceID when the error message is about .ems files, otherwise give the correct resourceID (10F). The reasoning behind this conclusion is simple: the involved MFC APIs (you can browse the stack to see which are) simply do not do anything at all if the given resource isn't found in the application. So we can write the final patch we want to do as following.
if
(message_to_be_shown contains ".ems") then or better:
ShowErrorDialog(message, MyNewCall(message));
int
MyNewCall(char *message) { This last one will be the one we'll
implement! |
|
4.
Finding the right place and coding the solution
|
The steps of this part of the tutorial are:
1. Do a call because all the required things don't fit in place. We don't have space enough to do what we decided: we have to substitute the PUSH 10F with a proper call to my new subrotine (what I called in the other section MyNewCall).
First of all he problem is to find a place into the .code section of Eudora which enough free space (unused bytes) to fit our needs. Note: compilers usually do not pack tight the soubroutines one beside the other. Usually they insert a lot of padding unused bytes among subroutines (00 or 90), these bytes are used to allign the code and to make the linker process easier. These bytes are what we are going to use. 2. Find a free space in the .code section of Eudora big enough to fit the new call First of all we have to use a proper tool which will find the required space for us. I used ToPo 1.2 from MrCrimson, the version fixed by Ricardo Narvajo, which works on XP systems also (included with this tutorial).
Fire up ToPo and meanwhile Close Eudora Process, which is now nomore useful. ToPo requires Olly to close the process before opening. Follow the steps below, being the first picture how the program opens.
We now have and address where to code our call. 3. Write the call ... We now have and address where to code our call. Fire up again Olly and restart Eudora from beginning. 0043422D |> 8D85
F4FBFFFF LEA EAX,DWORD PTR SS:[EBP-40C] Our new call is instead the following one. 005FEDF8 /$ 55 PUSH
EBP
; save the stack pointer 005FEE1D |. 8039 65
CMP BYTE PTR DS:[ECX],65
; compare with 'e'
Some comments about what I did.
Now you can write all the modifications made to Eudora, save and then execute with Olly to see how the program works, remember to place a BP at 00434234 before. The stack of Eudora right after executing our routine is like the following EBP-41C >
000007D0
|
|
5. Conclusions
|
|
Lesson Learnt Still awake?!? As usual we try to summarize what we learnt during this tutorial..hope at least one of the points were new for you :) 1. play a little with program's resources and
windows' APIs |
|
6. Greetingz
|
|
[MAIN TEAM]
|