|
English Russian |
|
LCP SID&User |
Theory and practice of password auditing and recovery in Windows NT/2000/XP/2003 Windows NT/2000/XP/2003 operating systems keep their passwords into an encrypted form called "hashes". Passwords cannot be retrieved directly from hashes. To recover passwords it is necessary to compute hashes by possible passwords and compare them to the existing hashes. Password auditing includes check of possible ways to retrieve user accounts information. Result of password recovery is passwords in case-sensitive form. Obtaining password hashes There are several ways to obtain password hashes, depending on their location and existing access. Password hashes can be obtained from SAM file or its backup, directly from local or remote computer registry, from registry or Active Directory on local or remote computer by means of DLL injection, from a network sniffer. Obtaining password hashes from SAM file User accounts, which also contain users names and their passwords, are kept in the Windows NT/2000/XP/2003 registry and exactly in the SAM file (Security Account Manager). This file can be found on the disk in the %SystemRoot%\system32\config directory, emergency repair disk or on a backup tape. It is impossible to gain access to the SAM file located in the %SystemRoot%\system32\config directory, while Windows NT/2000/XP/2003 is running because it is used by the operating system. If there is a physical access to the machine, it is possible to copy the SAM file by booting operating system copy or another operating system. If Windows NT/2000/XP/2003 is installed to the disk with NTFS file system, accessing it from MS-DOS or Windows 95/98/Me will require additional software. In MS-DOS can be used such programs as NTFSDOS and NTFSDOS Professional, in Windows 95/98/Me - NTFS for Windows 98 (by Mark Russinovich and Bryce Cogswell). Accessing from Linux operating system will require an NTFS support turned on. It is also possible to boot from a floppy disk and copy SAM file, having launched a program to access NTFS in advance. After this you need to import from SAM file. Extracting password hashes from a SAM file was first developed and applied in SAMDump program (by Dmitry Andrianov). During a SAM file import operation, obtaining of user accounts information is performed. The import from SAM file is similar to the obtaining of password hashes using pwdump method, except for the fact that instead of Windows API functions, supporting the registry operations, their emulations are used. During the import from SAM file by SAMDump, all non-Latin characters, contained in the user names, will be distorted. LCP program is free of this disadvantage. The way to obtain a SAM file in Windows NT operating system, which does not require a computer rebooting, is copying it from %SystemRoot%\repair directory or emergency repair disk. Every time when an emergency repair disk in Windows NT is created by RDISK program, a SAM file packed and saved to a sam._ file, which is in fact backup copy of a SAM file. A sam._ file is an archive in the cabinet format. This file can be unpacked by the command "expand sam._ sam". The disadvantage of this method is that some passwords might have been changed since the emergency repair disk creation and sam._ file might be outdated. LCP program has a built-in ability to import SAM file from a sam._ file without using the expand program. A sam._ file is preliminary unpacked while import of user accounts list process and then the actual SAM file import is performed. A SAM file is also copied when a complete backup copy is created. If there is an access to a backup copy, a SAM file can be recovered from %SystemRoot%\system32\config directory to a different machine and after all extract password hashes from it. The disadvantage of this method is also that passwords might have been changed since the last time of backup copy creation. There is the SYSKEY tool, which first appeared in Service Pack 3 for Windows NT. SYSKEY additionally encrypts password hashes of user accounts, which makes import from SAM file by SAMDump useless. SYSKEY can be used in one of the following variants:
Storing of the startup key in the registry is by default used. For more details regarding SYSKEY tool see article KB143475 Windows NT System Key Permits Strong Encryption of the SAM. For extra protection, the SYSKEY tool should be activated manually after required Service Pack installation in Windows NT. In Windows 2000/XP/2003 operating systems the SYSKEY tool primary installed and activated. Import from SAM file with additionally SYSKEY encryption, was first realized in SAMInside program (by PolASoft and Ocean). The SYSKEY algorithm was first published by FlashSky from Xfocus Team. To import from SAM file, while startup key is stored in the registry, it is required to copy SAM and SYSTEM files from %SystemRoot%\system32\config directory and then open them. If there is not enough space on a floppy disk, files can be compressed before copying. Backup files copies can also be found in the %SystemRoot%\repair directory, in case they have been archived there before. While keeping startup key on the floppy disk, StartKey.Key file is also required for import from SAM file. LCP makes import from SAM file with or without additional encryption at any startup key storing variant possible. Obtaining password hashes from operating system registry Obtaining password hashes from operating system registry requires direct access to the registry. Information import requires administrative privileges at the computer, which passwords dump you need create. If it is not a local computer, a remote access to the registry and required privileges must be permitted. Obtaining hashes through this method was first performed in pwdump program (by Jeremy Allison). During information import using this method by pwdump program, user names containing non-Latin characters will be distorted. It is recommended to use LCP for obtaining password hashes from the registry. In case that SYSKEY program is activated, password hashes will be additionally encrypted. It makes import by pwdump program useless, because it is impossible to recover passwords from additionally encrypted hashes. In LCP program obtaining password hashes from registry is enhanced by support of additional encryption, therefore it is recommended to use LCP. Obtaining password hashes by DLL injection This method was first developed and realized in pwdump2 program (by Todd A. Sabin). Obtaining password hashes by pwdump2 method is possible with no regards to the SYSKEY program activated or not. To create a passwords dump by pwdump2 method, you need the SeDebugPrivilege. By default, only Administrators have this right, so administrator privileges are required for use of this method. Pwdump2 method is applicable to a local machine only. Pwdump2 method uses DLL injection for passwords dump creation. One process forces another process (lsass.exe), using its process identifier, to load a DLL (samdump.dll) and execute some code from the DLL in the other process's (lsass.exe's) address space. In this case, samdump.dll is loaded into lsass (system service LSASS - Local Security Authority Subsystem), it uses the same internal API that msv1_0.dll uses to access the password hashes. This means it can get the hashes without doing any of the hard work of pulling them out of the registry and decrypting them. The program neither knows nor cares what the encryption algorithms or keys are. There is a mistake in pwdump2 program version supporting Active Directory, which prevents obtaining password hashes if in operating system there are accounts with non-Latin characters in user names. This mistake is fixed in the LCP program, therefore it is recommended to use it for obtaining password hashes by this method. The method used in pwdump2 program was further developed to obtain password hashes not only from a local but a remote computer also in pwdump3/pwdump3e programs (by Phil Staubs). An executive service file and DLL file are copied to the remote computer. After copying process completed, a new service, equal to pwdump2 program on a local computer, is created and started. After obtaining password hashes, the service and files previously copied are deleted. The transfer of user accounts information is performed through a registry key on a remote computer. This key is temporarily created and permanently deleted after the copying process is completed. In pwdump3e program an additional encryption of transferred data by Diffie-Hellman algorithm is performed. This is done on purpose to prevent illegal access to the transferred data in case of network capture. This method also requires administrative privileges at the computer, which user accounts information you need to obtain. During information import using this method by pwdump3/pwdump3e programs, user names containing non-Latin characters will be distorted. It is recommended to use LCP for obtaining password hashes by DLL injection. In case you do not have administrative privileges at the local computer, it is possible to use a vulnerability of Windows NT/2000/XP/2003 operating systems, which in fact allows to change a screen saver, launched in case of logon absence for the particular amount of time (it is 15 minutes for Windows NT/2000 and 10 minutes for Windows XP/2003 by default) to a different program. To perform this, you need to change %SystemRoot%\system32\logon.scr to desired executive file (cmd.exe for example), which will be launched by the operating system instead of screen saver with system privileges. This change can be done by method used to copy a SAM file. You can get an access with write capability to a NTFS disk by NTFSDOS Professional or NTFS for Windows 98 programs. After this you need obtain hashes by pwdump2 or pwdump3/pwdump3e methods. Network capture of authentication packets Even in case when SYSKEY program is installed and activated and there is no required access to a remote or local computer, there is still a possibility to obtain password hashes of user accounts. By this possibility we mean network capture of authentication packets - sniffing. A client machine is exchanging authentication packets with a server each time it is required to prove a user privileges. It is only required that a targeting computer is in the same network segment as yours. A built-in sniffer of LC5, works at machines with Ethernet adapter and supports Windows NT/2000/XP/2003 and Windows 95/98/Me. LC5 program needs to be launched in the network capture mode and left for a certain amount of time to gather required password hashes. The captured data needs to be saved to a file. After this, you need to import LC5 session file in LCP. To prevent obtaining password hashes by this method, Microsoft has developed an enhancement to the authentication mechanism called NTLMv2. Its usage becomes possible after Service Pack 4 for Windows NT installation. For more details regarding NTLMv2 usage see article KB147706 How to Disable LM Authentication on Windows NT. Passwords recovering A password can be derived in different ways: dictionary attack, brute force attack, hybrid of dictionary and brute force attacks, precomputed hashes attack. Within a dictionary attack, hashes are gradually computed for each single word or word modifications from a dictionary and compared with the password hashes of each particular user. In case of the complete hashes match a password is found. An advantage of this method is its high speed, a disadvantage - only very simple passwords, which are based on the existing words of the used dictionary, can be retrieved by this method. Brute force uses a character set and computes a hash for each possible password, compiled out of these characters. While using this method you can be sure that a password will be recovered in case that it contains the characters from the current character set. The only disadvantage of this method is a huge amount of time that might be required to retrieve a password. The more characters are contained in selected character set - the more time will be spent on passwords retrieving. While passwords recovering by hybrid of dictionary and brute force attacks, characters are added to the right and/or left of the words or words modifications. A hash is computed for each assembled combination and compared with the users password hashes. To perform precomputed hashes attack, hashes are precomputed and password/hash pairs are stored for all possible combination of the chosen character set. Available password hashes are being searched among precomputed hashes. An advantage of this method is its very high speed, a disadvantages are long time to precompute hashes and huge amount of disk space needed for their storing. After obtaining password hashes, you can start passwords recovering. There are two basic file types containing password hashes: PwDump (passwords dump) and Sniff files. Each string of a PwDump file is compiled in the following format: Each string of a Sniff file is compiled in the following
format: The first program for recovering of Windows NT passwords was L0phtCrack (called now LC5) by Peiter Mudge Zatko and Chris Wysopal from L0pht Heavy Industries, Inc. (now @stake, Inc.). If non-Latin characters in password are used then password will probably not be recovered with LC5, it is recommended to use LCP for passwords recovering. Changing users passwords without their recovering In case recovering of Windows NT/2000/XP/2003 users passwords is not required, it is possible to change them having access to a local computer. Users passwords changing is performed in Offline NT Password & Registry Editor program (by Petter Nordahl-Hagen). To do this, you need to boot from Linux floppy disk and choose a user to change password. After input of the password, password hash will be computed and SAM file will be changed in system disk. The program supports Windows NT/2000/XP/2003 even in case SYSKEY is activated. Additional possibilities of obtaining passwords information In case there are computers with Windows 3.11, Windows for Workgroups or Windows 95/98/Me installed in network, there are additional possibilities of obtaining passwords information. Users passwords caching is performed to the %WinDir%\<UserName>.pwl (PassWord List) files in such operating systems by default. Passwords are kept encrypted in case-insensitive form (in upper case). Passwords encrypting algorithm was changed starting from Windows 95 OSR2, because detected mistake was corrected. Therefore passwords recovering from old PWL files is much easier. In this case you can use programs like Glide (by Frank Andrew Stevenson), PWL_Key (by Arthur Ivanov), PwlHack (by Vladimir Kalashnikov), PwlTool (by Vitas Ramanchauskas and Eugene Korolev). For passwords recovering from newer PWL files you can use PwlHack or PwlTool. If passwords caching is permitted, there is a possibility to determine passwords during a user session in PwlView program (by Vitas Ramanchauskas and Eugene Korolev). This program can show the cached passwords on the local machine for the current user using undocumented Windows API functions. In case a Windows NT/2000/XP/2003 user is at the same time a user in Windows 3.11, Windows for Workgroups or Windows 95/98/Me and his password is already retrieved (for Windows 3.11, Windows for Workgroups or Windows 95/98/Me), his password for Windows NT/2000/XP/2003 can be easily retrieved by LCP. It is necessary to specify characters of the recovered Windows 3.11, Windows for Workgroups or Windows 95/98/Me password as known password characters. Recommendations for Windows 3.11, Windows for Workgroups and Windows 95/98/Me administrator At the computers with Windows 3.11, Windows for Workgroups and Windows 95/98/Me installed:
Recommendations for Windows NT/2000/XP/2003 administrator At the computers with Windows NT/2000/XP/2003 installed:
|
|
Copyright (c) 1998-2007 LCPSoft, All rights reserved. E-mail support@lcpsoft.com |