Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - Executables decompilable (can be reverse engineered)?

Is that right that C# can be reverse engineered? How is easy to do that? Can we say the C# is not enough good from safety aspect? And what about C++ compared with C# against decompiling?

like image 458
Narek Avatar asked Nov 28 '22 05:11

Narek


2 Answers

It's true!

Take a look at one of your own executables using Reflector.

Does this mean that C# is "not enough good from safety aspect"? No, it doesn't mean that.

There's nothing wrong with the safety of C#. You just need to ensure that you don't put any secrets in your published executables if you don't want the world to know about them. (This applies to pretty much any language, not just C#. All executable code can be reverse-engineered, it's just that some languages/frameworks make it easier than others.)

like image 110
LukeH Avatar answered Dec 10 '22 01:12

LukeH


Oh dear.

Even if you write your program in C or whatever language, you can always extract the machine code from the executable (even if it's some weird self-modifying code) and then you can always get the assembly representation. This is necessary because CPUs can only execute machine code. This is inherently true for any program written for any Turing machine.

This fact is well illustrated by cracks popping up for any game or application a few days after their release no matter how hard the developers tried to obfuscate code. There are obfuscation techniques but in the end, it will be always possible to reverse engineer the machine code (or the IL code in the case of .NET). There are also very good Assembly -> C decompilers out there.

Just accept the fact that your code can be reverse engineered and will be if someone needs the source code enough and is willing to invest some time in it. Design your software by keeping this in mind.

like image 29
Tamas Czinege Avatar answered Dec 10 '22 01:12

Tamas Czinege