Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2006, 15:59
5Alive 5Alive is offline
Friend
 
Join Date: Aug 2003
Posts: 82
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 1
Thanks Rcvd at 1 Time in 1 Post
5Alive Reputation: 0
Merging Imports with Exports?

I have a DLL file I wish to unpack, I have a working unpacked file "found in the wild" which I am using for comparison.

I dumped a DLL at OEP using LordPE and correctly restored the imports with ImpREC. I then wiped the packers section header to leave the the usual sections:

.text, .rdata, .data, .reloc, .rsrc.

Of course the restored imports are in the section .mackt, what I'd like to know is how do I merge/join the .mackt section with the .rdata section?

I haven't seen any mention of this in any of the RCE forums or tutorials.

Thanks,
5aLIVe.
Reply With Quote
  #2  
Old 07-31-2006, 16:17
MarkusO
 
Posts: n/a
You can't really "join" the .rdata and the .mackt section, since there are other sections between them. It also doesn't have any disadvantage in functionality if you have a .mackt section.

The easiest solution would be to find some free space in the .rdata section, disable "add new section" in ImpREC and recover the imports again, but this time with the address of the free space you found in .rdata.

Or you need to manually move the data from .mackt to the location you want it and adjust all offsets.
Reply With Quote
  #3  
Old 07-31-2006, 17:32
Jay Jay is offline
VIP
 
Join Date: Feb 2002
Posts: 249
Rept. Given: 31
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 15
Thanks Rcvd at 13 Times in 5 Posts
Jay Reputation: 3
iirc with revirgin you can specify the iat address if you don't select auto fix, decide where you want to put it, save it then paste it into your dump.
Reply With Quote
  #4  
Old 07-31-2006, 21:37
Human
 
Posts: n/a
with imprec he can do the same, untick add new section for iat and then specify addres
Reply With Quote
  #5  
Old 07-31-2006, 21:56
5Alive 5Alive is offline
Friend
 
Join Date: Aug 2003
Posts: 82
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 1
Thanks Rcvd at 1 Time in 1 Post
5Alive Reputation: 0
Thanks for the replies guys. I did notice the check box for adding a new section but wasn't clear on how to use it. My dumped DLL works with the .mackt section in place. I'd just like to try and have imports and exports in the one section. I had a look at ReVirgin but I didn't care for the user interface.

The unpacked DLL I found has the import table at RVA 64564,size B4 and the export Table at 65BC0, size 4E. Whereas the file I dumped and fixed has the export table at 65ADO and the Import Table at 153D0.

I also see that Vsize of the original .radta section has been increased from FB1E to 10000, which borderss the start RVA of the .data section at 66000.
Presumably this increase is to allocate the needed space for IAT and EAT tables?

What I don't yet understand is why these particular export and import tables RVAs were chosen? Is it common practice copy and paste these tables and then adjust the RVAs accordingly? I thought this process would have been more "automated" if you see what I mean.

I'm probably thinking this is much more difficult than it actually is, and I'm maybe overlooking something simple.

Oh and what do you to find a suitable "cave" for the IAT? I tried dumping the .rdata section (Vsize was increased to 10000) and opened it in Hex Workshop expecting to see sufficient free space towards the end of the file(there wasn't room).

Many thanks,
5aLIVE.

Last edited by 5Alive; 07-31-2006 at 22:08.
Reply With Quote
  #6  
Old 08-01-2006, 18:45
MarkusO
 
Posts: n/a
The reason for the bigger size of the dump is simple. If the file is on your HDD, a section can have a physical size of 0x4A00 and a virtual size of 0x9000.

When the section is loaded into memory, the dumper only knows the virtual size and dumps the full 0x9000 bytes. The dumper doesn't know if the 0x4A00 bytes contained compressed data or not, so it cannot use the physical size for dumping.

Of course you can set the physical size to 0x4A00 again after you have verified that only 0x4A00 bytes are really used and the other 0x4600 bytes are unused.
Reply With Quote
  #7  
Old 08-01-2006, 22:39
Human
 
Posts: n/a
well to it does someone knows any pe editor or optimizer that can optimize file size, after dump analyze every section, detect empty space filled with zeroes and strip it and just leave raw size as it should be and virtualsize to whole size before, because when we have for example .data? section its size can be 16mb but in compiled exe its 0 due its all allocated but in dump we have 16mb, because no dumper optimizes that
Reply With Quote
  #8  
Old 08-02-2006, 15:55
5Alive 5Alive is offline
Friend
 
Join Date: Aug 2003
Posts: 82
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 1
Thanks Rcvd at 1 Time in 1 Post
5Alive Reputation: 0
Thankyou for your replies gents. I've feel I learned something here, although its become clear that I need to read more on the portable executable specification and experiment with the tools to further my understanding if I am to become a better reverser.

5aLIVE
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
Scylla x64/x86 Imports Reconstruction Killboy Community Tools 89 06-03-2022 08:49
KERNEL32 imports in IDA Pro pez General Discussion 9 08-27-2004 05:10
What Exports do i include in Wineice.dat for Win 2000?.. bunion General Discussion 2 08-22-2003 19:07
armkiller imports Akki General Discussion 1 12-30-2002 17:33


All times are GMT +8. The time now is 10:35.


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