![]() |
advise on .net executable
I have some experience in win32/native RCE but .net is completely new to me. I have a target .net executable that is obfuscated with Smart Assembly. I have tried DeSmart (1.0.0.9) and it appears to de-obfuscate (the result is readable in reflector.net). However the executable crashes on startup.
The target seems to be produced in vb.net. Any advice or tips on how to proceed is welcome, I could provide the target exe if needed (by PM please). |
Can you give us a link to the target?
|
I put the file on rapidshare and SendSpace (pwd in pm), thanks!
|
The file won't run because you only sent me the dlls and not the installer, but if you open the app in cff explorer, go to the methods section under Tables. Go to method 9290, and that is the entrypoint method. I'm not sure if there's some kind of login form or something, because again I can't load the program, but if there is you could probably patch this method to load the mainform instead.
This is the method: Code:
L_00000000: call 0x06000005 |
I think the problem lies here:
Code:
unit Namespace_01; Code:
function LandBase.ToString: string; |
Quote:
|
You are right, using public key token to decode parts of code/resources/strings is very popular method these days.. .NET Reactor does the same.
Easiest solution is to modify your function Class_01.Method_00() to use hardcoded decryption key instead of public key token. |
Quote:
Code:
[System.Reflection.Assembly]::LoadFile('target.exe').GetName().GetPublicKeyToken() |
OK, I read the code again and the Public Key Token can be null (which it is). I also checked GetManifestResourceStream(executingAssembly.Manife stModule.ModuleVersionId.ToString('B')) and the result is
Code:
{2602d3bb-5287-4d6f-9a35-61240bcf8c57} How to get the value of this: MethodBase.GetCurrentMethod.MetadataToken ? |
PublicKeyToken should be null only if assembly is not signed by strong name key. Are you sure about that? Check the original file, not the one produced by DeSmart.
GetCurrentMethod.MetadataToken is an identifier of the current method, in your case identifier of Class_01.Method_00(). I would use ILDASM and other Microsoft tools for all those tasks. It takes some time to get used to it's output but it's really powerful. It's possible that other tools (for example, Reflector) show method tokens as well, but I'm not sure about that.. Showing strong name token of an assembly (sn.exe is part of Microsoft.NET SDK): Code:
C:\>sn -T test.exe Code:
.method /*060049B8*/ privatescope hidebysig static void '3wW1VNpxI$PST060049B8'() cil managed noinlining |
I tried sn already it reports: target.exe does not represent a strongly named assembly
ILDasm doesn't work on the original exe, it reports Protected module -- cannot disassemble. Maybe I can set a breakpoint and inspect the value? Can you recommend a debugger for this? |
Using debugger I watched the result and it is 0x00000005 so I inserted opcode ldc.i4.5.
Using reflector the code is now: Code:
public static string Method_00(int num1) |
For SmartAss'd targets, I usually use a loader. You can use a loader to modify the method while it's in memory. Just use CFF Explorer to get the Virtual Offset of the opcode that you want to patch, and patch it in memory. If you don't want to make your own loader you can use DUP to create one for you.
Modifying the method in memory bypasses all of those checks that SmartAssembly makes to the methods/exe. |
All times are GMT -4. The time now is 06:57 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.