527

Obfuscation is one way, but it can't protect from breaking the piracy protection security of the application. How do I make sure that the application is not tampered with, and how do I make sure that the registration mechanism can't be reverse engineered?

Also it is possible to convert a C# application to native code, and Xenocode is too costly.

C# provides lot of features, and is the ideal language for my code, so writing the whole codebase again in C++ is out of the question.

Secure certificates can be easily removed from the signed assemblies in .NET.

5
  • @Andreas: This is awesome!! I'm going give a try. Anyone using it? Commented Apr 5, 2015 at 17:32
  • 1
    @Jack it's for window store apps only. There is no timeline for desktop apps(as far as I can tell). Commented Dec 27, 2015 at 5:26
  • If you want native without archaic C++, use Delphi. The ease of .Net came from Delphi anyways. Commented Jan 4, 2017 at 16:09
  • stackoverflow.com/questions/25133111/xamarin-code-security/… solved! Commented Jun 24, 2019 at 20:41
  • Looks like native forever and no needs in obfuscators; Looks like net core RT workable solutions; soon all apps will go to .net core; codeproject.com/Articles/5262251/… learn.microsoft.com/en-us/archive/msdn-magazine/2018/november/… not tested maybe with old win .net sdk possible do similar. PLS wote my answer to go it up; looks like native compile better any free obfuscators or any other options; Commented Oct 4, 2020 at 14:43

38 Answers 38

1
2
2

I can recommend using Obfuscator.

Sign up to request clarification or add additional context in comments.

Comments

2

I also made some considerataions regarding hacking security in my design and wanna add them as some of them seem not to be mentioned:

I have a scripting interface in my application. To ensure, Scripts can only call methods which are intended to be called by (python)-scripts i have a scriptvisibilityattribute and System.Dynamic.DynamicMetaObjectProvider which recognizes these attributes.

Licenses use public/private key.

ViewModels need to be unlocked giving a password to a unlock function.

CoreRoutines may be implemented on a dongle. (There are dongles around which support that)

Big solution like wrappers was not planned.

Of course this scripting/viewModel apporach doesnt make it impossible to unlock and call script-nonvisible functions from the code but it makes it a bit more difficult doing so - like with all that's related to anti-hacking-efforts.

Comments

1

Yes, .NET binaries (EXE and DLL) can be easily decompiled to nearly source code. Check the tool .NET Reflector. Just try it against any .NET binary file. The best option is to obfuscate files, they still can be decompiled by .NET Reflector, but they create an unreadable mess. I don't think that good obfuscators would be free or cheap. The one is Dotfuscator Community Edition that comes with Visual Studio.

2 Comments

Redgate appears to have an obfuscator as well. I haven't used it, but I have liked some of their other tools. It's certainly not free though. See red-gate.com/products/smartassembly/index.htm
Is Dotfuscator community edition at par with other obfuscator? I checked this comparision msdn.microsoft.com/en-us/library/ms227240(VS.80).aspx, however, most of the functionalities un-checked for the community edition, I didnt really understand whether they wuld be necessary!
1

The best answer is the first one from the small developer speaking from his own expierence, all the anti-reversing techniques discussed above are 101 textbook cases for any serious reverse-engineer.

Some commercial DRM solutions are pretty decent, but they crack every triple AAA game with custom DRM solutions all the time within hours (or days). Only the introduction of a completely new DRM solution - sometimes - delays in inevitable for perhaps a couple of weeks.

Getting the most out of the DRM costs a lot of time & money and can easily hurt performance, reliability, compatibility/portability and customer-relations in general. Either stick with some decent commercial DRM without trying to be too smart about and take your (less) losses or just forget about it totally ...

One example of a DRM solution which dug it's own (commercial) grave: http://en.wikipedia.org/wiki/StarForce

Comments

1

According bellow question in microsoft blog :

https://blogs.msdn.microsoft.com/amb/2011/05/27/how-to-prevent-ildasm-from-disassembling-my-net-code/

How can I prevent ILDASM from disassembling an assembly?

.NET has an attribute called SuppressIldasmAttribute which prevents disassembling the code. For example, consider the following code :

using System;
using System.Text;
using System.Runtime.CompilerServices;
[assembly: SuppressIldasmAttribute()]

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello world...");
        }
    }
}

As you can see, there are just two differences:

  1. We have added System.Runtime.CompilerServices namespace deceleration.

  2. We have added [assembly: SuppressIldasmAttribute()] attribute.

After building the application in Visual Studio, when we try to open the resulting EXE file in ILDASM, now we get the following message :

enter image description here

1 Comment

Reflectors may not use ILDASM. So it does not protect the code from reverse engineering.
1

Looks like native forever and no needs in obfuscators now; Looks like net core RT workable solutions; soon all apps will go to .net core; https://www.codeproject.com/Articles/5262251/Generate-Native-Executable-from-NET-Core-3-1-Proje?msg=5753507#xx5753507xx https://learn.microsoft.com/en-us/archive/msdn-magazine/2018/november/net-core-publishing-options-with-net-core

not tested maybe with old win .net sdk possible do similar.

2 Comments

Native code can also be reverse engineered, as noted in the accepted answer. Reverse compilation existed long before .NET.
If you mean assembler or other old tools that can show little more info - it's not real reverse engineered; if I am wrong pls provide tool or steps how get code back from core-rt ilcompiled to x64-native exe or dll; THX
1

I see this topic in 2 major aspects.

A) Is .NET only be reverse engineered and native not ?

B) What type of programmer we are Commercial/Hobbyist ?

Title: Protect .NET code from reverse engineering

My view:

  1. Least preference to make commercial application in .NET, because it will expose even your comments on the built binary after decompile. (I don't know what is the logic to include the comments also with binary) So any one can just decompile it, rename/modify/change the look and resell the application in 24 hours.

  2. In native application rename/modify/change of look is not possible as easy as one could do in .NET

  3. Worried part in .NET is that you could get the whole project with solution from a single binary exe/dll.

Just imagine how week it is in security. So even a lay man could reverse engineering the .NET application easily.

  1. If it is native application like C++/VB6/Delphi only expert cracker who knows ASM could patch the exe and not 100% reverse engineering like .NET.

But now the whole world is running behind the .NET because it is very easy to make projects with the advance features and libraries.

  1. Good News is that Microsoft seems supporting native output from .NET in 2020 which will make coders like me to consider .NET C# as a primary language.

https://www.codeproject.com/Articles/5262251/Generate-Native-Executable-from-NET-Core-3-1-Proje?msg=5755590#xx5755590xx

Comments

1

Use Skater .NET obfuscator. That .NET protection tool works against de4dot, the deobfuscator that renames original-protected assembly members names to human readable strings. Skater fights against that!

Recently MindSystemm group has released a special tool called Skater.NetDeobfuscator [url: https://github.com/MindSystemm/Skater.NetDeobfuscator] which exploits the vulnerabilities of the Skater .NET obfuscator. The developer of the obfuscator, Rustemsoft LLC, received a signal of an urgent need to protect the critical Skater .NET obfuscator algorithms and software infrastructure in order to provide Skater users with stronger source code protection. That has been resolved.

Comments

1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.