Password Attackspasswordrecoverywindowssamregistryntforensics

chntpw

chntpw is an NT SAM password recovery utility that allows viewing information and changing user passwords in Windows NT/2000 user database files without knowing the old passwords. It includes a registry editor and hex-editor for modifying registry hives and file contents.

Description

This tool provides a way to edit user passwords in Windows SAM files by overwriting them, making old passwords unnecessary. It supports both 32 and 64-bit Windows from NT3.x to Win8.1 and includes utilities for registry editing, password resets, user unlocking, and group management in SAM databases. Users can be specified by username or RID in hex format.

Use cases include offline password recovery from Windows systems, such as during forensic investigations or when booting from GNU/Linux disks with extracted SAM, SYSTEM, SECURITY files. The package also offers specialized tools like reged for registry hive export/import/editing, sampasswd for batch password resets, samunlock for unlocking accounts, and samusrgrp for adding/removing users from groups.

Note that the program is described as somewhat hackish, and users proceed at their own risk. It can be added to custom GNU/Linux bootdisks for offline recovery, with source/binary under GPL v2 license.

How It Works

chntpw directly parses and modifies Windows SAM files (user database), SYSTEM, SECURITY, and other registry hives by overwriting password hashes, editing registry values with size-preserving writes, and using hex-editing for low-level bit/byte manipulation. It handles NTLM hash structures across Windows versions, supports interactive menus or scripted operations, and logs changes to /tmp/changed. Related tools like reged manage registry exports/imports with prefix paths like HKEY_LOCAL_MACHINE\SOFTWARE, while sampasswd/samunlock/samusrgrp target specific SAM operations like RID-based resets or group SID modifications.

Installation

bash
sudo apt install chntpw

Flags

-hThis message
-u <user>Username or RID (0x3e9 for example) to interactively edit
-llist all users in SAM file and exit
-iInteractive Menu system
-eRegistry editor. Now with full write support!
-dEnter buffer debugger instead (hex editor)
-vBe a little more verbose (for debuging)
-LFor scripts, write names of changed files to /tmp/changed
-rreset users password (sampasswd)
-llist users in sam (sampasswd)
-UUnlock user (samunlock)
-aadd user to group (samusrgrp)
-rremove user from group (samusrgrp)

Examples

Display help message for chntpw
chntpw -h
List all users in SAM file and exit
chntpw -l <samfile>
Interactively edit username or RID user in SAM file
chntpw -u <user> <samfile>
Invoke registry editor with full write support
chntpw -e <samfile>
Reset password of user named 'theboss' if found
sampasswd -r -u theboss <samhive>
Reset password for user with RID 0x3ea (hex)
sampasswd -r -u 0x3ea <samhive>
Reset password of all users in administrators group (0x220)
sampasswd -r -a <samhive>
Unlock user named 'theboss' if found
samunlock -U -u theboss <samhive>
Add user named 'theboss' to group hex 220 (administrators)
samusrgrp -a -u theboss -g 0x220 <samhive>
Updated 2026-04-16kali.org ↗