Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesPassword Protection at a Price


November 1997 / Features / Déjà Vu All Over Again / Password Protection at a Price

On July 14, 1997, Microsoft quietly admitted a major security problem with all versions of Windows NT. Simply put, the encryption implementation in NT 4.0 makes it possible to extract all the LAN Manager and NT user names and passwords in any NT workstation, server, or domain. After this, you can then brute-force the plain-text passwords.

Microsoft Knowledge Base "Document:Q147706" (it can be found at ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes/usa/NT40/hotfixes-postSP3/lm-fix/Q147706.txt ) is a disturbing mea culpa. The essence of the document is that security has a price -- a very high price. Microsoft will guarantee security for your network only if all clients and servers are 100 percent NT. If your n etwork has clients that require the LAN Manager protocol, such as Windows 95, Windows for Workgroups, or regular Windows 3.1, anyone with the right tools can intercept the obfuscated user names and passwords, and extract their plain-text equivalent.

A white paper by the researcher known on the Internet as hobbit started it all, analyzing bit by bit the CIFS protocol used by NT. Dominique Brezinski of Cybersafe then released a paper that concentrated on the man-in-the-middle problem in the process. From down under, an anonymous Australian programmer released the source that allowed the programmatic deobfuscation of LAN Manager and NT hashes from the NT registry.

Cygnus programmer Jeremy Allison quickly cleaned it up and released PWDump, which was meant to be a password audit tool for NT. PWDump unleashed a storm of controversy after it was incorporated in a Trojan horse by a Bay Area-based programmer. Later, the hacker group that's known as the L0pht built a sophisticated brute-force password cracker that extracted plain-text passwords from the PWDump hashes.

NT's security is based on two cryptographic methods: the IBM-sired LAN Manager security protocol and the NT security protocol. While each has strengths and weaknesses, together they prove to be disastrous, because the weaker LAN Manager protocol emasculates the stronger NT protocol. Unfortunately, because of backward-compatibility requirements, Microsoft continues to use the weak LAN Manager protocol.

Why is the LAN Manager protocol weak? It's the implementat ion. In a nutshell, LAN Manager hashes the passwords in a predictable way and does not use salting (the process of inserting several random bits into the hash).

From our research, we have found that you have to go through only seven characters to retrieve passwords (up to 14 characters in length) in the LAN Manager hash. Also, because no salting is being done, constants show up all over the place, giving away too much information and speeding up attacks tremendously.

The first 8 bytes are derived from the first seven characters of the password, and the second 8 bytes are derived from the eighth through fourteenth characters of the password. If the password is less than seven characters, the second half is always the same.

Let's assume for this example that the user's password has an LM hash of -0xC23413A8A1E7665fAAD3B435B51404EE (I will save everyone the nanosecond it would have taken for them to plug this into L0phtcrack and have it tell them the password is "WELCOME").

The following is what happens to this hash on the network:

System B sends an 8-byte challenge to system A. (Assume 0x0001020304050607.)

Machine A takes the hash of 0xC23413A8A1E7665fAAD3B435B51404EE and adds five nulls, thus becoming 0xC23413A8A1E7665fAAD3B435B51404EE0000000000. This string is broken into three groups of seven.

The 7-byte strings are str_to_key'd (if you will) into three 8- byte odd-parity DES keys.

Then, 8byteDeskey1 is used to encrypt the challenge 0x0001020304050607. Let's assume the result is 0xAAAAAAAAAAAAAAAA.

Next, 8byteDeskey2 is used to encrypt the challenge 0x0001020304050607. Let's assume the result is 0xBBBBBBBBBBBBBBBB.

Next, 8byteDeskey3 is used to encrypt the challenge 0x000102-0304050607. Let's assume the result is 0xCCCCCCCCCCC-CCCCC.

The three 8-byte values are concatenated (dumb), and the 24-byte response of 0xAAAAAAAABBBBBBBBCCCCCCCC is returned to the server. The server does the same thing to the hash on its end and compares the result to the 2 4-byte response. If they match, it was the correct original hash.

Why is this weak? The first thing we check to see is if the user's password is less than eight characters in length. We do this by taking the 7-byte value of 0x04EE0000000000, turning it into an 8-byte odd-parity DES key, and encrypting it against the 8- byte challenge of 0x0001020304050607. If we get the result of 0xCCCCCCCCCCCCCCCC, we are pretty sure it's fewer than eight characters in length.

To be sure, we can run through 0x??AAD3B435B514 (i.e., 256 possible combinations) to see that 5f shows us that the result is 0xBBBBBBBBBBBBBBBB, proving that the password is less than seven characters and also giving us the last byte of the first half of the LAN Manager hash.

Note that we're not worried about optimizing the way this is done, and that there are much more effective ways to do this that reduce the amount of time required even further. Even so, this shows that even a simplistic attack works against this implementation, an d it's no different than how a tool such as L0phtcrack attacks the hashes in the registry.

What if the password is eight characters or more? Let's say that machine A takes the hash of C23413A8A1E766AC435F2DD90417CCD6 and adds five nulls to it, thus becoming C23413A8A1E766AC435F2DD90417CCD60000000000.

The first thing to check is if the password is fewer than eight characters in length. Deriving the 8-byte odd-parity DES key from 0x04EE0000000000 and encrypting against 0x0001020304050607 does not, in this case, give us 0xCCCCCCCCCCCCCCCC, so we know that the password is eight characters or greater.

It takes us, in a worst-case scenario, 65,535 checks to figure out that the 2 bytes that are used in the last third are 0xCCD6.

You can go through your seven-digit combinations of characters for the first third the same way you would the LAN Manager hash from the registry. This will yield not only the first third of the response, but also the first byte of the second third. Keep in mind that y ou already have the last 2 bytes that made up the final third. You can approach the middle third in the same fashion.

Together, these problems enable utilities such as L0phtcrack to get and decrypt passwords quickly using brute-force methods.

Because opting out of the LAN Manager security model precludes continued use of Windows 95 machines as clients to NT machines, it is still a moot point as to how tough or well done the NT hash might or might not be.


Up to the Features section contentsGo to previous article: Password Protection at a PriceGo to next article: Components Battling ComponentsSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network