Skip to content

User activity

SAM hive and user accounts

SAM hive cheat sheet: local accounts, RIDs, last logon and password change times, logon counts, group membership, ProfileList, and account-related event IDs.

Location
C:\Windows\System32\config\SAM
Proves
Which local accounts exist, when they logged on and changed passwords, and group membership
Timestamps
Last logon, password last set and last failed logon as FILETIME, UTC in the F value; Users and Names key LastWrite, UTC
Retention
Persists until the account is deleted; remnants in hive slack, VSS copies of SAM, ProfileList and the profile folder
Access
SAM hive locked live: collect via raw NTFS (KAPE) or VSS, or reg save HKLM\SAM as administrator
Evidence of
User activity
Type
Registry
Windows
XPVista / 78 / 8.11011
KAPE target
RegistryHivesSystem
Velociraptor
Windows.Triage.Targets:RegistryHivesSystem
  • SecretsDump: For authorized incident response only.

What it is

The Security Account Manager (SAM) hive holds the local user accounts and local groups of a Windows machine: names, relative identifiers (RIDs), account flags, logon statistics and the (encrypted) password hashes. Combined with the ProfileList key of the SOFTWARE hive, it lets you translate every SID found in other artifacts into an account, and spot accounts an attacker created or abused. Domain accounts are not stored in the SAM of member machines.

Location

ArtifactLocation
SAM hiveC:\Windows\System32\config\SAM (+ .LOG1 / .LOG2)
Local usersSAM\Domains\Account\Users\<RID in hex> (values F and V)
Name → RIDSAM\Domains\Account\Users\Names\<user name> (the value type holds the RID)
Local groupsSAM\Domains\Builtin\Aliases\<RID> (for example 00000220 = Administrators)
Profiles (SID → folder)SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID> (ProfileImagePath)
Cached domain logonsSECURITY\Cache (NL$1, NL$2…)

What it proves

  • Which local accounts exist, their RIDs (500 = built-in Administrator, 501 = Guest, 1000+ = accounts created later) and whether they are disabled.
  • When each account last logged on, last changed its password and last failed a logon, plus logon and failed-logon counters.
  • Group membership, for example a new account added to Administrators or Remote Desktop Users.
  • On Windows 8 and later, a Microsoft account linked to a local account (InternetUserName and name values under the user's key).
  • ProfileList shows every account (local or domain) that has logged on interactively and created a profile.

Key fields

FieldWhereMeaning
Last logon timeF valueLast successful interactive logon recorded locally
Password last setF valueLast password change
Last failed logonF valueLast incorrect password
Account expiresF valueExpiry, if set
Account control flagsF valueDisabled, password never expires, password not required…
Logon count / failed countF valueCounters
User name, full name, comment, hashesV valueHashes are encrypted with keys derived from the SYSTEM hive boot key
ProfileImagePathProfileListProfile folder of the SID

Timestamps

TimestampSet whenFormatPitfalls
Last logon, password last set, last failed logonCorresponding event on this machineFILETIME, UTCLocal accounts only; network logons may not update it
Users\<RID> key LastWriteAny change to the account's valuesFILETIME, UTCOften close to the last logon or password change
Names\<user> key LastWriteName key created or renamedFILETIME, UTCUsually the account creation time

Retention and clearing

  • Deleting an account removes its keys; traces may remain in hive slack, shadow-copy SAM hives, the ProfileList key and the profile folder under C:\Users.
  • Events 4720 (created), 4722 (enabled), 4724 (password reset attempt), 4725 (disabled), 4726 (deleted), 4732 (added to a local group) and 4738 (changed) in the Security log give the history the SAM cannot.

Collection

  • KAPE target: RegistryHivesSystem (SAM, SECURITY, SYSTEM, SOFTWARE with logs)
  • Velociraptor (Windows.Triage.Targets): RegistryHivesSystem; Windows.Forensics.SAM parses accounts live.
  • Built-in (administrator):
reg save HKLM\SAM E:\case\SAM.hiv
reg save HKLM\SYSTEM E:\case\SYSTEM.hiv
net user
net localgroup administrators

Parsing tools

  • Registry Explorer (Eric Zimmerman): SAM plugin that decodes F and V.
  • RegRipper: samparse plugin, profilelist plugin for the SOFTWARE hive.
  • Velociraptor: Windows.Forensics.SAM, Windows.Sys.Users.
  • Impacket secretsdump.py (offline, with SAM + SYSTEM [+ SECURITY]): for authorized incident response only, for example to check whether a compromised local administrator hash is reused across hosts.

Investigation tips

  • List RIDs above 1000 created during the incident window (Names key LastWrite, event 4720) and check their group membership.
  • A disabled built-in Administrator (RID 500) suddenly enabled, or a password reset on it, is a common persistence move.
  • Map SIDs from BAM/DAM, SRUM and event logs to names through ProfileList and the SAM.
  • An account that logged on via RDP but has no profile folder may have been deleted afterwards: check shadow copies.
  • Handle hash extraction as sensitive evidence: restrict it to authorized responders and document why it was needed.

Related artifacts

Glossary terms

Guides

All artifacts on one page: cheat sheet