了解 .NET 框架中的 CAS
如果我向 .net 框架提供我的程序集所属代码组的证据,难道我不能提供虚假证据来表明我属于受信任区域代码组吗?
我知道什么是安全策略、权限集,但我不明白框架如何检查证据,然后根据该证据确定代码组。
任何解释将不胜感激。
谢谢 :)
If I provide Evidence to the .net framework on which code group my assembly belongs to, couldn't I provide false evidence stating that I belong in the Trusted Zone code group?
I know what security policies are, permission sets but I don't understand how the framework checks the Evidence and then based on that evidence, determines the code group.
Any explanation would be appreciated.
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
证据可以是程序集强名称、代码库和其他东西。 它当然可以验证这些东西。 您可以根据证据手动信任程序集。 基本上,您告诉框架程序集是否具有以下属性,并授予它该权限集。 我看不出你有什么办法可以提供虚假证据。 你能举个例子吗?
附言。 是的,例如,您可以窃取某人的密钥对并用它来签署您的程序集。 与任何其他安全系统一样,它依赖于信任链。 如果你打破了链条的一部分,你就搞砸了。 没有真正的方法可以在安全系统中规避这些东西。 毕竟,您可能会因缓冲区溢出或其他问题而危害系统,并将您的程序集添加到完全信任列表中。
The evidence can be assembly strong name, code base and other stuff. It certainly can verify those stuff. You manually trust assemblies based on the evidence. Basically, you tell the framework if an assembly has the following properties, grant it that permission set. I don't see a way you could provide false evidence. Can you provide an example?
PS. Yes, you could, for example steal someone's key pair and sign your assembly with that. Like any other security system, it relies on a trust chain. If you break a part of the chain, you've screwed up. There's no real way you could circumvent these stuff in a security system. After all, you could compromise the system with a buffer overflow or something and add your assembly to the full trust list.
允许调用者提供证据的各种 BCL 方法本身都受到权限要求的保护。 调用者通常至少需要 SecurityPermission\ControlEvidence,但通常需要无限制的权限授予(也称为“完全信任”)。 (由于 SecurityPermission\ControlEvidence 仅在默认 CAS 策略下授予本地安装的代码,因此在大多数情况下几乎没有实际差异。)最终结果是,只有高度可信的代码才能通过控制其证据来影响任何给定程序集的权限授予。
如果您认为您发现了此一般规则的例外情况,请提供详细信息吗?
The various BCL methods that allow a caller to provide evidence are themselves protected by permission demands. The caller will usually require at least SecurityPermission\ControlEvidence, but often an unrestricted permission grant (aka "full trust") is needed. (Since SecurityPermission\ControlEvidence is only granted to locally installed code under default CAS policy, there is little practical difference in most situations.) The end result is that only highly trusted code can affect the permission grant of any given assembly by controlling its evidence.
If you think that you've found an exception to this general rule, could you please provide the details?