Solved

Changing image in an executable

Posted on 2003-11-02
11
202 Views
Last Modified: 2010-04-14
Hi,

i'm trying to change a JPEG image that is in a compiled program. The program was compiled using Delphi . I don't know which exact version.

I've tried to make my own application, and change the picture in it using Resource Hacker. I have succeeded in doing so, by making another application with a picture, and coping the binary data from one to another.

I didn't succeed with this application. Perhaps I should use the same version of the compiler that was used to compile the original program? Or is there a tool to simplify all of this?

I have chosen the maximum of the points I can give for an answer.


Thank you,
Jaka "|SNap|" Jančar,
Slovenia
0
Comment
Question by:SNap
11 Comments
 
LVL 44

Expert Comment

by:CrazyOne
ID: 9667028
I have used this by itself to change an immage in a exe or dll file

You need to use a tool like this in conjunction with a tool for developing the images.

Resource Hacker
http://www.users.on.net/johnson/resourcehacker/
0
 
LVL 3

Expert Comment

by:dschwartzer
ID: 9669891
As far as I know, jpeg pictures cannot be stored inside the exe/dll. BMP pictures, icons, dialog boxes, string lists, shortcuts can.
Anyway I've always done similar things with MS Visual studio 5/6.
Open file -> select the exe -> select the "open as" - resource and open.

Make sure you store the backup of that exe
0
 

Author Comment

by:SNap
ID: 9670737
CrazyOne: I have written in my question, that i have used Resource Hacker, and it didn't work. Probably because delphi "encodes" the images in a different way on different versions.

dschwartzer: They _CAN_ be.
0
 
LVL 13

Expert Comment

by:Gnart
ID: 9671359
You probably ran into a software where as the developer wanted to ensure that their image is protected from being overlaid by another image.  They do this by hashing the image or crc the image and then stored the value in the data section (mangled if needed).  Then at launch time, the software would hash or crc the image and compare the value, if it's different then they exited the program.

You did everything correctly in terms of using Resource Hacker to replace the object.  This embedding is standard for Windows resource for storing (Windows expect to locate the resource at specific places) and is independent of delphi.

To hack it you should try a good debugger and trace the code object - find the hash alogrithm, the hash value, and the storage location of the hash value; and Then hash your image through the same alogrithm (you can embed your image and let the program hash it - and get the hash value) then change the hash value stored in the program.  

Cracking software or ill-use is illegal.

cheers
0
 

Author Comment

by:SNap
ID: 9672864
I could change some other picture in the program, so I also found this two options:
1) I can change BMPs but not JPEGs because of different size/encoding/whatever
2) a checksum, like you said

So i'll try to change the image with some other versions of Delphi, if that might be a problem.

The odd thing is that when I launch a program with the changed JPEG image, it doesn't crash or anything, but just closes instantly. That's a pretty good indication of a CRC.

Anyway, if it's a checksum I would definitely need more precise instructions how to achieve that.

Unfortunately, I can't post the program somewhere online, but I ensure you that what i'm doing isn't illegal.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 13

Expert Comment

by:Gnart
ID: 9674195
If the program shuts down instead of crashes, it's an indication that the author is checking to make sure that it had NOT been modified by someone - perhaps to attach a trojan on the software.  You are right about swapping the BMP/JPG - it's because of different format and different rendering of the image.  The function that was called - handle only specific format.  So, you will have to stick the specific file type.

You will need to put it through debug and spend time (may be a lot of time) on getting to the hash signature's location in order to change it.  I am sure that if the author went through the process of securing his/her work from being cracked and a trojan/virus/worm inserted into the program.  It will be difficult but not impossible to get to it.

Since it's code dependent - I am sure that no one here would have the time to trace the code in order to tell you how to insert and patch the hash signature.

The question is, is it worth the time to do what you want to do?   Send the author a message to see what he/she did and if it's possible for you to obtain the direction on inserting your own graphic and hash signature.

cheers
0
 

Author Comment

by:SNap
ID: 9680093
I unfortunately can't contact the author.

Any advice on how to start debugging?
0
 
LVL 13

Accepted Solution

by:
Gnart earned 500 total points
ID: 9690332
Yeah, get a debugger such as softIce and load the program in to debug.  Use the tools that came with your debugger to analyze the code to see what it's doing and what functions it is calling.  It would be easier if you have the source code.  Without the source code, it requires a lot of knowledge in order debugg and understand what it is doing.

Once you have it loaded, set up the address location of the image as the stop point.  What you want for it to do is to stop executing when the image is reference...... from there you will trace the instruction execution - one instruction at a time and see what it is doing.......examine and look for hash calculation of any sort.... and modify the instruction logic to force the program to continue execution instead of exiting or quitting.  Hope you have time....

debug in windows won't do this job but I will use it to give you a quick example.  I presume that you are running windows 2000.  

Start, run, type in cmd and press enter.
change directory to c:\winnt\system32.  use dir to see if cmd.exe is there.
type debug cmd.exe and press enter... you are now in debugging mode to debug the program cmd.exe
type ? and press enter - debug will list the commands
type r and press enter - to display the registers
type t and press enter - to execute one instruction at a time

As you can see it takes a lot of time - and a good understanding of assembly to go through the logic.  A good debugger would be much quicker than using debug.  But you get the idea.

type q and press enter - to quit debugging

Sorry, but the lesson on debug - cracking a program would be beyond the scope of thread conversation as it is very complex and will take lots of time.... I hope I get you started on your way cracking this program, which is what you are doing....

cheers

0
 
LVL 13

Expert Comment

by:Gnart
ID: 9859129
May be the author is still debugging the code to get to the hash signature...<G>  It's the only way to crack a program.....

cheers
0
 

Author Comment

by:SNap
ID: 9859487
Actually, i have accomplished what i wanted with a much simpler trick. But Gnart obviously put a lot of effort into explaining debugging to me, so he deserves the points.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now