macos - 为内存加密密码是否过度?

标签 macos security passwords

我需要为 Mac 构建一个安全的应用程序。为此,我使用仅存在于创建者头部的主密码。

要检索它,首先需要在安全文本字段中输入密码*,然后可以使用它来加密和解密文件。当应用程序保持打开状态时,主密码将存储在变量中,这意味着它存在于内存中。在内存中加密这个密码会不会太过分了?

我问这个问题的原因是,在主密码可以为内存加密之前,它已经作为变量存在,这意味着它已经对内存扫描攻击开放。这是我应该担心的事情吗?

我在 https://www.apple.com/macos/security/ 上阅读了以下内容:

Runtime protections defend at the core. The technically sophisticated runtime protections in macOS work at the very core of your Mac to help keep your system safe. Built right into the processor, the XD (execute disable) feature creates a strong wall between memory used for data and memory used for executable instructions. This protects against malware that attempts to trick the Mac into treating data the same way it treats a program in order to compromise your system. Address Space Layout Randomization (ASLR) changes the memory locations where different parts of an app are stored. This makes it difficult for an attacker to do harm by finding and reordering parts of an app to make it do something it wasn’t intended to do. macOS brings ASLR to the memory used by the kernel at the heart of the operating system, so the same defenses work at every level in your Mac.

我是否可以得出结论,Mac 已经内置了针对内存扫描和劫持的保护?

(*我知道这可能会导致键盘记录器漏洞)

最佳答案

在每种情况下,您都首先从用户密码中获取 key ,然后使用该 key 来加密文件。因此,您可以使用 key 导出函数立即计算 key ,并将 key 保存在内存中,而不是将密码保存在内存中。您获得的优势是,攻击者只能获知用于解密文件的 key ,而无法获知原始密码,而原始密码可能会被重复使用。

某些操作系统提供专门的 SecureString ,这可能是最接近您想要的,它在内存中保存一个加密的字符串,并可以从那里删除它。我不知道OSX是否提供这样的东西。

我怀疑内存中的加密 key 有多大用处。如果攻击者能够分析内存,他(她)可能也能够解密内存,毕竟应用程序必须能够解密 key 。但毫无疑问,它提高了标准,需要做更多的工作。

我认为链接的文章解决了另一个问题,它防止将可执行代码放入内存中(作为输入数据)并欺骗处理器随后执行它。

关于macos - 为内存加密密码是否过度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46024045/

相关文章:

php - md5(uniqid) 对随机唯一 token 有意义吗?

passwords - 与密码一起存储 PBKDF2 设置

linux - 使用 bash rsync 远程站点

android - 如何更改在 Mac 中的 Android Studio 中突出显示文本的方式?

c++ - Qt on mac OSX,点击桌面

c - 无法在 Mac OSX 上的程序集 (x86-64) 和 C 文件中链接 printf 和 scanf

security -/var/lib/kubelet/pods下的目录权限

javascript - 从 Javascript 访问 HTTP 身份验证信息

java - Java 中的信用卡洗涤器/ sanitizer 库

php - MySQL 哈希函数实现