Skip to content

Local Accounts: Rogue, Hidden and RID-Hijacked Users

How attackers persist on Windows with new local administrators, accounts hidden from the sign-in screen and RID hijacking in the SAM, and how to find them.

Tactics
Persistence, Privilege escalation, Defense evasion
Runs
At logon
Set up by
Administrators
Locations
  • HKLM\SAM\SAM\Domains\Account\Users
  • HKLM\SAM\SAM\Domains\Builtin\Aliases\00000220
  • HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList
  • HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  • C:\Windows\System32\config\SAM

How it works

Local accounts live in the Security Account Manager (SAM) database: the SAM hive in C:\Windows\System32\config, loaded as HKLM\SAM. Each account has a key under SAM\Domains\Account\Users named after its relative identifier (RID) in hexadecimal, with two binary values:

  • F, fixed-size data: last logon, password last set, the account's RID again (at offset 0x30), the account control flags such as "disabled" (at offset 0x38) and the logon count.
  • V, variable data: user name, full name, comment and the password hashes.

Users\Names\<name> is the index from name to RID; the RID is stored as the type of that key's default value. Built-in groups live under SAM\Domains\Builtin\Aliases, and the Administrators group (RID 544) is the key 00000220, whose C value lists the member SIDs.

An account's SID is the machine SID followed by its RID. Windows 10 and 11 ship four built-in accounts, all disabled: Administrator (500), Guest (501), DefaultAccount (503) and WDAGUtilityAccount (504). Accounts people create get RIDs from 1000 up.

An account is persistence that needs no code. Whoever knows its password comes back through Remote Desktop, SMB, WinRM or the sign-in screen, and a member of Administrators has full control. It survives reboots, patching and the removal of every implant.

Two Windows behaviours make accounts easy to hide:

  • A DWORD value named after an account and set to 0 under Winlogon\SpecialAccounts\UserList removes it from the sign-in screen and from Settings. The account still exists, still appears in Get-LocalUser and Computer Management, and still logs on.
  • At logon, Windows takes the RID for the account's token from the F value, not from the key name. Write 500 into the F value of a low-privileged account and it logs on with the built-in Administrator's SID and group memberships. This is RID hijacking, published by Sebastián Castro in 2017. Writing the SAM requires SYSTEM.

Where it lives

LocationWhatWho can write it
HKLM\SAM\SAM\Domains\Account\Users\<RID>F and V for one accountSYSTEM; administrators go through the account APIs (net user, Computer Management, New-LocalUser)
HKLM\SAM\SAM\Domains\Account\Users\Names\<name>Name to RID; its last-write time is the creation or last renameSYSTEM
HKLM\SAM\SAM\Domains\Builtin\Aliases\00000220Administrators members (C)SYSTEM, through the group APIs
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserListAccounts hidden from the sign-in screenAdministrators
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID>Profile folder of each account that has logged onSYSTEM

By default only SYSTEM can even read below HKLM\SAM\SAM. On a clean install UserList is usually absent or empty; some management and virtualisation software hides its own service accounts there, so check entries against installed products.

How attackers use it

A new administrator. The most common form in hands-on intrusions:

net user svc_backup Example-Passw0rd /add
net localgroup administrators svc_backup /add

The group name is localised on non-English Windows; Add-LocalGroupMember -SID S-1-5-32-544 -Member svc_backup works in every language. Attackers often add the account to Remote Desktop Users too.

Hidden from the sign-in screen. MITRE ATT&CK lists Dragonfly, Kimsuky and the SMOKEDHAM backdoor for this:

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v svc_backup /t REG_DWORD /d 0 /f

A name ending in $. net user leaves out accounts whose name ends with a dollar sign, the convention for computer accounts. AhnLab reported in January 2025 that Andariel created such an account, added it to Administrators and Remote Desktop Users, and then used RID hijacking on it.

