c# - 使用默认网络凭证是一个安全漏洞吗?

标签 c# .net windows security

在我的公司,我们有一个 SharePoint 服务器和一个 Active Directory 域。如果我想从 SharePoint 服务器获取任何信息,我必须像这样发送一些凭据:

var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "GET";
request.Credentials = CredentialCache.DefaultNetworkCredentials; // <-- credentials
var response = request.GetResponse();

这工作正常,没有问题,因为我信任 SharePoint 服务器。

但我想知道:DefaultNetworkCredentials 发送到不受信任的服务器是否存在安全问题? 不受信任的服务器可以使用这些凭据来冒充我/用户吗?它可以从这些凭据中提取我的密码吗?

我猜测/希望这些凭据不仅仅包含(纯文本)Windows 密码。然而,MSDN documentation对于 DefaultNetworkCredentials 状态:

The credentials returned by DefaultNetworkCredentials represents the authentication credentials for the current security context in which the application is running. For a client-side application, these are usually the Windows credentials (user name, password, and domain) of the user running the application.

还有这句话(在同一个 MSDN 文档中):

The credentials returned by the DefaultNetworkCredentials property is applicable only for NTLM, negotiate, and Kerberos-based authentication.

我猜这意味着 DefaultNetworkCredentials 可以安全使用 - 但我想对此进行一些确认;因为我不知道“NTLM、协商和基于 Kerberos 的身份验证”的真正含义 - 除了它们(可能)是某种身份验证机制。

最佳答案

Kerberos 身份验证是在这种情况下使用的最安全的身份验证方法。 NTLM 不太安全,协商允许客户端和服务器使用 Kerberos(如果它们都支持的话)——如果不支持,它们会回退到 NTLM。但是,密码形式的明文凭据不会通过网络发送。使用 Internet Explorer 访问您的 SharePoint 站点时使用相同的机制,它也不发送密码但使用您的默认网络凭据。 只要您的服务器配置为使用这些提供程序(NTLM、协商、Kerberos)的 Windows 身份验证而不是基本身份验证或表单例份验证,就不会有安全问题。

您可能需要引用 https://msdn.microsoft.com/en-us/library/aa480475.aspx?f=255&MSPPError=-2147217396有关 IIS 身份验证及其方法的详细信息。

关于c# - 使用默认网络凭证是一个安全漏洞吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49531784/

相关文章:

c# - 语音识别器脱机功能Windows Phone 8.1

C# UDP 发送缓冲区

c# - .net c# postback 覆盖绑定(bind)的文本框

c# - 将窗口置于前台的问题

windows - 当它可以访问的总内存也被限制为4GB时,Windows如何为多个进程每个分配4GB地址空间

c# - 从列表中选择值

c# - Xceed DataGrid 设置为行 :MultiSelect - How to bind selected row to its MVVM row data

c# - 如何使用 .net 实现 SQL IN() 的等价物

c - 输出utf-8到控制台

windows - 为 SHA-3 创建证书