C# - 可执行文件可反编译(可以进行逆向工程)?
C# 可以进行逆向工程吗?做到这一点谈何容易? 我们能说C#从安全方面来说不够好吗?那么,C++ 与 C# 相比,在反编译方面又如何呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这是真的!
使用 Reflector 查看您自己的可执行文件之一。
这是否意味着 C#“从安全方面来说不够好”?不,不是这个意思。
C#的安全性没有什么问题。如果您不想让全世界知道它们,您只需确保不在已发布的可执行文件中添加任何秘密即可。 (这几乎适用于任何语言,而不仅仅是 C#。所有可执行代码都可以进行逆向工程,只是某些语言/框架比其他语言/框架更容易。)
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.)
哦亲爱的。
即使您用 C 或任何语言编写程序,您始终可以从可执行文件中提取机器代码(即使它是一些奇怪的自修改代码),然后您始终可以获得汇编表示形式。这是必要的,因为 CPU 只能执行机器代码。对于为任何图灵机编写的任何程序来说,这本质上都是正确的。
任何游戏或应用程序在发布几天后都会出现裂缝,无论开发人员如何努力混淆代码,都很好地说明了这一事实。有一些混淆技术,但最终总是可以对机器代码(或 .NET 中的 IL 代码)进行逆向工程。还有非常好的组装-> C 反编译器就在那里。
只要接受这样一个事实:您的代码可以被逆向工程,如果有人足够需要源代码并且愿意在其中投入一些时间,那么就可以进行逆向工程。设计你的软件时要牢记这一点。
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.
显然你可以使用 Reflactor 查看其源代码。但是您可以通过使用混淆器来使其变得有点困难,例如 < strong>Dotfuscator
但正如每个人都说的那样,你无法使其不可能进行逆向工程。
You can obviously use Reflactor to see its source code. But you can make it a bit difficult by using obfuscator like Dotfuscator
But as everyone is saying you cant make it impossible to reverse engineering it.
是的,C# 可以进行逆向工程。事实上,这很容易做到。看看反射器。要使其变得更难,但并非不可能,请使用混淆器。
请记住,用 C/C++ 或任何其他语言编写的应用程序也可以进行逆向工程,尽管不像非混淆的 C# 或 Java 那样容易。
Yes, C# can be reverse engineer. In fact it is trivially easy to do. Take a look at Reflector. To make it harder, but not impossible use an obfuscator.
Keep in mind that applications written in C/C++ or any other language for that matter can be reverse engineered as well albeit not as easily as non-obfuscated C# or Java.
C# 的每个新版本都更难进行逆向工程。确实,当 C# 为 1.0 时,Reflector 实际上会泄露您的源代码,但现在我们已经到了 3.0,如果您使用匿名委托、LINQ、匿名类等,所有高级语法都将被编译为“哑”语法MSIL 并且将它们逆向工程回其原始来源并不容易。
Each new version of C# is more difficult to reverse engineer. It's true that when C# was at 1.0, Reflector would practically reveal your source code however now we are at 3.0 and if you are using anonymous delegates, LINQ, anonymous classes etc. all that high-level syntax is being compiled down to "dumb" MSIL and it's no more easy to reverse engineer them back to its original source.
任何使用 .NET 框架编写的代码都可以轻松地进行逆向工程。这就是混淆概念的用武之地。
混淆是一些工具使用的一种技术,它采用基于 .NET 的程序集输出并尝试加密字符串、更改方法体的流程控制、重命名变量、参数和方法名称,从而使普通黑客更难跟踪和“反编译”代码。
混淆并不能保证完全保护您的“专有”代码。为了保持代码的最佳安全性,只需将代码保存在您的私人服务器上即可。重要的是要记住,只要潜在的“黑客”有足够的时间和毅力,所有代码都可以进行逆向工程。
C# 安全方面
如果您觉得您有“敏感”代码,您不希望其他用户看到和“解码”,您应该研究在本机 Win32 环境(C++ 或 Delphi)中开发这些代码部分,并继续享受 . NET 框架。
Any code written using the .NET framework can easily be reverse engineered. That's where the concept of obfuscation comes in.
Obfuscation is a technique some tools use that take a .NET -based assembly output and attempts to encrypt strings, change flow control of method bodies, rename variable, parameter and method names, thereby making it harder for causal hackers to follow and "decompile" the code.
Obfuscation does not guarantee complete protection of your "proprietary" code. To maintain the best security of your code, simply keep the code on your private servers. It's important to remember that all code can be reverse engineered given enough time and perseverance by the would-be "hacker".
C# safety aspect
If you feel you have "sensitive" code you don't want other users to see and "decode", you should investigate developing those portions of code in a native Win32 environment (C++ or Delphi) and continue with the benefits afforded from the .NET framework.
Google 搜索“Red Gate Reflector” - http://www.red-gate.com/products /reflector/
如果你想防止这种情况发生,那么你需要一个混淆器,或者其他一些更高级的保护形式。
Google for "Red Gate Reflector" - http://www.red-gate.com/products/reflector/
If you want to prevent this then you need an obfuscator, or some other more advanced form of protection.
将 Reflector 与文件反汇编器插件结合使用 http://www.denisbauer.com/NETTools/FileDisassembler - 它将为您生成 dll 中的所有代码。
Use Reflector with the File Disassembler plugin http://www.denisbauer.com/NETTools/FileDisassembler - it will generate all the code from the dll for you.