Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 09-28-2005, 20:05
Hero Hero is offline
VIP
 
Join Date: Jan 2005
Posts: 224
Rept. Given: 2
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 4
Thanks Rcvd at 2 Times in 2 Posts
Hero Reputation: 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!
Reply With Quote
  #2  
Old 09-28-2005, 20:26
xixiaolou
 
Posts: n/a
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.
Reply With Quote
  #3  
Old 09-28-2005, 23:02
pluscontrol
 
Posts: n/a
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.
Reply With Quote
  #4  
Old 09-28-2005, 23:23
Hero Hero is offline
VIP
 
Join Date: Jan 2005
Posts: 224
Rept. Given: 2
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 4
Thanks Rcvd at 2 Times in 2 Posts
Hero Reputation: 1
Quote:
Originally Posted by xixiaolou
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.
Hi
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!
Reply With Quote
  #5  
Old 09-29-2005, 07:37
xixiaolou
 
Posts: n/a
Quote:
Originally Posted by Hero
Hi
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...
I use delphi. The origin delphi source of AES is from http://www.secureblackbox.com, named elaes.pas. You can google it.

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.
Reply With Quote
  #6  
Old 09-29-2005, 12:22
shoooo shoooo is offline
Friend
 
Join Date: Apr 2005
Posts: 49
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 0 Times in 0 Posts
shoooo Reputation: 0
MS detours

the microsoft's tools maybe help you.
Reply With Quote
  #7  
Old 10-10-2005, 18:01
eugene_i
 
Posts: n/a
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.
Reply With Quote
  #8  
Old 10-10-2005, 19:52
Hero Hero is offline
VIP
 
Join Date: Jan 2005
Posts: 224
Rept. Given: 2
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 4
Thanks Rcvd at 2 Times in 2 Posts
Hero Reputation: 1
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!
Reply With Quote
  #9  
Old 10-10-2005, 20:11
Lunar_Dust
 
Posts: n/a
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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


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


All times are GMT +8. The time now is 16:20.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )