验证.NET框架组件组件、框架、NET

2023-09-03 12:43:56 作者:我对你的爱丶唤来你的讨厌

我只是通过我们的德国VB.NET论坛并有一些有趣的事情,让我某种头痛。

I just went through our german VB.NET forums and there was something interesting that gives me some kind of headache.

这其实是可以的修改的使用ReflexIL或其他IL编辑器中的.NET Framework程序集。你必须绕过的唯一的事情就是集的强名称签名。改变装配IL后,你必须运行 SN.EXE -Vr [的AssemblyName] 来还挺跳过强名称验证。之后,你必须清除缓存的本机映像。只要经过 C:\ WINDOWS \组装目录,并删除所有相关的您组装图像。然后重新启动。当您登录,运行 NGEN安装[的AssemblyName] 。现在产生的新本机映像。

It is actually possible to edit the .NET Framework assemblies using ReflexIL or some other IL editor. The only thing you have to bypass is the Strong Name signature of the assembly. After changing the assembly IL, you have to run sn.exe -Vr [assemblyname] to kinda skip the strong name validation. After that you have to clear the cached native images. Just go through the C:\Windows\assembly directory and delete every image related to your assembly. Then reboot. When you are logged in, run ngen install [assemblyname]. Now the new native images are generated.

这工作。我在虚拟环境(Windows XP x86)的验证了这一过程。现在我担心的大部分事情是,你可以很容易地绕过.NET VerifyHash 或的 VerifyData 中的的RSACryptoServiceProvider 的方法。这实际工作了。我的一个朋友和我的测试可以验证此问题(看截图)。这是相当容易的。

This works. I verified this procedure in my virtual environment (Windows XP x86). Now the thing that worries me the most is that you can easily bypass the .NET VerifyHash or VerifyData methods of the RSACryptoServiceProvider. This actually works, too. A friend of mine and me tested could verify this issue (see screenshots). That was fairly easy.

例如,如果我想创建基于.NET框架加密类许可制度,它可以绕过系统范围对于每次 .NET应用程序上使用该框架系统。此外,每个人都可以的登录和变化的,我打电话只是挂钩到方法functios的输入。

For example, if I'd create a licensing system built on the .NET Framework cryptography classes, it could be bypassed system-wide for every .NET application on the system using the framework. Also, everybody can log and change the input of functios that I call just by hooking into the methods.

现在我的问题是: 因为这可能是一个巨大的问题,我怎么能为此做些什么?当然,恶意用户可能只需编辑的我的应用程序,但是这不会是那么糟糕,因为这样做全系统。 我曾想过一些框架校验和验证,但由于有很多不同的更新的.NET Framework,这似乎是不可能的。

Now my question is: Since this can be a huge problem, how can I do something about that? Of course a malicious user could just edit my application, but that would not be as bad as doing this system-wide. I was thinking about some framework checksum validation, but since there are alot of different updates for the .NET Framework, this seems to be impossible.

任何解决方案或建议? Microsoft是否照顾这个问题以某种方式?

Any solutions or suggestions? Does Microsoft take care of this problem in some way?

推荐答案

如果一个攻击者具有管理员访问您的计算机(这是需要您所描述的攻击),那么你已经pretty的多丢失。任何你可以做可能会被攻击者绕过。

If an attacker has admin access to your computer (which is required for the attack you described), then you've pretty much lost. Anything you could do could be circumvented by the attacker.

,我认为这是完全没有意义的尝试对这种类型的攻击防御。如果你必须处理不可信的,潜在的受感染的计算机,那么你根本无法相信他们做任何事的敏感,你必须做你自己的服务器,或者类似的东西上。

Because of that, I think it is completely pointless trying to defend against this type of attack. If you have to deal with untrusted, potentially compromised computers, then you simply can't trust them to do anything sensitive and you have to do it on your own server, or something like that.