yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.57k stars 1.63k forks source link

Invalid section RVA #155

Open barnacleboy opened 9 years ago

barnacleboy commented 9 years ago

Hi!

I'm trying to confuse a mixed-mode assembly with ConfuserEx. When the output assembly gets written I'm getting the error "Invalid section RVA" - also when disabling all protections. What does this error message mean? The assembly is a .NET 3.5 standard C++/CLI mixed mode assembly that is signed with an Authenticode certificate. Are there any known issues or any known conditions when this error is raised?

Thank you in advance! P

yck1509 commented 9 years ago

Please try the latest version (commit f3987a14d9ecc48d2a35831042b043937f286705) and see if it fixes your problem.

barnacleboy commented 9 years ago

Thanks! The assembly gets written now. I will check its functionality asap...

barnacleboy commented 9 years ago

As mentioned before, the assembly gets confused, but somehow there are still some troubles...

When testing the functionality I've noticed that my program fails to load because I cannot apply an Authenticode certificate on the assembly. (I'm checking if my Authenticode certificate is applied on all assemblies when loading the program.)

After confusing, signcode.exe returns the following error message when trying to sign the obfuscated assembly: SignTool Error: SignedCode::Sign returned error: 0x800700C1 %1 is not a valid Win32 application

So seems the PE header is kind of damaged...

yck1509 commented 9 years ago

Please try the latest version (commit 47d420ceceedc04231a70ed3027026d18a6526d4) and see if it fixes your problem.

barnacleboy commented 9 years ago

Header is fine now. The file can be signed, but the native part of the DLL is still damaged with all protections turned off. The program crashes now right after entering the native dllmain as soon as I'm instantiating a COM library class. I'm using MessageBox calls to see how far the code proceeds until it crashes and the obfuscated version is showing an empty MessageBox without my set test message.

During obfuscation I'm getting an error now that the PDBs cannot be read as soon as I'm adding the native DLL. (Failed to read PDB: Segment != 1) This error occurs since the latest build.

I guess it's kind of hard to reproduce these issues, but I'm trying to compose a simple example asap...

yck1509 commented 9 years ago

You may want to try again using the latest source code, as many issues regarding mixed-mode modules are fixed now.

barnacleboy commented 9 years ago

Also not working with the new version. Seems the integrity of the file gets lost as soon as confusing it - I have disabled all protections. I hope I can deliver a small sample project that reproduces the issue, but I still cannot break the sample I have built a few weeks ago...