简体   繁体   English

是否可以取消对程序集的FullName属性的检查? 是否可以在不使用强命名的情况下执行类似的检查?

[英]Can a check on the FullName property of an assembly be defeated? Can a similar check be performed without the use of strong naming?

My company has recently taken over another company and we are currently looking at the problem of making one of the new acquisition's regular releases. 我的公司最近接管了另一家公司,我们目前正在研究使新收购的常规发行之一的问题。 The product is a plugin for a third-party software product; 该产品是第三方软件产品的插件; the plugin provides functionality (the ability to query a valuable dataset) which is also offered through a dedicated application which is another of the new acquisition's releases. 该插件提供了功能(查询有价值的数据集的能力),该功能也通过专用应用程序提供,这是新收购的另一个版本。

In the code shared with the dedicated application, we defend against data being extracted from the application in volume by requiring that the assembly invoking our code has to be signed using our certificate. 在与专用应用程序共享的代码中,我们要求必须使用我们的证书对调用我们代码的程序集进行签名,以防止从应用程序中批量提取数据。 This is done by checking that the public key in the assembly's FullName has the correct value (string representation of our certificate's public key). 这是通过检查程序集的FullName中的公钥具有正确的值(我们证书的公钥的字符串表示形式)来完成的。 I do not have a good understanding of security-related matters but I have seen a number of resources specifically discouraging the use of "strong naming" for security purposes, which gives me cause for concern that this may not be a meaningful security measure. 我对与安全性有关的事情没有很好的了解,但是我看到许多资源专门阻止出于安全目的使用“强命名”,这使我担心这可能不是有意义的安全措施。

In the plugin, the functionality is exposed through a Plugin class which inherits from a base class defined in DLLs we have been given by the developers of the host application. 在插件中,该功能是通过Plugin类公开的,该类继承自宿主应用程序开发人员提供的DLL中定义的基类。 (The framework used for the host/plugin system is the stuff in the System.AddIn namespace in the .net standard library; the plugin runs as a separate process.) Unfortunately, those DLLs are not signed by the developers of the host. (用于主机/插件系统的框架是.net标准库中System.AddIn命名空间中的内容;该插件作为单独的进程运行。)不幸的是,那些DLL没有由主机开发人员签名。 We therefore cannot sign our plugin, and our security check will block the plugin from working unless it is signed. 因此,我们无法对插件进行签名,并且我们的安全检查将阻止插件运行,除非已签名。 (We are told that the host application executable is signed.) (被告知主机应用程序可执行文件已签名。)

Does the check on the public key contained in the FullName property of the invoking assembly actually accomplish anything? 对调用程序集的FullName属性中包含的公钥的检查是否真正完成了任何工作? Could someone spoof it if they wanted to crack our application? 如果有人想破解我们的应用程序,可以欺骗它吗? If it does in fact accomplish something (if it makes it infeasible to spoof signing of the invoking assembly) then how might we get around the fact that we can't sign our DLL? 如果它确实完成了某件事(如果使欺骗性的调用程序集签名变得不可行),那么我们如何解决无法签名DLL的​​事实呢? That is to say, how can we make our plugin work in the host application while keeping control over how our code is executed? 也就是说,如何在控制应用程序代码执行的同时使插件在主机应用程序中工作? It is not enough to "whitelist" the public key used to sign the host application, because it runs as a separate process. 仅将用于签署主机应用程序的公用密钥“白名单”“白名单”是不够的,因为它作为一个单独的进程运行。

The previous releases of the software are believed to have had this check disabled, but obviously this is not desirable; 据信该软件的先前发行版已禁用此检查,但是显然这是不可取的。 either the check adds no value and we should remove it everywhere, or it does add value and we would prefer not to remove it from anything. 支票不会增加价值,我们应该在任何地方删除它,或者支票确实会增加价值,我们宁愿不要从任何东西中删除它。

If you're verifying the strong name matches the one you're expecting (including public signature), then you are verifying that it has not been tampered with. 如果您要验证的强名称是否与您期望的强名称(包括公共签名)匹配,那么您正在验证其是否遭到篡改。

That is you are verifying the assembly is what you expect, however unless you know exactly what that assembly is doing you should not trust it. 那是您在验证程序集是否符合您的期望,但是除非您确切知道该程序集在做什么,否则您不应信任它。

This holds true as long as the private key has been kept secure. 只要私钥一直保持安全,这就是正确的。 If this has been leaked at any point then an attacker could have used it to sign another assembly. 如果这在任何时候都被泄漏,那么攻击者可能会用它来签署另一个程序集。

See this answer for more info. 有关更多信息,请参见此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以在C#中使用InternalVisibleTo而不使用强名称程序集吗? - Can one use InternalVisibleTo without strong-named assembly in C#? 检查属性是否可以延迟加载/是否可用而不必捕获异常 - Check if property can be lazy loaded/is available without having to catch an exception 如何使用.DayOfWeek的返回值检查类的属性 - How can I use the return of .DayOfWeek to check property of class 如何检查部件上的InternalsVisibleTo属性? - How can I check for an InternalsVisibleTo attribute on an assembly? 如何检索程序集的强键 - How can I retrieve the Strong Key of a assembly 如何编写一个可以在不命名的情况下访问属性的类 - Howto write a class where a property can be accessed without naming it 检查程序集的身份? 可能是它的强名吗? - Check assembly's identity? Possibly by it's strong name? 检查组件的版本而不加载它 - Check the version of an assembly without loading it InternalsVisibleTo用于动态生成的程序集,但具有强大的命名功能 - InternalsVisibleTo for dynamically generated assembly, but with strong naming 强命名能否导致C#中的对象序列化问题? - Can strong naming cause problems with object serialization in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM