Question

In: Computer Science

. Compare and contrast the Windows password hashing algorithm and the Linux password hashing algorithm demonstrated...

. Compare and contrast the Windows password hashing algorithm and the Linux password hashing algorithm demonstrated in the book

Solutions

Expert Solution

You really need to know only the following three basic concepts before extracting Windows hashes:

LM hash

LAN Manager (LM) hash is an old and weak Windows technique for creating hashed passwords, which has been disabled by default in current Windows environments. But this can still be enabled manually on current systems — See Microsoft documentation on how to protect your systems from using it:

Network security Do not store LAN Manager hash value on next password change (Windows 10)

Describes the best practices, location, values, policy management and security considerations for the Network security…

docs.microsoft.com

The reason why LM hash is easier to break is because passwords are not case sensitive, password length is maximum 14 characters and more importantly because it breaks the text in two halves of seven characters before hashing them separately and concatenating. So if your password is less than seven characters, it should be a breeze for a hacker to guess the password. [1]

NT hash or NTLM hash

New Technology (NT) LAN Manager hash is the new and more secure way of hashing passwords used by current Windows operating systems. It first encodes the password using UTF-16-LE and then hashes with MD-4 hashing algorithm.

If you need to know more about Windows hashes, the following article makes it easy to understand [2]

SAM database file

Security Account Manager (SAM) is the database file that stores the user’s password in the hashed format. You would need access to this file in order to retrieve hashes from your local or remote Windows machine [3]

Extracting local hashes from Windows Server 2016

In this section, I will show you how to extract hashed passwords from your Windows desktops using a very popular and powerful tool — mimikatz. The screenshots are from Windows Server 2016.

Step 1: Download mimikatz

Binaries are available at — https://github.com/gentilkiwi/mimikatz/releases

Step 2: Run (regedit)

Step 3: Navigate to HKEY_LOCAL_MACHINE and export SAM registry file and SYSTEM registry file to the same directory as the mimikatz installation. Save the files as “Registry hive files”

Your mimikatz directory should look as below:

Step 4: Run mimikatz.exe and type “lasdump::sam” command followed by the file paths of sam and system file:

lsadump::sam sam3.hiv system.hiv

If you get an error as below, you will need to elevate permissions of mimkatz

Step 5: Type “token::elevate” to elevate the permissions

Step 6: Type the lsadump command again and you should now see the hash values of local users

Confirm if you got the right hash

Use Windows commands to create local users and extract the generated NTLM hash using the above process. Once you have the hash, use the below online utility to generate hashes by yourself and confirm if it matches.

https://www.browserling.com/tools/ntlm-hash [4]

Windows commands for user and password modifications:

List of all users → net user

Add user → net user /add username -key=”password”

Update password of user → net user username newpassword

Other tools that can be used in place of mimikatz:

HashSuite, fqdump, pwdump2

Password cracking/guessing tools:

L0phtCrack, Cain and Abel, John the Ripper

In Linux distributions login passwords are commonly hashed and stored in the /etc/shadow file using the MD5 algorithm. The security of the MD5 hash function has been severely compromised by collision vulnerabilities. This does not mean MD5 is insecure for password hashing but in the interest of decreasing vulnerabilities a more secure and robust algorithm that has no known weaknesses (e.g. SHA-512) is recommended.

The following tutorial uses the SHA-512 hash function, which has been recommended by the United States' National Security Agency (NSA) for Red Hat Enterprise Linux 5. Alternatively, SHA-2 consists of four additional hash functions with digests that are 224, 256, 384, and 512 bits.

If your current password was created with shadow version prior to 4.1.4.3-3 (2011-11-26) you are using MD5. To start using a SHA-512 hash you just need to change your password with passwd.

The rounds=N option helps to improve key strengthening. The number of rounds has a larger impact on security than the selection of a hash function. For example, rounds=65536 means that an attacker has to compute 65536 hashes for each password he tests against the hash in your /etc/shadow. Therefore the attacker will be delayed by a factor of 65536. This also means that your computer must compute 65536 hashes every time you log in, but even on slow computers that takes less than 1 second. If you do not use the rounds option, then glibc will default to 5000 rounds for SHA-512. Additionally, the default value for the rounds option can be found in sha512-crypt.c.

Open /etc/pam.d/passwd with a text editor and add the rounds option at the end of of the uncommented line. After applying this change the line should look like this:

password        required        pam_unix.so sha512 shadow nullok rounds=65536

Note: For a more detailed explanation of the /etc/pam.d/passwd password options check the pam_unix(8) man page.

Re-hash the passwords

Even though you have changed the encryption settings, your passwords are not automatically re-hashed. To fix this, you must reset all user passwords so that they can be re-hashed.

As root issue the following command,

# passwd username

where username is the name of the user whose password you are changing. Then re-enter their current password, and it will be re-hashed using the SHA-2 function.

To verify that your passwords have been re-hashed, check the /etc/shadow file as root. Passwords hashed with SHA-256 should begin with a $5 and passwords hashed with SHA-512 will begin with $6.


Related Solutions

a) b) c) Compare and contrast systems programming in Windows as against systems programming in Unix/Linux....
a) b) c) Compare and contrast systems programming in Windows as against systems programming in Unix/Linux. CR, 8 Explain the term structured exception handling (SEH) as used in systems programming and give a practical example of how it can be used to handle errors in a block of code. AP, 7 Write a C/C++ system program to delete an unwanted file in the Windows file system. Compile and run the program and copy the source code into your answer booklet....
Contrast the behavior of windows OSs with regard to group membership concurrently with the Linux approach...
Contrast the behavior of windows OSs with regard to group membership concurrently with the Linux approach of single group membership at a moment in time. How does this approach effect cumulative group permissions in Linux?
Read the article Salted Password Hashing - Doing it Right (CrackStation) and share understanding and findings...
Read the article Salted Password Hashing - Doing it Right (CrackStation) and share understanding and findings through a technical summary.
What are some deadlocks examples that are frequently observed on Windows and on Linux?
What are some deadlocks examples that are frequently observed on Windows and on Linux?
provide 3 different distributions of Linux. compare and contrast regarding strengths for each distribution. [ only...
provide 3 different distributions of Linux. compare and contrast regarding strengths for each distribution. [ only 10 sentences or less }
Differences Between Linux and Windows Operating Systems Two key differences between a Linux operating system and...
Differences Between Linux and Windows Operating Systems Two key differences between a Linux operating system and a Windows operating system are the concepts of “mounting” and “drive” letters. Provide an example for each. Why is it important to plan disk partitioning before installing Linux? Discuss the advantages of disk partitioning. Also discuss what logical volume management (LVM) is and why or why you might use it.
What have been the major changes in the file systems for Windows and for Linux?
What have been the major changes in the file systems for Windows and for Linux?
Explain how Windows and Linux can work together in diverse environments.
Explain how Windows and Linux can work together in diverse environments.
Develop an algorithm to demonstrate hashing using hash table with modulo as the hash function. Assume...
Develop an algorithm to demonstrate hashing using hash table with modulo as the hash function. Assume the size of the hash table as 10. To avoid collisions in case of identical keys for two different elements, use Linear Probing collision resolution technique. using c++ add comment on the code
Study PC operating system such as windows and linux etc and mobile operating system such as...
Study PC operating system such as windows and linux etc and mobile operating system such as Android and iOS, find out whether there are functions and features that are provided in PC OS but not in mobile OS, and if there is any, analyze why these functions and features are not provided by these mobile OS. In your opinion for the future development will PC operating system and mobile operating system be the same or different? Give the details.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT