c# - .NET 环境类返回的值是否可以安全地用于授权

标签 c# .net windows security

我可以确定 Environment class 返回的值吗? (特别是 UserName 和 UserDomainName)是否有效?用户是否可以通过任何方式注入(inject)自己的值以由这些属性返回?这对我来说很重要,因为我想使用这个值进行授权。

最佳答案

微软声称it should be secure .

You can use the UserName property to identify the user on the current thread, to the system and application for security or access purposes. It can also be used to customize a particular application for each user.

The UserName property wraps a call to the Windows GetUserName function. The domain account credentials for a user are formatted as the user's domain name, the '\' character, and user name. Use the UserDomainName property to obtain the user's domain name and the UserName property to obtain the user name.

但我想,在拥有无限时间和金钱的敌对攻击者面前,他们可以构建自己的 Windows 版本,在此处返回他们想要的任何内容,或者使用驱动程序来修补 GetUserName 等。最终您需要使用类似 Kerberos 的内容如果您对客户不信任。

关于c# - .NET 环境类返回的值是否可以安全地用于授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35579500/

相关文章:

c# - UWP App 总是以非零返回码退出

.net - 有人知道用于对SaaS用户进行计费和身份验证的服务吗?

windows - 命令 'go.tools.install' 未找到

c# - 在 TreeView c# 中向上移动树节点的处理程序崩溃

c# - 由于缺少程序集引用,Azure 部署失败

.net - 为什么 Process 类位于 Diagnostics 命名空间中?

.net - WCF:已超出最大字符串内容长度配额(8192)

windows - 带有 bazel 的 Tensorflow : avx ignored?

windows - 基本批处理文件语言命令

c# - 如何添加和检索 Azure Blob 的附加信息