gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 10:18:27 24 4
gpt4 key购买 nike

我能确定 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 Environment 类返回的值是否可以安全地用于授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35579500/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com