#1
|
|||
|
|||
How you inject codes?
Hi all
I write a small program that inject codes in other programs.Normally I have no problem with small codes(I will make a routine and write my codes in it in asm then inject it with coping routine codes in my target address). But what can I do if my injecting code is too big? For example,I want to inject an encryption algorithm into my target program, and I can't find its asm implementation... Is there any simpler way for this,except writing all of it in asm myself??? sincerely yours
__________________
I should look out my posts,or JMI gets mad on me! |
#2
|
|||
|
|||
I do it.
Write encryption algorithm with high level language, such as delphi, c++. Mark at the begining and end of algorithm. Compile the source. User TMG code rip to extract the asm code of algorithm with the help of your marker. With this technique, I get the asm source of AES 128bit. |
#3
|
|||
|
|||
you can make a dll with the algorithm then use your program to load it into the exe you are injecting, is an elegant way.
|
#4
|
|||
|
|||
Quote:
I myself want to work on AES-128! But the problem is that you can't do it always,because of relative address of S-Boxes and vaiables that used in that algorithm and rebuilding them is really awfull. Are you sure you done all of this for AES? AES has complicated implementation because of its references to S_Boxes... In addition,using dll is not suitable in most cases,because it can simulated easily if your states are limited. sincerely yours
__________________
I should look out my posts,or JMI gets mad on me! |
#5
|
|||
|
|||
Quote:
With the techniqe described above, I get the 128bit AES in asm. Now the limit is length of the crypt key you input and crypt data must <= 16 byte.(due to my lazy) You know, Cpu not know function, procedure, S_Boxes..., it just know dword, address. So S_Boxes is a relative address map of dword data for Cpu view and asm. |
#6
|
|||
|
|||
MS detours
the microsoft's tools maybe help you.
|
#7
|
|||
|
|||
The position independent code is the general solution. Your code shouldn't contain any relocations and imported function calls, such as OS API. Organizing code in the single section and avoiding global variables resolves the problem with relocations. If you need to make a call to OS API function you should allocate a structure in the target process and fill it in with pointers to API required or patch your code with these addresses.
|
#8
|
|||
|
|||
I know this.I always inject codes myself...
But my main reson was that is there any tool that for example can automatically abstract an exported function from a dll and completely correct its relocations to an brusted code or not? sincerely yours
__________________
I should look out my posts,or JMI gets mad on me! |
#9
|
|||
|
|||
I dont think a tool exists publicly but TMGRipper does do a nice job handling local vars and global vars, last time I used it.
-Lunar |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Possible to inject new menus into GUIs? | binarylaw | General Discussion | 8 | 03-06-2020 17:51 |
How to inject code into a process? | jonwil | General Discussion | 7 | 06-01-2005 23:23 |
Very Easy way to Inject a Dll | Rhodium | General Discussion | 9 | 10-28-2004 16:52 |