L0phtcrack 1.5 Lanman / NT password hash cracker
Description: | The Lanman password hash is used by NT for authenticating users locally and over the network (MS service packs are now out that allow a different method in both cases). L0phtcrack can brute-force these hashes (taken from network logs or progams like pwdump) and recover the plaintext password. l0phtcrack 1.5 also breaks the new NT style password hashes. |
Author: | Mudge <mudge@l0pht.com> |
Compromise: | Compromise account passwords (remotely if you can sniff a server challenge. |
Vulnerable Systems: | NT 4.0, 3.51. I believe NT4 Service Pack 3 SYSKEY fix will defeat pwdump style utilities. MS also has a fix out to disable Lanman authentication over the network, but this breaks compatibility w/W95 and 3.11. |
Date: | 12 July 1997 |
Notes: | First comes a very interesting message from mudge about M$ "authentication", then comes the readme file for l0phtcrack 1.5. Next comes the source distribution in uuencoded form. You can get executables at their webpage, www.l0pht.com. |
Date: Thu, 24 Jul 1997 10:24:37 -0400
From: Who cares what the hell goes into a Gecos field anyway!
<mudge@l0pht.com>
To: BUGTRAQ@NETSPACE.ORG
Subject: Windows NT rantings from the L0pht
I didn't ask to be cc'd into the rantings of the MS Borg Marketing
Juggernaut but since I'm here...
I find this hillarious. The people at MS should know better.
I haven't been following this thread tremendously but I've seen
bit's and pieces. Recently there was an attrocious article in WindowsNT
magazine, where they stated it would take 5000 or so years to break the
passwords; thus put policy in place to have users change their passwords
every 2500 years. HELLO? I think these people aren't getting it.
Let's shed some light on things shall we?
1. Thank you very little MS for dropping any reference to the l0pht,
hobbit, or myself in reference to your recent LM-Hash fix. If this
is how you "correspond" with people who point out problems to you it's
no wonder that people prefer to release things to the public instead
of your "proper" channels.
2. MS agrees that the LM hash is a horrible implementation from a
security standpoint. They respond with: "well we didn't write the
protocol that was IBM".
3. When MS had the chance to do things a different way (ie Network
challenge/response obfuscation on NT boxes) they implemented it based
upon LM techniques to break up components (see #2).
4. The LM-hash fix works great if you don't have anything but NT machines
on your network. If you want to continue being "productive" with your
win95 machines it is my understanding that you "do it insecurely" or
you are S.O.L.
5. Few places are running "nothing but NT" (ie just about everyone
has 95 or WfW boxes if MS has already gotten their foot in the door).
(see #4)
6. MS can't swallow their pride enough to say "oops", even in
technical circles where they don't have to worry about the general public
mis-interpreting things.
7. For the LM hash you only have to break 7 characters, not 14!
8. MS keeps talking about the NT hash being so secure while refusing to
talk about how weak the LM hash is. Guess what, you probably won't be able
to use the "added security" of the NT hash on your network. Why keep
talking about something people can't use?
9. Even though the NT hash spec says you can have up to 128 char
passwords,
I'd really like someone to show me how they can type more than 14
characters
into UserManager before it starts Beep-Beep'ing at them.
10. We demonstrate up front with proof of concept code in L0phtcrack v1.0,
and L0phtcrack v1.5 that the following is indeed the case.
For those that don't know, L0phtcrack v1.5 will attack the challenge
response done over the network. The reason we came out with this was that
the SYSKEY "fix" that MS came out with only managed to emasculate the
ADMINISTRATOR and not address the actuall problem. Can we say "save
face"? I knew we could.
L0phtcrack v1.5 is available for FREE from http://www.L0pht.com (that's
a ZERO after the 'L', not an 'o') . It comes with source so you can build
it on just about any platform. It is proof-of concept code and thus
could be sped up tremendously.
Now, let's rip apart why it is so trivial to go through the LM hash on the
network. And then talk about why the NT hash doesn't matter.
-------------------------- -----------------------------
| 16byte LM hash | | 16byte NT hash (md4) |
-------------------------- -----------------------------
We already know that you only have to go through 7 characters to retrieve
passwords (up to 14 chars in length) in the LM hash, and that since there
is
no salting being done, constants show up all over the place giving away
too much information and speeding up attacks tremendously.
-------------------------------------------------
| 1st 8bytes of LMhash | second 8bytes of LMhash |
-------------------------------------------------
1st 8 bytes are derived from the first seven characters of the password
and
the second 8 bytes are derived from the 8th through 14th characters of
the password. If the password is less than 7 characters then the second
half will always be: 0xAAD3B435B51404EE.
Let's assume for this example that the users password has a LM hash of
0xC23413A8A1E7665fAAD3B435B51404EE (which I'll save everyone the
nanosecond
it would have taken for them to plug this into L0phtcrack and have it
tell them the password is "WELCOME").
Here's what happens to this hash on the network:
-------- --------
| A | <______________| B |
| | | |
-------- --------
B sends an 8 byte challenge to A. (assume 0x0001020304050607)
Machine A takes the hash of 0xC23413A8A1E7665fAAD3B435B51404EE
and adds 5 nulls to it, thus becoming
0xC23413A8A1E7665fAAD3B435B51404EE0000000000.
The string 0xC23413A8A1E7665fAAD3B435B51404EE0000000000 is broken into
three groups of 7:
C23413A8A1E766 5fAAD3B435B514 04EE0000000000
The 7 byte strings are str_to_key'd (if you will) into 8 byte odd parity
des keys.
Now we have :
| 8byteDeskey1 | | 8byteDeskey2 | | 8 byteDeskey3 |
8byteDeskey1 is used to encrypt the challenge 0x0001020304050607. Let's
assume the result is 0xAAAAAAAAAAAAAAAA.
8byteDeskey2 is used to encrypt the challenge 0x0001020304050607. Let's
assume the result is 0xBBBBBBBBBBBBBBBB.
8byteDeskey3 is used to encrypt the challenge 0x0001020304050607. Let's
assume the result is 0xCCCCCCCCCCCCCCCC.
The three 8byte 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 it's end and compares the result to the
24 byte response. If they match, it was the correct original hash.
Why this is boneheaded:
----------------------
7 char or less passwords.
-------------------- -------------------- --------------------
| C23413A8A1E766 || 5fAAD3B435B514 || 04EE0000000000 |
-------------------- -------------------- --------------------
The first thing we check is to see if the users password is less than
8 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 then we are pretty sure
it's < 8 chars in length.
In order to be sure we can run through 0x??AAD3B435B514 (ie 256 possible
combinations) to see that 5f shows us the result is 0xBBBBBBBBBBBBBBBB,
proving that the password is less than 7 characters and also giving us
the last byte of the first half of the LM hash.
>From this point, even assuming we're just joyriding and not worried about
optimizing the way this is done (believe me, there are much more
effective ways to do this that reduce the amount of time needed even
further... this whole this is just showing that even a simplistic
attack works against this implementation), it's no different than
how a tool like L0phtcrack attacks the hashes in the registry.
8 char or greater passwords.
-------------------- -------------------- --------------------
| C23413A8A1E766 || AC435F2DD90417 || CCD60000000000 |
-------------------- -------------------- --------------------
The first thing to check is whether the password is less than 8 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 8 characters or
greater.
It takes us, in a worst case scenario, 65535 checks to figure out that
the 2bytes that are used in the last third are 0xCCD6. Even approaching
this in a completely brain-dead fashion (hey, turn-about is fair play),
you can go through your 7 digit combinations of characters for the
first third the same way you would the LM 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 you already have the
last two bytes that made up the third third.
You could approach the middle third in the same fashion.
(note: this whole method that MS is doing screams for a precompute
table lookup attack - which given the small enough potential values
is not impossible by any means)
Thus, the challenge response is completely brute-forcable for the LM-hash.
MS made the "oversight" of still sending the LM-hash response along with
the NT response even when SP3 was installed. Thus it was a moot point
as to how tough or well done the NT hash might or might not be.
Since installing the LM-fix precludes continued use of windows 95 machines
in regards to talking to NT machines, it is still a moot point as to
how tough or well done the NT hash might or might not be.
The LM hash is incredibly weak and your more secure NT hash is brought
down to the lowest common denominator.
Thus, the challenge response is completely brute-forcable for the LM-hash.
MS made the "oversight" of still sending the LM-hash response along with
the NT response even when SP3 was installed. Thus it was a moot point
as to how tough or well done the NT hash might or might not be.
Since installing the LM-fix precludes continued use of windows 95 machines
in regards to talking to NT machines, it is still a moot point as to
how tough or well done the NT hash might or might not be.
The LM hash is incredibly weak and your more secure NT hash is brought
down to the lowest common denominator.
It would have been nice if you could type a password greater than 14chars
into the UserManager app.
.mudge
--------------------
http://www.l0pht.com/advisories.html - for more security related articles
published by the L0pht
--------------------
COMMERCIAL AND GOVERNMENT USERS PLEASE SEE THE END
OF THIS FILE FOR LICENSING INFORMATION. FOR YOU THIS
PROGRAM IS SHAREWARE, FOR ALL OTHERS IT IS FREE.
L0phtCrack 1.5
Released 7/12/97
Available at http://www.l0pht.com/advisories.html
mudge@l0pht.com
weld@l0pht.com
OVERVIEW
L0phtCrack 1.5 is a tool for turning Microsoft LANMAN and NT password
hashes back into the original clear text passwords. The program
does this using dictionary cracking and also brute force. L0phtCrack
1.5 returns not just the LANMAN passord but the NT password up to 14
characters in length. L0phtcrack will read pwdump style output or take
network sniffer logs. The program is distributed as both a GUI and
in CLI form.
Version 1.0 of L0phtCrack was deficient because the graphical version
of the program did not support the brute force method that was in the
Command Line version which accompanied it. This has been fixed for version
1.5. The brute force efficiency has been improved and an option to select
the character set that makes up the password has been added.
The default behavior of the GUI is to do a dictionary attack on the
password file and then brute force the remaining uncracked passwords.
Sample password files are named pwfile.txt, pwfile2.txt, pwfile3.txt
and pwfile4.txt. A 28000 word dictionary file is included named
wfile.txt. You can dump passwords directly from L0phtCrack if you have
administrator rights.
L0phtCrack 1.5 includes the ability to dictionary attack or brute force
the network NT server challenge that is used to prevent the OWF from
going across the wire in its plaintext format. Sample network sniffed
challenges are in files sniff.txt and sniff2.txt. This means you
can get NT passwords without administrator privileges if you have network
access between the client and the server.
With only trivial modifications you can break the SMB signing options
and play man in the middle attacks. These 'signatures' are derived
in almost identical fashion as the challenge response is.
You can build the sniff files by hand using your favorite network analyzer
or wait for our tool which sniffs the network and builds these files.
The sniffing tool will be made available shortly.
Also to be made available shortly is a commercial multiprocessor
version, L0phtCrack/SMP 1.5 for NT and Solaris. Contact l0phtcrack@l0pht.com
for more information.
FILES IN THE EXECUTABLE DISTRIBUTION - LC15EXE.ZIP
lc_cli.exe is the command line version of the program. Run this if you
think little status counters are sucking up all you performance or do not
need you hand held by point-and-click tools. Source
code for this program that will build on Win95/NT or Unix is included in the
source code distribution: lc15src.zip or lc15src.tar.gz
lc_gui.exe is the NT graphical version of L0phtCrack.
lc_guipro.exe is the NT graphical version of L0phtCrack that has been compiled
with Pentuim Pro optimizations turned on.
lc_gui95.exe is Win95 graphical version of L0phtCrack. This version does not
support password dumping due to Win95 limitations.
FILES IN THE SOURCE DISTRIBUTION - LC15SRC.ZIP or LC15SRC.TAR.GZ
This archive contains all the source to build the command line version of
L0phtCrack 1.5.
PERFORMANCE
Dictionary cracking is extremely fast. L0phtCrack running on a Pentium Pro
200 checked a password file with 100 passwords against a 8 Megabyte dictionary
file in under one minute.
Brute forcing is always an extremely CPU intensive operation. We have worked
to optimize this in L0phtCrack 1.5. L0phtCrack running on a Pentium Pro
200 checked a password file with 10 passwords using the alpha character set
(A-Z) in 26 hours. The graphical verion of L0phtCrack 1.5 features a
percentage done counter and a time remaining estimate so you can gauge when
the task will be complete. [note from mudge: try building the CLI version
on an ultrasparc using the compile flags in the Makefile provided - this
will make these figures look sloooooowwww ;-)]
The l0phtcrack1.5 GUI allows you to select one of 5 character sets to brute
force passwords that use more characters than A-Z. As the character sets
increase in size from 26 characters to 68 the time to brute force the password
increases exponentially. The CLI version allows you to specify a file
containing your keyspace string via the '-k' option. Please keep in mind
that you should only be using UPPERCASE characters as we will derive the
lower case ones later in the cracking. [examine the source code if this
is un-clear]
This chart illustrates the relative time for larger character sets.
Char Relative
Size Iterations Time
26 8353082582 1.00
36 80603140212 9.65
46 4.45502E+11 53.33
68 6.82333E+12 816.86
So if 26 characters takes 26 hours to complete, 36 characters (A-Z,0-9) would
take 250 hours or 10.5 days. Now of course this is the worst case senario of
the password being 99999999999999. A password such as take2asp1r1n would
probably be computed in about 7 days. [mudge note: again, try this on
other architectures for better performance]
NT Server Challenge Sniffing
Here is a description of the challenge that takes place over the network
when a client, such as a Windows NT workstation, connects to an NT Server.
[assuming initial setup etc...]
8byte "random" challenge
Client <---------------------- Server
OWF1 = pad Lanman OWF with 5 nulls
OWF2 = pad NT OWF with 5 nulls
resp = E(OWF1, Chal) E(OWF2, Chal)
48byte response (24byte lanman 24byte nt)
Client -----------------------> Server
The client takes the OWF ( all 16 bytes of it) and pads with 5 nulls.
From this point it des ecb encrypts the, now 21byte, OWF with the
8byte challenge. The resulting 24byte string is sent over to the
server who performs the same operations on the OWF stored in it's
registry and compares the resulting two 24byte strings. If they
match the user used the correct passwd.
What's cool about this? Well, now you can take your sniffer logs
of NT logons and retrieve the plaintext passwords. This does not
require an account on the NT machine nor does it require previous
knowledge of the ADMINISTRATOR password.
The fact that these three responses are concatenated quickly gives
away the length of the password for the LM hash and the attack can
work backwards the same way the non-networked one does.
So even if you have installed Service Pack 3 and enabled SAM encryption
your passwords are still vulnerable if they go over the network.
Special thanks go out to:
- Hobbit@avian.org for all the cool ideas and bare feet. Especially
for his monster paper on CIFS problems.
- Jeremey Allison jra@cygnus.com - for the fantastic sleuthing with
PWDump.
- tuebor@l0pht.com for a some nice little code tips and generall coolness.
- the people who did SAMBA for being nuts!
- the people who did libdes for being nuts!
- Yobie for always fighting giants.
If anyone makes modifications / improvements please mail the diffs to
mudge@l0pht.com.
We hope this tool is useful,
mudge@l0pht.com , weld@l0pht.com
LICENSING INFORMATION LICENSING INFORMATION LICENSING INFORMATION
LICENSING INFORMATION LICENSING INFORMATION LICENSING INFORMATION
LHI TECHNOLOGIES, LLC SOFTWARE LICENSE AGREEMENT
THIS IS A LEGAL AGREEMENT BETWEEN YOU AND LHI TECHNOLOGIES, LLC ("LHI").
CAREFULLY READ ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT PRIOR TO USING
THE SOFTWARE. BY USING THE SOFTWARE YOU CONSENT TO BE BOUND BY THE TERMS OF
THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL THE TERMS OF THIS AGREEMENT, DO
NOT USE THE SOFTWARE.
***************************************************************************
IF YOU ARE A COMMERCIAL OR GOVERNMENTAL ENTITY THE GRAPHICAL EXECUTABLE
VERSIONS OF THIS SOFTWARE, ("L0PHTCRACK 1.5") ARE NOT FREE OF CHARGE. IF
YOU USE THE SOFTWARE BEYOND THE EVALUATION PERIOD OF 7 DAYS YOU MUST MAKE A
PAYMENT OF $50 TO LHI. PAYMENT MUST BE SENT TO: LHI, PO BOX 990857, BOSTON,
MA 02199.
****************************************************************************
THE GRAPHICAL EXECUTABLE VERSIONS ARE THE FILES NAMED: lc_gui.exe,
lc_guipro.exe and lc_gui95.exe CONTAINED IN THE ARCHIVE FILE lc15exe.zip
IF YOU ARE A NEITHER A COMMERCIAL NOR GOVERNMENTAL ENTITY YOU MAY USE THIS
SOFTWARE FREE OF CHARGE.
1.TITLE AND OWNERSHIP. The Software is owned by LHI
The Software is protected by United States and international copyright and
other laws. You may not remove, obscure, or alter any notice of
patent, copyright, trademark, trade secret, or other proprietary rights.
You may not reverse engineer, disassemble or de-compile the
Software nor may you permit anyone else to do so.
This license and your right to use the Software terminate automatically
if you violate any part of this Agreement.
3.DISCLAIMER OF WARRANTY AND LIMITATION OF LIABILITY.
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY
OF ANY KIND, WHETHER EXPRESS OR IMPLIED. WITHOUT
LIMITATION, LHI DISCLAIMS ALL IMPLIED
WARRANTIES WITH RESPECT TO THE SOFTWARE, ITS
MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR
PURPOSE. YOU ASSUME ALL RISK IN USING THE SOFTWARE.
IN NO EVENT WILL LHI BE LIABLE FOR INDIRECT,
INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING,
WITHOUT LIMITATION, LOSS OF INCOME, LOSS OF USE, OR
LOSS OF INFORMATION. IN NO EVENT WILL LHI BE
LIABLE FOR ANY DAMAGES, EVEN IF LHI SHALL HAVE
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES
OR FOR ANY CLAIM BY ANY OTHER PARTY. CERTAIN STATES
DO NOT PERMIT EXCLUSIONS OF IMPLIED WARRANTIES OR
LIMITATIONS OF LIABILITY, SO THIS DISCLAIMER MAY NOT
APPLY TO YOU OR MAY APPLY TO YOU ONLY IN PART. YOU
MAY HAVE OTHER LEGAL RIGHTS WHICH VARY FROM STATE
TO STATE.
4.EXPORT COMPLIANCE. You may not export or reexport the
Software except in full compliance with all United States and other
applicable laws and regulations, including laws and regulations
pertaining to the export of computer software.
5.GENERAL. This Agreement constitutes the entire agreement between
you and LHI and supersedes any prior written or oral agreement
concerning the Software. It shall not be modified except by written
agreement dated subsequent to the date of this Agreement and signed
by an authorized LHI representative. LHI is not bound by any
provision of any purchase order, receipt, acceptance, confirmation,
correspondence, or otherwise, unless LHI specifically agrees to
the provision in writing. This Agreement is governed by the laws of
the State of Massachusetts as if the parties hereto were both Massachusetts
residents; and you consent to exclusive jurisdiction in the state and
federal courts in Boston in the event of any dispute.
6.U.S. GOVERNMENT RESTRICTED RIGHTS. The Software is
provided with RESTRICTED RIGHTS. Use, duplication, or disclosure
by the Government is subject to restrictions as set forth in
subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and
(2) of the Commercial Computer Software Restricted Rights at 48
CFR 52.227-19, as applicable. Contractor/manufacturer is LHI
Technologies, LLC, PO Box 990857, Boston, MA 02199.
Download L0phtCrack 1.5 Source Tarball
The master index of all exploits is available
here (Very large file)
Or you can pick your favorite operating system:
This page is part of Fyodor's exploit
world.
For a free program to automate scanning your network for vulnerable
hosts and services, check out my network mapping tool, nmap. Or try these Insecure.Org resources: