# 安全账户管理器

安全账户管理器（Security Account Manager，SAM）是[微软 Windows](https://www.edgepedia.org/zh/microsoft-windows) 中由注册表支持的数据库，用于存储本地用户账户和组账户的凭据与属性，是每台 Windows 计算机上本地账户的权威凭据存储。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> 它保存内置的本地管理员账户以及在该机器上创建的所有其他账户，但不保存域账户——域账户存放在 [Active Directory](https://www.edgepedia.org/zh/active-directory) 数据库中。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup><sup> • </sup><sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup>

| 要点 | 详情 |
|---|---|
| 存储内容 | 用户名、相对标识符（RID）、加密的 NTLM 与 LM 哈希、账户标志、密码历史记录及组成员关系；不存明文密码，不存域账户<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup> |
| 哈希格式 | NT 哈希是密码经无盐 MD4 哈希运算的结果；因此相同密码会产生相同哈希<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> |
| LM 哈希状态 | 当前版本的 Windows 默认不存储 LM 哈希；LM 哈希要求密码少于 15 个字符，且不区分字母大小写<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> |
| 位置 | 位于 HKLM\SAM 下的注册表配置单元，由 Windows System32\config 目录中的文件支撑，Windows 运行时被操作系统锁定<sup>[3](https://empyreal96.github.io/nt-info-depot/CS490_Windows_Internals/15_security.pdf)</sup><sup> • </sup><sup>[4](https://people.duke.edu/~tkb13/courses/ncsu-csc405-2015fa/RESOURCES/Compsec3e_Chapters/26-WindowSecurity.pdf)</sup><sup> • </sup><sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup> |
| RID 约定 | RID 500 为内置管理员，RID 501 为来宾账户，自定义用户账户一般从 RID 1000 或更高开始<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup> |
| 访问要求 | 枚举 SAM 需要 SYSTEM 级访问权限<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup> |
| 域内对应物 | 在已加入域的计算机上，域凭据存放在 AD DS 数据库（NTDS.DIT）中，该数据库是域内所有用户账户和计算机账户的权威存储<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> |
| 默认保护变更 | 自 Windows 11 22H2 和 Windows Server 2025 起，符合条件的已加入域的非域控制器系统默认启用 Credential Guard<sup>[6](https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/)</sup> |

## 定义及在 Windows 中的角色

SAM 是一个记录已定义本地用户和组及其密码与其他属性的数据库，存储在注册表的 HKLM\SAM 下，其管理子程序位于 \Windows\System32\Samsrv.dll。<sup>[3](https://empyreal96.github.io/nt-info-depot/CS490_Windows_Internals/15_security.pdf)</sup> 它为每个账户记录用户名、RID、加密的 NTLM 与 LM 哈希、账户标志、密码历史记录及组成员关系；它从不存储明文密码，只存哈希。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup><sup> • </sup><sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup>

**内置账户与 RID。** 每个账户在其安全标识符内都带有一个相对标识符。RID 500 是本地内置管理员，RID 501 是来宾账户，在域控制器上 krbtgt 账户持有 RID 502；自定义账户从 RID 1000 开始，内置账户的 RID 是预定义的。<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup><sup> • </sup><sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup><sup> • </sup><sup>[3](https://empyreal96.github.io/nt-info-depot/CS490_Windows_Internals/15_security.pdf)</sup> 内置管理员（RID 500）始终是暴力破解攻击的长期目标。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup> 在注册表中，每个账户是 HKLM\SAM\SAM\Domains\Account\Users 的一个子键，以其 RID 的十六进制值命名；管理员账户（RID 500）位于键 000001F4 之下，其 V 值包含账户名、LM 哈希和 NT 哈希。<sup>[7](https://www.johnmathot.com/posts/Windows-Security-Internals-Part-2-Extracting-NT-Hashes-from-the-SAM-Database/)</sup>

## 架构与运行

在本地账户登录过程中，SAM 进程接收用户提供的凭据，并与存储在 Windows System32\config 文件夹中的 SAM 数据库进行核对；大致相当于 Unix 的 /etc/passwd。<sup>[4](https://people.duke.edu/~tkb13/courses/ncsu-csc405-2015fa/RESOURCES/Compsec3e_Chapters/26-WindowSecurity.pdf)</sup> 本地安全机构子系统服务（LSASS）是处理身份验证的进程，它代表拥有活动 Windows 会话的用户将凭据存储在内存中，形式包括可逆加密的明文、Kerberos 票据、NT 哈希和 LM 哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup>

**文件保护。** 系统运行时有三层保护。Windows 运行期间 SAM 文件被操作系统锁定，因此无法直接从活动系统中复制。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup> HKLM\SAM 键仅授予 SYSTEM 完全控制权限。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup> 而且即使能访问注册表，所存储的哈希数据也用 SYSKEY 加密。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup>

## 凭据存储与哈希格式

SAM 为每个账户存储用户名和 NT 密码哈希；从不存储密码本身，只存哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> NT 哈希是账户密码经无盐 MD4 哈希运算的结果，因此两个使用相同密码的账户具有相同的 NT 哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> 在当前版本的 Windows 上，SAM 默认不存储 LM 哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup>

**LM 为何被淘汰。** LM 哈希要求密码少于 15 个字符且仅含 ASCII 字符，并且不区分大小写字母。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> [Windows XP](https://www.edgepedia.org/zh/windows-xp) 和 Server 2003 默认存储 LM 哈希；从 [Windows Vista](https://www.edgepedia.org/zh/windows-vista) 和 Server 2008 起，默认 NoLMHash=1 意味着只存储 NT 哈希。<sup>[8](https://dfidwiz-sketch.github.io/dfir-handbook/adversary/sam-ntds-extraction/)</sup>

**静态加密。** 在 SAM 内部，NT 哈希首先用两个由用户相对标识符派生出的密钥进行 DES 加密；随后结果再用 RC4 或 AES 加密，所用密码加密密钥本身又用 LSA 系统密钥进行 AES 加密。<sup>[7](https://www.johnmathot.com/posts/Windows-Security-Internals-Part-2-Extracting-NT-Hashes-from-the-SAM-Database/)</sup>

**密码等价物。** 与 Unix 密码哈希不同，LM 和 NTLM 哈希在响应计算的语境中是密码等价物：必须保护它们，因为它们可直接用于应答身份验证挑战。<sup>[9](https://curl.se/rfc/ntlm.html)</sup> 由于 NT 哈希无盐，两个使用相同密码的账户具有相同的 NT 密码哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup>

## 关键数字

- **RID 500** 是本地内置管理员；**RID 501** 是来宾账户；用户账户从 **RID 1000** 开始。<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup>
- **少于 15 个字符**：LM 哈希所能表示的最大密码长度。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup>
- **10 条**：CachedLogonsCount 的默认值，即在 [Windows 7](https://www.edgepedia.org/zh/windows-7)/2008 R2 及更高版本中 SECURITY 配置单元内缓存的域登录数量。<sup>[8](https://dfidwiz-sketch.github.io/dfir-handbook/adversary/sam-ntds-extraction/)</sup>
- **每秒 230 亿次**：一块中端 NVIDIA RTX 2070 可尝试的 NTLM 密码组合数。按此速度，使用扩展字符集的 8 位密码不到 87 小时即可破解，而仅使用大小写字母和数字的 8 位密码不到 3 小时即可破解。<sup>[10](https://blog.elcomsoft.com/2022/12/windows-account-passwords-why-and-how-to-break-ntlm-credentials/)</sup>

这一破解基准说明了无盐 MD4 NT 哈希的暴露程度：由于相同密码产生相同哈希，且基准表明破解时间取决于密码长度和字符多样性，更长、更多样的密码更能抵御此类攻击。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup><sup> • </sup><sup>[10](https://blog.elcomsoft.com/2022/12/windows-account-passwords-why-and-how-to-break-ntlm-credentials/)</sup>

## SAM 与其他凭据存储的对比

当机器加入域时，凭据分散在两个数据库中。SAM 仍是该计算机上本地账户的权威存储，而 Active Directory 域服务数据库（NTDS.DIT）是域内所有用户账户和计算机账户凭据的权威存储，按配置的历史记录策略保存当前 NT 哈希和密码历史 NT 哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup> SAM 不存储域账户凭据；那些存放在域控制器上的 NTDS.dit 中。<sup>[2](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)</sup>

与 Unix 的类比是局部的。SAM 的查找角色类似 /etc/passwd，但在存储方式上，这一类比便不再成立：与 Unix 密码哈希不同，LM 和 NTLM 哈希是密码等价物，可直接在身份验证响应中重放，因此其暴露后果比单向密码验证器的暴露更为严重。<sup>[4](https://people.duke.edu/~tkb13/courses/ncsu-csc405-2015fa/RESOURCES/Compsec3e_Chapters/26-WindowSecurity.pdf)</sup><sup> • </sup><sup>[9](https://curl.se/rfc/ntlm.html)</sup>

**Credential Guard 的覆盖范围。** Credential Guard 保护 NTLM 密码哈希、Kerberos 票据授予票据以及应用程序作为域凭据存储的凭据，但它不保护 Active Directory 数据库或 SAM。<sup>[6](https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/)</sup> 本地账户凭据存放在 SAM 数据库中，而 SAM 数据库处于受保护的虚拟环境之外，因此本地管理员哈希仍可被转储；Credential Guard 在域控制器上也不受支持。<sup>[11](https://cytomate.net/blog/windows-credential-guard-how-it-works-deploy-and-bypass)</sup>

## 提取历史与防御加固

枚举 SAM 需要 SYSTEM 级访问权限，攻击者通过内存技术或通过存储 SAM 数据库的 [Windows 注册表](https://www.edgepedia.org/zh/windows-registry)来提取凭据材料。<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup> 有记录的工具有 pwdumpx.exe、gsecdump、Mimikatz 和 secretsdump.py；也可以用 `reg save HKLM\sam sam` 和 `reg save HKLM\system` 从注册表中提取 SAM，然后在本地用 Creddump7 处理。<sup>[5](https://attack.mitre.org/techniques/T1003/002/)</sup> CISA 指南列出了同样的注册表保存命令和工具名称，供防御方审计排查。<sup>[12](https://www.cisa.gov/eviction-strategies-tool/info-attack/T1003.002)</sup> 第二条离线路径随 HiveNightmare/SeriousSAM（CVE-2021-36934）出现：在 [Windows 10](https://www.edgepedia.org/zh/windows-10) 版本 1809 至 21H1 上，C:\Windows\System32\config\* 的 ACL 权限过宽，非管理员可从任何现有卷影副本中读取 SAM。<sup>[8](https://dfidwiz-sketch.github.io/dfir-handbook/adversary/sam-ntds-extraction/)</sup>

内存提取针对的是 LSASS 而非文件。Mimikatz 等工具解析 lsasrv.dll 中的 LogonSessionList 结构，从 LSA 内存中提取明文密码和 NT 哈希。<sup>[13](https://specterops.io/blog/2025/10/23/catching-credential-guard-off-guard/)</sup>

**防御演进。** 微软为 LSASS 引入了受保护进程轻量级（PPL）机制，使不受信任的用户模式应用程序无法再获得其内存的读取权限句柄；后来又推出基于虚拟化安全（VBS）的 Credential Guard，以弥补 PPL 的局限；研究人员已演示了用户模式和内核模式的绕过方法。<sup>[13](https://specterops.io/blog/2025/10/23/catching-credential-guard-off-guard/)</sup> Microsoft Defender for Endpoint 包含一条专用的攻击面缩减（ASR）规则，用于阻止从 LSASS 窃取凭据；微软的内部测试表明，仅该规则就阻止了所有测试过的用户模式转储技术。<sup>[14](https://www.microsoft.com/en-us/security/blog/2022/10/05/detecting-and-preventing-lsass-credential-dumping-attacks/)</sup> 建议的加固措施还包括为 LSASS 启用 PPL、启用 Credential Guard、对 RDP 使用受限管理模式，以及在 WDigest 中禁用 UseLogonCredential。<sup>[14](https://www.microsoft.com/en-us/security/blog/2022/10/05/detecting-and-preventing-lsass-credential-dumping-attacks/)</sup> 局限依然存在：Credential Guard 覆盖的是域凭据，而非本地 SAM 账户凭据，因此 SAM 数据库中的本地管理员哈希仍可被转储。<sup>[11](https://cytomate.net/blog/windows-credential-guard-how-it-works-deploy-and-bypass)</sup>

## 近期发展

截至 [Windows 11](https://www.edgepedia.org/zh/windows-11) 22H2 和 [Windows Server](https://www.edgepedia.org/zh/windows-server) 2025，加入域且满足硬件条件的计算机（域控制器除外）开箱即启用 Credential Guard，此举还会自动激活虚拟化安全。<sup>[6](https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/)</sup> 该默认启用仅适用于企业版和教育版；Windows 专业版不享有这一 Windows 11 默认启用资格。<sup>[15](https://endpointweekly.com/blog/lsa-protection-runasppl-credential-guard.html)</sup> 启用时不带 UEFI 锁定，允许管理员在需要时远程禁用 Credential Guard。<sup>[6](https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/)</sup><sup> • </sup><sup>[15](https://endpointweekly.com/blog/lsa-protection-runasppl-credential-guard.html)</sup> 在 LSASS 方面，全新安装且已加入企业环境的 Windows 11 22H2 系统默认启用 PPL 和 Credential Guard。<sup>[14](https://www.microsoft.com/en-us/security/blog/2022/10/05/detecting-and-preventing-lsass-credential-dumping-attacks/)</sup>

对防御方而言，净效果是：在符合条件的企业版和[教育](https://www.edgepedia.org/zh/education)版系统上，从 LSASS 内存窃取域凭据默认难度大幅提高；而 SAM 本身并无变化：其哈希仍是无盐 MD4，仅由分层的 DES/RC4 或 AES 加密保护，任何获得 SYSTEM 访问权限或可读 SAM 与 SYSTEM 配置单元副本的人仍可提取本地账户哈希。<sup>[1](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))</sup><sup> • </sup><sup>[7](https://www.johnmathot.com/posts/Windows-Security-Internals-Part-2-Extracting-NT-Hashes-from-the-SAM-Database/)</sup><sup> • </sup><sup>[11](https://cytomate.net/blog/windows-credential-guard-how-it-works-deploy-and-bypass)</sup>

## References

Coverage of the SAM's core architecture and hash formats rests on official Microsoft documentation, but the 2023–2026 changes, extraction history, and defense-in-depth picture rely partly on specialist security references.

1. [Cached and Stored Credentials Technical Overview, Microsoft Learn](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh994565(v=ws.11))
2. [16 LSA SAM, The Mimikatz Missing Manual](https://darkoperator.github.io/mimikatz-missing-manual/16-LSA-SAM/)
3. [Unit OS7: Windows Security Components and Concepts (Windows Internals course chapter)](https://empyreal96.github.io/nt-info-depot/CS490_Windows_Internals/15_security.pdf)
4. [Computer Security, 3e, Chapter 26: Windows Security](https://people.duke.edu/~tkb13/courses/ncsu-csc405-2015fa/RESOURCES/Compsec3e_Chapters/26-WindowSecurity.pdf)
5. [OS Credential Dumping: Security Account Manager, T1003.002, MITRE ATT&CK](https://attack.mitre.org/techniques/T1003/002/)
6. [Credential Guard overview, Microsoft Learn](https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/)
7. [Windows Security Internals, Part II: Extracting NT Hashes from the SAM Database, John Mathot](https://www.johnmathot.com/posts/Windows-Security-Internals-Part-2-Extracting-NT-Hashes-from-the-SAM-Database/)
8. [SAM, LSA Secrets & NTDS.dit Extraction, DFIR Handbook](https://dfidwiz-sketch.github.io/dfir-handbook/adversary/sam-ntds-extraction/)
9. [The NTLM Authentication Protocol and Security Support Provider](https://curl.se/rfc/ntlm.html)
10. [Windows Account Passwords: Why and How to Break NTLM Credentials, ElcomSoft blog](https://blog.elcomsoft.com/2022/12/windows-account-passwords-why-and-how-to-break-ntlm-credentials/)
11. [Windows Credential Guard: How It Works, How to Deploy It, and What Attackers Have Found, Cytomate](https://cytomate.net/blog/windows-credential-guard-how-it-works-deploy-and-bypass)
12. [T1003.002, CISA](https://www.cisa.gov/eviction-strategies-tool/info-attack/T1003.002)
13. [Catching Credential Guard Off Guard, SpecterOps](https://specterops.io/blog/2025/10/23/catching-credential-guard-off-guard/)
14. [Detecting and preventing LSASS credential dumping attacks, Microsoft Security Blog](https://www.microsoft.com/en-us/security/blog/2022/10/05/detecting-and-preventing-lsass-credential-dumping-attacks/)
15. [LSA Protection, RunAsPPL and Credential Guard, EndpointWeekly](https://endpointweekly.com/blog/lsa-protection-runasppl-credential-guard.html)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › 数据库与数据系统 › 数据库安全、隐私与法律 › 数据库访问控制与安全管理

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/security-account-manager

English original: https://www.edgepedia.org/security-account-manager
