相关疑难解决方法(0)

System.Security.Principal.WindowsIdentity的使用是否合理安全?

合理的,从安全的被黑客攻击这样的情况下,我从得到的或具有对给我的装配虚假的身份信息?当然,没有什么是完全防篡改的,但鉴于微软对.Net的承诺和依赖,我认为像这样的关键API会被锁定并难以篡改.这是我的有效假设吗?System.Security.Principal.WindowsIdentity Thread.CurrentPrincipalIdentityWindowsIdentity.GetCurrent()trueIsAuthenticated

我的目标是在我的程序集中提供合理的最佳实践SSO.如果Windows本身受到了损害,那是我无法控制的,但是如果(例如)对于链接到我的程序集的应用程序而言,这是一件简单的事情,以便向我提供虚假信息,那就是因为我没有尽职尽责.这对我来说是一个无知的大区域.

要清楚,我正在寻找难以获得的信息,而不是袖手旁观.所以,发布的漏洞利用,或WindowsIdentity以一种欺骗我的代码的方式展示构造函数的使用等等.或者在"那是一个有效的假设"方面,支持它的固体文章,依赖它的已知用法等等.我没有'有很多运气找到它们,但我已经包括了我在目前为止在分频器下面找到的内容.

这是我打算如何使用WindowsIdentity:

using System.Security.Principal;
using System.Threading;
// ...

// I only want Windows-authenticated users
WindowsIdentity identity = Thread.CurrentPrincipal == null
    ? null
    : Thread.CurrentPrincipal.Identity as WindowsIdentity;
SecurityIdentifier sid;

// I can't imagine how an authenticated account would be anonymous, but...
if (identity != null && identity.IsAuthenticated && !identity.IsAnonymous) {
    // SSO success from thread identity
    sid = identity.User;
    // ...check that that SID is …
Run Code Online (Sandbox Code Playgroud)

.net c# security

15
推荐指数
1
解决办法
8737
查看次数

标签 统计

.net ×1

c# ×1

security ×1