Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/pxesploit/regeditor/README.txt
Views: 11778
1The Offline NT Password Editor23(c) 1997-2010 Petter Nordahl-Hagen45This is free software, licensed under the following:67"ntreg" (the registry library) is licensed under the GNU Lesser Public8License. See LGPL.txt.910"chntpw" (the password reset / registry editor frontend) is licensed11under the GNU General Public License, see GPL.txt.1213"reged" (registry editor /export tool) is licensed14under the GNU General Public License, see GPL.txt.1516See INSTALL.txt for compile/installation instructions.1718Where to get more info:19-----------------------2021http://pogostick.net/~pnh/ntpasswd/2223At that site there's a floppy and a bootable CD that use chntpw to24access the NT/2k/XP/Vista-system it is booted on to edit password etc.25The instructions below are for the standalone program itself, not the floppy.2627What does chntpw do?28--------------------2930This little program will enable you to view some information and31change user passwords in a Windows NT SAM userdatabase file.32You do not need to know the old passwords.33However, you need to get at the file some way or another yourself.34In addition it contains a simple registry editor with full write support,35and hex-editor which enables you to36fiddle around with bits&bytes in the file as you wish yourself.3738Why?39----4041I often forget passwords. Especially on test installations (that42I just _must_ have some stuff out of half a year later..)43On most unix-based boxes you just boot the thingy off some kind44of rescue bootmedia (cd/floppy etc), and simply edit the45password file.46On Windows NT however, as far as I know, there is no way except reinstalling47the userdatabase, losing all users except admin.48(ok, some companies let you pay lotsa $$$$$ for some rescue service..)4950How?51----5253Currently, this thing only runs under linux, but it may just happen54to compile on other platforms, too.55(there are dos-versions available, look for links on my webpage)56So, to set a new adminpassword on your NT installation you either:571) Take the harddrive and mount it on a linux-box582) Use a linux-bootdisk or CD59one is available at: http://pogostick.net/~pnh/ntpasswd/60ie. you do it offline, with the NT system down.6162Usage:63------6465This is usage of the "chntpw" program binary only.66For info on the bootdisk, see the web site.67Some of the output format has changed a little since the docs were68first written.6970chntpw version 0.99.2 040105, (c) Petter N Hagen71chntpw: change password of a user in a NT SAM file, or invoke registry editor.72chntpw [OPTIONS] <samfile> [systemfile] [securityfile] [otherreghive] [...]73-h This message74-u <user> Username to change, Administrator is default75-l list all users in SAM file76-i Interactive. List users (as -l) then ask for username to change77-e Registry editor. Now with full write support!78-d Enter buffer debugger instead (hex editor),79-t Trace. Show hexdump of structs/segments. (deprecated debug function)80-v Be a little more verbose (for debuging)81-L Write names of changed files to /tmp/changed82-N No allocation mode. Only (old style) same length overwrites possible8384Normal usage is:8586> chntpw sam system security87- open registry hives 'sam' and 'system' and change administrator account.88Verions dated later from Feb 1999 and later also supports89and will find the admin account, even if the name has been changed,90or the name has been localized (different languageversion of NT91use different admin-names)9293The -u option:94Specifies user to change:9596> chntpw -u jabbathehutt mysam97- Prompt for password for 'jabbathehutt', if found (otherwise do nothing)9899Or you may give RID number in hex:100> chntpw -u 0x1f4 mysam101- Will edit administrator.102103Names does not support multibyte (unicode) characters like104some russian and asian locales. Give RID in hex to edit users105with such names. Must start with 0x. Ex: 0x2fa106107The -l option:108Will list all users in the sam-file.109110The -i option:111Go into the interactive menu system.112113The -d option:114This will load the file, and then immediately enter the115buffer debugger.116This is a simple hex-editor with only a few commands,117enter ? at the . prompt to se a short command overview.118'q' exits without saving, 's' exit and saves.119120The -e option:121Will enter the registry editor.122You can navigate the registry like a filesystem at the command-line prompt:123See regedit.txt file for more info.124125The -t option:126This is a debug function (extended -l) to show how it traces the chain127of structs in the file. This also includes a raw interpretation128of the different registry structures + a hex dump.129130The -L option:131Drops the filenames of the changed hives in /tmp/changed132Used by the bootdisk scripts.133134The -N option:135Will fall back to old edit mode, disable the block allocations136and only support overwrite-same-size. Used to ensure safety137in testing period.138139How does it work:140-----------------141142A struct, called the V value of a key in the NT registry143was suddenly somewhat documented through the pwdump utility144included in the unix Samba distribution.145This struct contains some info on a user of the NT machine,146along with 2 crypted versions of the password associated147with the account.148149One password is the NT console login password,150the other the LANMAN network share password151(which essentially is the first one in uppercase only,152and no unicode)153154This is how NT encrypts the passwords:155156The logon cleartext password a user enters is:1571) Converted to unicode1582) A MD4 hash is made out of the unicode string1593) Then the hash is crypted with DES, using the RID (lower160part of the SID, userid) as the crypt key.161This is the so called "obfuscation" step, so162it's not obvious on a hex dump of the file163that two or more users have the same password.1644) The result of stage 3 (16 bytes) is put into the V struct.165166For the LANMAN password:1671) Uppercased (and illegal characters probably removed)16814 bytes max, if less the remaining bytes are zeroed.1692) A known (constant) string is DES-encrypted170using 7 first characters of the password as the key.171Another constant is encrypted using the last 7 chars172as the key.173The result of these two crypts are simply appended,174resulting in a 16 byte string.1753) The same obfuscation DES stage as 3 above.1764) 16 bytes result put into the V struct.177178Since the number of possible combinations in the lanman179password is relatively low compared to the other one,180and it's easy to see if it's shorter than 8 chars or not181it's used first in brute-force-crackers.182183This program, however, don't care at all what the old184one is, it just overwrites it with the new one.185186Ok. So, how do we find and identify the V struct?187Yeah.. that was the hard part.. The files structure188is not documented (as far as I know..)189190But, with help from an unnamed German, and a lot of testing191and guesswork from myself, it's now possible to follow192the actual registry tree. (see source code for struct-defines193and comments on the registry structure)194195The usernames are listed in:196\SAM\Domains\Account\Users\Names\197198[2d18] \SAM\Domains\Account\Users\Names> l199ls of node at offset 0x2d1c200Node has 4 subkeys and 1 values201nk-offset name2020x003290 - <Administrator>2030x003630 - <Guest>2040x001c88 - <luser>2050x003428 - <pnh>206207Each name is a subkey, with one namless value containing208the RID.209210[2d18] \SAM\Domains\Account\Users\Names> cd pnh211212[3428] \SAM\Domains\Account\Users\Names\pnh> l213ls of node at offset 0x342c214Node has 0 subkeys and 1 values215vk-offs size type name2160x003688 0 (unknown) <> INLINE: val (in type field?): 1000 (0x3e8)217218To get the userinfo (V struct), access219\SAM\Domains\Account\Users\<RID>\V220221[2c90] \SAM\Domains\Account\Users> l222ls of node at offset 0x2c94223Node has 5 subkeys and 1 values224nk-offset name2250x003320 - <000001F4>2260x0036b8 - <000001F5>2270x003550 - <000003E8>2280x001d00 - <000003E9>2290x002d18 - <Names>230231[2c90] \SAM\Domains\Account\Users> cd 000003E8232233[3550] \SAM\Domains\Account\Users\000003E8> l234ls of node at offset 0x3554235Node has 0 subkeys and 2 values236vk-offs size type name2370x0035a8 80 REG_BINARY <F>2380x003228 508 REG_BINARY <V>239240For more techincal info, look it up in the source code.241242243