Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2015, 08:25
peterg70 peterg70 is offline
Friend
 
Join Date: Sep 2005
Posts: 30
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 7
Thanks Rcvd at 1 Time in 1 Post
peterg70 Reputation: 0
Patching file

Hey all

I have a program that is capable of detecting when i patch a DLL due to axprotect codemeter wrapper.

the file is also digitally signed.

When i searched around on internet I found a similar patch was done on the same file but it is not detected as modified.
When I compared the files I noticed 20 bytes has been modified.
If I attempt to change one of these new values the file is detected as modified again.

So somehow the cracker has managed to make the hash check for the DLL to pass by changing the 20 bytes.

Does anyone know of a program that calculates the old hash and then works out what is needed to make the patched dll pass the same hash

thanks
Reply With Quote
  #2  
Old 07-05-2015, 12:03
TechLord TechLord is offline
Banned User
 
Join Date: Mar 2005
Location: 10 Steps Ahead of You
Posts: 761
Rept. Given: 384
Rept. Rcvd 247 Times in 112 Posts
Thanks Given: 789
Thanks Rcvd at 2,022 Times in 571 Posts
TechLord Reputation: 200-299 TechLord Reputation: 200-299 TechLord Reputation: 200-299
If you can share the files with me, then I will take a look.
The CRC check function for Wibu Codemeter is there mainly in the same file itself and the wrapper code does it.
So generally, the CRC checking function(s) have to be patched, to avoid "failing" the check.
In case of the Wibu's OWN files, like WibuCm32.dll for example, the runtime also checks the digital signatures, as does the Kernel component of the Wibu Codemeter.
Depending on the version of the Codemeter/AxProtector used, the pointer to the CRC of the file is found at a particular location.
See this post and the attached screenshots.

http://forum.exetools.com/showpost.php?p=100098&postcount=21

So you should ensure that the CRC always either comes out to the "passing" value at runtime, OR patch the checking function.

USUALLY this will suffice.

If the RUNTIME etc is checking the digital signature then it's a wee bit more complicated.

I can only say after I actually see the file.
Reply With Quote
  #3  
Old 07-05-2015, 15:54
peterg70 peterg70 is offline
Friend
 
Join Date: Sep 2005
Posts: 30
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 7
Thanks Rcvd at 1 Time in 1 Post
peterg70 Reputation: 0
it would seem that axprotect has the capability of monitoring files outside the exe for modification.

Unwrapping and patching can be done on the exe but trying to avoid excessive work for no value.

So chasing patching the licensing DLL for flexlm. Patches work but software in exe detects the modification.

Like I said before someone else has managed to recalculate the hash by modifying 20 byte near the end of the file to make it not detect the modification.

What hashing of externallly protected files does axprotect have?
Reply With Quote
  #4  
Old 07-05-2015, 18:03
copyleft copyleft is offline
VIP
 
Join Date: Apr 2010
Posts: 172
Rept. Given: 180
Rept. Rcvd 43 Times in 39 Posts
Thanks Given: 142
Thanks Rcvd at 60 Times in 36 Posts
copyleft Reputation: 43
As you have access to an already patched signature in the file, you already know where the signature is located ...good luck
you could simply put memory breackpoint on signature location and find the calling algorithm(s). it might be easy to patch algorithm(s) or even recalculate it.
Reply With Quote
  #5  
Old 07-10-2015, 07:13
maktm maktm is offline
Friend
 
Join Date: Apr 2015
Posts: 23
Rept. Given: 0
Rept. Rcvd 4 Times in 2 Posts
Thanks Given: 8
Thanks Rcvd at 16 Times in 8 Posts
maktm Reputation: 4
If it detects whenever a byte is changed then it has a CRC check on the .text section of the file (or something similar). There are multiple ways of going around this, but most of them are complicated. Some methods are:

> Disabling checks completely by finding the functions that check them (Stack tracing comes to mind)
> Finding the stored value for the CRC and then modifying it the exact value required, after the bytes are changed.

All these are pretty difficult but one other method you can do is to reroute control flow by setting breakpoints in the .data/.idata sections or causing exceptions anyhow then catching these exceptions in handlers (using winapi functions to set on top of chain) and then modifying what is required.


Best advice I have is to see how that other guy did it. Compare the two files (original and modified) to see the changes he made.

Hope something here helps
Reply With Quote
  #6  
Old 07-11-2015, 22:01
evlncrn8 evlncrn8 is offline
VIP
 
Join Date: Sep 2005
Posts: 179
Rept. Given: 36
Rept. Rcvd 54 Times in 24 Posts
Thanks Given: 49
Thanks Rcvd at 117 Times in 69 Posts
evlncrn8 Reputation: 54
im guessing a lot has changed in 10 years, has reversing stopped?
Reply With Quote
  #7  
Old 07-12-2015, 17:40
peterg70 peterg70 is offline
Friend
 