RID hijacking. As SYSTEM (for example through PsExec's -s), the attacker overwrites the RID at offset 0x30 of an account's F value with F4 01 00 00 (500). Metasploit's post/windows/manage/rid_hijack module does it, and can target the Guest account. The account looks unprivileged in every group list but receives an administrator token.

Reviving built-in accounts. net user guest /active:yes plus a group membership, or enabling the built-in Administrator, which is exempt from UAC's token filtering by default. These leave no new account to find.

How to check a host

On a live machine, from an elevated prompt:

Get-LocalUser | Select-Object Name, Enabled, SID, LastLogon, PasswordLastSet, Description
Get-LocalGroupMember -SID S-1-5-32-544
Get-LocalGroupMember -SID S-1-5-32-555
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList"
net user

Compare Get-LocalUser with net user: a name that appears only in the first ends in $. Every enabled account should belong to a person or a product you can name. Get-LocalGroupMember fails when the group holds a SID that no longer resolves; net localgroup administrators still works then.

RID hijacking hides from these commands. Either read the F value as SYSTEM (PsExec -s reg query HKLM\SAM\SAM\Domains\Account\Users\000003E9 /v F) and compare the four bytes at offset 0x30 with the key name, or look at running sessions: processes or logons carrying the built-in Administrator's SID (ending in -500) while that account is disabled point to a hijack.

Offline, collect the SAM, SYSTEM and SOFTWARE hives. RegRipper's samparse plugin, or Windows Persistence, lists the accounts with their RIDs and times. The Names\<name> key's last-write time gives the creation (or last rename); the Users\<RID> key changes at every logon.

Security log events: 4720 (account created), 4722 (enabled), 4724 (password reset), 4732 (member added to a local group), 4738 (account changed), 4781 (account renamed), and 4624 logon type 10 for Remote Desktop. RID hijacking produces none of the account-management events; only auditing set on the SAM keys records it.

What Windows Persistence flags

The tool reads the SAM hive: names, RIDs, full names, the disabled flag, last logon, logon count, the Names key time as creation time, the RID stored in F, and the members of Administrators and of Remote Desktop Users. It adds profiles from ProfileList (domain or deleted accounts appear as "profile only") and hidden names from UserList. Password hashes are never read.

The Accounts tab lists every account; "Hide Windows' built-in accounts that are disabled" hides RIDs 500 to 504 while they are disabled and unflagged. Accounts that raise a flag also appear in the entries, under Accounts:

  • Account hidden from the sign-in screen (high): the name has a value of 0 in UserList.
  • RID hijacking: account carries RID number (high): the RID in F differs from the key's.
  • Guest account enabled (high): RID 501 is not disabled.
  • Built-in Administrator enabled (low): RID 500 is not disabled; this is normal on Windows Server.
  • Built-in DefaultAccount or WDAGUtilityAccount enabled (medium): RID 503 or 504 is not disabled.
  • Account name ends in $ (high): a local account in the SAM that net user does not list.
  • Member of Administrators (info): every member other than RID 500, so the list of administrators is always in front of you.
  • Member of Remote Desktop Users (info): the account may sign in over Remote Desktop.
  • Administrator account created date (high) and Account created date (medium): the Names key was written in the 7 days before the newest time seen on that host.

Elsewhere, the command-line rule Creates an account or grants admin flags autostarts that run net user … /add or net localgroup administrators … /add.

Limits: the Names key time also changes when an account is renamed, so a renamed built-in Administrator looks new, and on a machine installed in the week before the collection every account does. Only Administrators and Remote Desktop Users are read, not other groups or nested domain groups, and password settings such as "password never expires" are not flagged. An account whose F value is missing has an unknown state and raises no enabled-account flag. Without the SAM hive, only accounts with a profile are listed.

Cleaning up

  1. Preserve: copy the SAM, SYSTEM and SOFTWARE hives (they hold password hashes: treat them as evidence), export the Security log, and note the account's SID, groups and times.
  2. Disable before deleting, so nothing breaks while you investigate: Disable-LocalUser -Name svc_backup, Remove-LocalGroupMember -SID S-1-5-32-544 -Member svc_backup, and delete its value from UserList.
  3. Once evidence is safe, Remove-LocalUser -Name svc_backup, then delete its profile (System Properties, Advanced, User Profiles).
  4. For a hijacked built-in account such as Guest, disable it. Restoring its F value means editing the SAM as SYSTEM; rebuilding the machine is often the cleaner choice.
  5. Look for what the account set up: scheduled tasks and services running as it, Run keys in its profile, and remote access tools.
  6. Reset the passwords of every local administrator (or let LAPS rotate them), disable Guest and the built-in Administrator again, and find how the attacker got the rights to create the account.

See also

On Windows Forensics

The artifacts behind this technique, in the Windows Forensics reference: