Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2005, 12:42
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
Question Writing to a running (in-use) executable file

There are some methods of writing to an in-use file like ForceDel but they can't write to a running executable file. Maybe some Ring-0 instructions can do this job ?!!!!!!!
Reply With Quote
  #2  
Old 11-12-2005, 14:21
willii
 
Posts: n/a
Writing to a file running is very danger. When system has lower memory. It may reload code from the file. If you modify the file. It may crash.
Reply With Quote
  #3  
Old 11-12-2005, 15:10
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
I know my job. Thanx 4 Your Advice.
Reply With Quote
  #4  
Old 11-12-2005, 23:25
Cigan
 
Posts: n/a
Windows XP SP2 don't block execute file. You may delete,write,and execute again him.
Reply With Quote
  #5  
Old 11-13-2005, 03:41
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
no this is not true. I'm using SP2.
Reply With Quote
  #6  
Old 11-13-2005, 19:39
Sten Sten is offline
Friend
 
Join Date: Jan 2002
Posts: 50
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 0 Times in 0 Posts
Sten Reputation: 0
omidgl, I think it would be too hard to write to the file being executed since the file is exclusively locked by windows for write access - it is nessesary for the memory manager be behave correctly.

There is a tool called Unlocker that can close exclusive file handles (it uses kernel mode driver internally). But Unlocker won't help you in this case - it say's it failed to find exclusive file handles for the process being executed.

The best you can do is to rename the executable (WinNT dosn't prevent this), then copy the file data back to the original file and modify the original file as you need.

Last edited by Sten; 11-13-2005 at 19:42.
Reply With Quote
  #7  
Old 11-13-2005, 19:56
heXer heXer is offline
Friend
 
Join Date: Aug 2005
Posts: 25
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 3
Thanks Rcvd at 1 Time in 1 Post
heXer Reputation: 0
How does ollydbg works when copy to executale and overwrite the old exe?
Reply With Quote
  #8  
Old 11-13-2005, 20:09
MaRKuS-DJM's Avatar
MaRKuS-DJM MaRKuS-DJM is offline
Cracker + Unpacker
 
Join Date: Aug 2003
Location: Virtual World / Network
Posts: 553
Rept. Given: 7
Rept. Rcvd 6 Times in 4 Posts
Thanks Given: 3
Thanks Rcvd at 16 Times in 10 Posts
MaRKuS-DJM Reputation: 6
@heXer
i don't know 100%, but to me it seems olly writes modifications back when closing / restarting the exe.
Reply With Quote
  #9  
Old 11-14-2005, 10:55
deroko's Avatar
deroko deroko is offline
cr4zyserb
 
Join Date: Nov 2005
Posts: 217
Rept. Given: 13
Rept. Rcvd 30 Times in 14 Posts
Thanks Given: 7
Thanks Rcvd at 33 Times in 16 Posts
deroko Reputation: 30
@heXer:
olly creates backup file at : 44d8f1 and moves specified exe to backup with movefilea which will delete running file and you can write to it's place whatever you want. Old trick I've been using long time ago.
Reply With Quote
  #10  
Old 11-14-2005, 14:55
goldenegg
 
Posts: n/a
Quote:
Originally Posted by heXer
How does ollydbg works when copy to executale and overwrite the old exe?
You can't use od to overwrite an existing running executable file.
od lets you save as a new one.
Reply With Quote
  #11  
Old 11-14-2005, 15:16
fly [CUG]'s Avatar
fly [CUG] fly [CUG] is offline
UpK
 
Join Date: Jul 2004
Location: һ������
Posts: 153
Rept. Given: 3
Rept. Rcvd 3 Times in 1 Post
Thanks Given: 5
Thanks Rcvd at 3 Times in 2 Posts
fly [CUG] Reputation: 3
@deroko:
You are right.It will create a bak file,the bak file is locked,and the old exe can be write freely by other program.But od itself can modify one time only.
@goldenegg :
I can use od to overwrite the exefile being debugged.
__________________

UpK

һ�����ꡭ����ƽ��!
http://www.unpack.cn
Reply With Quote
  #12  
Old 11-14-2005, 18:00
memo-5 memo-5 is offline
Friend
 
Join Date: Sep 2005
Posts: 80
Rept. Given: 15
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 60
Thanks Rcvd at 11 Times in 6 Posts
memo-5 Reputation: 3
The finall result and the answer is that it's not possible to overwrite a running exe, dll file because the system use the exe file pages instead of using the system page file.
Reply With Quote
  #13  
Old 11-14-2005, 21:29
heXer heXer is offline
Friend
 
Join Date: Aug 2005
Posts: 25
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 3
Thanks Rcvd at 1 Time in 1 Post
heXer Reputation: 0
My test app:
1. Run the running.exe.
2. Run the unlock_running.exe.
3. Modify running.exe use any editor.
4. Have you write to running.exe success?
Attached Files
File Type: rar running_test.rar (2.1 KB, 25 views)
Reply With Quote
  #14  
Old 11-15-2005, 00:02
Teerayoot Teerayoot is offline
Friend
 
Join Date: Mar 2004
Location: ประเทศไทย
Posts: 82
Rept. Given: 0
Rept. Rcvd 3 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 16 Times in 8 Posts
Teerayoot Reputation: 3
@heXer

your attachment .
Threat detected by nod32.

Win32/PSW.Legendmir.SY trojan
but i see any harmfull to my computer


Quote:
4. Have you write to running.exe success?
After runn unlock_running.exe
i can write to running.exe.
Reply With Quote
  #15  
Old 11-15-2005, 00:16
Git's Avatar
Git Git is offline
Old Git
 
Join Date: Mar 2002
Location: Torino
Posts: 1,115
Rept. Given: 220
Rept. Rcvd 265 Times in 157 Posts
Thanks Given: 108
Thanks Rcvd at 216 Times in 124 Posts
Git Reputation: 200-299 Git Reputation: 200-299 Git Reputation: 200-299
Don't forget cache implications...

Git
Reply With Quote
Reply


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
Running program from memory Spiyre General Discussion 6 09-18-2004 09:34
Need to find a pattern in a running file merlin General Discussion 14 07-20-2002 06:59


All times are GMT +8. The time now is 05:46.


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