Join Date: Sep 2005
Posts: 30
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 7
Thanks Rcvd at 1 Time in 1 Post
peterg70 Reputation: 0
reversing hasn't stopped.

Just with encryption layers and self modifying code a simple task 10 years ago is no longer routine. Programmers can create a messy code as this is the current acceptable norm.

So why go through days of decompile/reversing when there are other ways to solve the problem.

Back on topic
The patch is straight forward in external dll. The main exe is axprotected. Techlord has done extensive work on it. I don't want to decompile exe/patch as this would need to be done to many exe. So attacking the dll which is common is easier.

What i asked was there a tool that can get the same CRC value after patching as before by adjusting some bytes in the file.


Quote:
Originally Posted by evlncrn8 View Post
im guessing a lot has changed in 10 years, has reversing stopped?
Reply With Quote
  #8  
Old 07-12-2015, 19:57
rasta rasta is offline
Friend
 
Join Date: Oct 2013
Posts: 48
Rept. Given: 16
Rept. Rcvd 7 Times in 6 Posts
Thanks Given: 16
Thanks Rcvd at 20 Times in 16 Posts
rasta Reputation: 7
There is a tool for peid to change crc to a given value. However algos for crc can be modified a bit, so it could be useless (due to different CRC algo).
Reply With Quote
The Following User Says Thank You to rasta For This Useful Post:
zeuscane (09-12-2015)
  #9  
Old 09-12-2015, 06:06
psgama psgama is offline
Friend
 
Join Date: Jul 2014
Posts: 100
Rept. Given: 0
Rept. Rcvd 6 Times in 6 Posts
Thanks Given: 12
Thanks Rcvd at 75 Times in 44 Posts
psgama Reputation: 6
Hey Peterg, how goes the battle with the DLL? Make any headway? Or are you still stripping the Wibu protection from everything?
Reply With Quote
  #10  
Old 09-24-2015, 13:56
kronous
 
Posts: n/a
I have same problem
Most of expert use loader to by pass the same.
I am not expert that.
Pls. if Any one explain clue how to make it....
Reply With Quote
  #11  
Old 09-24-2015, 15:21
Notmex Notmex is offline
Friend
 
Join Date: Nov 2013
Posts: 27
Rept. Given: 16
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 4
Thanks Rcvd at 1 Time in 1 Post
Notmex Reputation: 0
Why dont you guys try to use a DLL with a Vectored Exception handler? This would not modify the code or trigger any CRC mechanism. You could use hardware breakpoints or PAGE flags to catch the exceptions and work your modifications out from there.
Reply With Quote
  #12  
Old 11-25-2015, 13:24
Mpower04 Mpower04 is offline
Friend
 
Join Date: Dec 2013
Posts: 19
Rept. Given: 0
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 6
Thanks Rcvd at 2 Times in 2 Posts
Mpower04 Reputation: 1
Hi Notmex-

Can you explain what a Vectored Exception handler is or point me in the direction of a good tut? I'm working on a few FlexLM (11.9 - 11.13) targets and I want to learn as much as possible.

Thanks!
Reply With Quote
  #13  
Old 11-25-2015, 13:26
Mpower04 Mpower04 is offline
Friend
 
Join Date: Dec 2013
Posts: 19
Rept. Given: 0
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 6
Thanks Rcvd at 2 Times in 2 Posts
Mpower04 Reputation: 1
Hi Peterg-

Any updates? Have you been successful or made progress? I'm having the same issue at the moment.....
Reply With Quote
  #14  
Old 11-30-2015, 10:41
psgama psgama is offline
Friend
 
Join Date: Jul 2014
Posts: 100
Rept. Given: 0
Rept. Rcvd 6 Times in 6 Posts
Thanks Given: 12
Thanks Rcvd at 75 Times in 44 Posts
psgama Reputation: 6
I'm assuming some progress was made by someone, as there is a file floating around for the specific protection he is referring to patched to pass checksum from what I gather. Haven't really looked into it other than what I've seen on the boards, as I have no need and am licensed for work anyway. This may be the original file he was referencing

3.60.0.117

Patch 1) 000E1E77 From FF 95 84 FE FF FF TO B8 00 00 00 00 90
Patch 2) 0011D037 From FF 95 84 FE FF FF TO B8 00 00 00 00 90
Patch 3) 001C6085
From > B3 D6 E0 0E D7 C3 88 80 CD 18 BC F7 9B C7 23 CE 50 E4 A9 09
TO > 93 27 36 4D C9 88 DE 9D 2B BF E6 67 67 28 DE 03 06 5E 3B A5

Last edited by psgama; 11-30-2015 at 10:50.
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
Media Descriptor File (MDF/MDS) file format NimDa2k General Discussion 0 03-22-2009 16:49


All times are GMT +8. The time now is 13:18.


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