Password Security: Part 2 - IT Today · system administrator would become seriously concerned with...

13
Auerbach Publications © 2000 CRC Press LLC 04/00 DATA SECURITY MANAGEMENT P ASSWORD S ECURITY : P ART 2 Jonathan S. Held INSIDE Introduction; The Problem; Contending with the Internet; Getting to the Source of the Problem; The Mathematics of Passwords; UNIX and Linux; Windows 95 and 98; Windows NT; Recommendations WINDOWS 95/WINDOWS 98 While password protection on Linux or UNIX systems may be bad, mea- suring how vulnerable a system is to compromise depends on many oth- er factors that are highlighted later in this article. Suffice it to say that the password implementation mechanism in Windows 95 and 98 (pass- words are stored in a file ending with the .PWL extension) is far worse. But these systems were developed with security apparently more of an afterthought than anything else; kernel security support had very limited functionality. For this reason, perhaps one should scrutinize these OSs in a different context, limiting the examination to the discussion of the PWL file and security considerations when internetworking various Win- dows platforms. Many Windows and non-Windows resources require passwords for access. In a LAN environment, one of the very first actions that is re- quired in order for users to “browse” the network is to enter a Microsoft Networking password as illustrated in Exhibit 1. At first glance, the dangers in this action are not intuitively obvious. The casual user indiscriminately en- ters a password without a care in the world — how the system validates the password is not important. More- over, where the information that is entered into the “P assword” field goes is something that few, if any- one, ever give second thought to. PAYOFF IDEA A strong password policy, rigorously enforced serves as an excellent foundation to enhance net- work security. This article, presented in two parts, looks at passwords from a hacker’s perspective. Part 1 (83-01-11) introduced the problems and then examined how access is mediated on UNIX and Linux machines, focusing on password file for- mat, the use of shadowed password files, and tools and types of attacks that hackers use to break passwords. Part 2 (this article) explores password usage and insecurities in Windows 95, 98, and NT. It concludes with a list of rules for creating good passwords and a review of password generation and utilities useful to system administrators. 83-01-12

Transcript of Password Security: Part 2 - IT Today · system administrator would become seriously concerned with...

Page 1: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

04/00

83-01-12

DATA SECURITY MANAGEMENT

PASSWORD SECURITY:PART 2Jonathan S. Held

I N S I D E

Introduction; The Problem; Contending with the Internet; Getting to the Source of the Problem;The Mathematics of Passwords; UNIX and Linux; Windows 95 and 98; Windows NT; Recommendations

WINDOWS 95/WINDOWS 98While password protection on Linux or UNIX systems may be bad, mea-suring how vulnerable a system is to compromise depends on many oth-er factors that are highlighted later in this article. Suffice it to say that thepassword implementation mechanism in Windows 95 and 98 (pass-words are stored in a file ending with the .PWL extension) is far worse.But these systems were developed with security apparently more of anafterthought than anything else; kernel security support had very limitedfunctionality. For this reason, perhaps one should scrutinize these OSsin a different context, limiting the examination to the discussion of thePWL file and security considerations when internetworking various Win-dows platforms.

Many Windows and non-Windows resources require passwords foraccess. In a LAN environment, one of the very first actions that is re-quired in order for users to “browse”the network is to enter a MicrosoftNetworking password as illustratedin Exhibit 1.

At first glance, the dangers in thisaction are not intuitively obvious.The casual user indiscriminately en-ters a password without a care in theworld — how the system validatesthe password is not important. More-over, where the information that isentered into the “Password” fieldgoes is something that few, if any-one, ever give second thought to.

P A Y O F F I D E A

A strong password policy, rigorously enforcedserves as an excellent foundation to enhance net-work security. This article, presented in two parts,looks at passwords from a hacker’s perspective.Part 1 (83-01-11) introduced the problems andthen examined how access is mediated on UNIXand Linux machines, focusing on password file for-mat, the use of shadowed password files, and toolsand types of attacks that hackers use to breakpasswords. Part 2 (this article) explores passwordusage and insecurities in Windows 95, 98, and NT.It concludes with a list of rules for creating goodpasswords and a review of password generationand utilities useful to system administrators.

Auerbach Publications© 2000 CRC Press LLC

Page 2: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

However, take a closer look at what happens during this process and anysystem administrator would become seriously concerned with security.

The password information that the user enters is saved to the harddrive in what is called a PWL file. The PWL file contains very valuable in-formation — everything from dial-up networking (DUN) to networkpasswords, and many applications (such as Netscape and Internet Ex-plorer) access the contents of this file and verify or extract username andpassword information (see Exhibit 2). The PWL file can hold up to 255records, with each record consisting of three fields:

1. resource type: an integer, ranging in value from 0 to 255; commonvalues are 6 (DUN) and 19 (WWW)

2. resource name3. resource password

EXHIBIT 1 — Entering a Microsoft Networking Password

EXHIBIT 2 — Entering a Network Password: The User Name and Pass-word Entered Are Cached in the Currently Logged-on User’s PWL File

Auerbach Publications© 2000 CRC Press LLC

Page 3: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

PASSWORD SECURITY: PART 2

The file is encrypted with a key derived from the user’s password us-ing the RC4 strong cipher algorithm. When the user attempts to log onthe system, Windows decrypts the PWL file using the specified passwordand verifies the resulting checksum. If everything checks out, the user isallowed to log on and applications can access the contents of the PWLfile by using an application programming interface (API).

Each PWL file is registered with the system; run sysedit.exe (SystemConfiguration Editor) and take a look at the system.ini file. In that file,one will find a section labeled [Password Lists]; for example

[Password Lists]JON=C:\WINDOWS\JON.PWLJSHELD=C:\WINDOWS\JSHELD.PWL

Entries are generally in the format USERNAME=PATHTOPWLFILE. Know-ing that PWL files are kept in the WINDOWS subdirectory by default,anyone can open an MS-DOS Prompt window and issue the commanddir *.pwl to obtain a complete listing of these files. All that is left to dois to perform the crack. For this, there are several programs in the publicdomain that can be used.

The first one to take a look at is the PWL editor that comes with Win-dows 95 and 98. If one has the original CD, look under \TOOLS\RES-KIT\NETADMIN\PWLEDIT for the program pwledit.exe. Run thisprogram and get a good look at the contents of the PWL file for the cur-rently logged-on user (see Exhibit 3).

This is clearly a management tool that allows one to remove resourcesfrom the PWL file. It does not display what the resource usernames orpasswords are, but this is easily accomplished by going elsewhere (e.g.,http://www.ryanspc.com/password.html) and downloading a copy ofPwlCrack.zip.

The zipped file, pwlcrack.exe, is extremely small — 26,112 bytes tobe exact — and although it claims to be a Win95 PWL viewer, the authorfound that it also works on Win98 machines. Exhibit 4 shows an exampleof the output generated by this program.

PWLCrack.exe is limited to displaying the resource username andpassword pair combinations for the currently logged-on user. It does notdisplay the user’s login name or password, which is ideally what themalefactor is looking for. A much more useful and robust utility that givesus this information is PWLTool v. 6.0 (see Exhibit 5), which can be down-loaded from http://www.webdon.com/vitas/pwltool.htm. This applica-tion makes cracking PWL files look like a trivial operation. It has a verynice, easy-to-use interface that allows the user to select from multiple us-er/PWL files and perform various types of password attacks (brute force,smart force, and dictionary) if the password is unknown. Once the user’spassword is cracked, it will display the contents of the PWL file in a for-mat almost identical to that produced by PwlCrack.exe.

Auerbach Publications© 2000 CRC Press LLC

Page 4: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

EXHIBIT 3 — Using the Microsoft Password List Editor

EXHIBIT 4 — Output of PwlCrack.exe

Auerbach Publications© 2000 CRC Press LLC

Page 5: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

ser Interface (GUI) for Recovering PWL

ublications

Press LLC

EXHIBIT 5 — PWLTool v. 6.0. Graphical UCached Passwords

Auerbach P© 2000 CRC

Page 6: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

The registration cost for PWLTool v. 6.0 is well worth it if recoveringpasswords from Windows 95 and 98 is a frequent administrative task.What one should take away from this brief discussion is the danger thatexists in a heterogeneous computing environment where non-WindowsNT computers are allowed to become part of a domain. The old adagethat a system is only as secure as its weakest link surely holds here; auser that logs on to a domain from a Windows 95 or 98 machine has thedomain username and password cached in the PWL file. As previouslydemonstrated, the security imposed on this file is inherently weak andaccess to resource usernames and passwords can be obtained using a va-riety of free or relatively inexpensive, publicly available utilities. For thisreason, at no time should these OSs be allowed to become part of a Win-dows NT domain. Administrators should examine the network controlpanel program, specifically looking at the properties settings of the clientfor Microsoft Networks, and ensure that logging on to a Windows NT do-main is disabled. Exhibit 6 illustrates what this dialog box looks like.

EXHIBIT 6 — Checking the Client for Microsoft Networks Properties toEnsure a Windows 95 or 98 Computer Cannot Log onto a Domain

Auerbach Publications© 2000 CRC Press LLC

Page 7: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

PASSWORD SECURITY: PART 2

WINDOWS NTAverage day-to-day computer users will most undoubtedly not favor us-ing a UNIX or Linux operating system, primarily because the applicationsthey use are not supported or have extremely limited support in theseenvironments. Sure, they could always find comparable applications(e.g., Sun’s StarOffice) or use special software such as OS emulators thatallow running non-native applications, but doing so requires learning anew application or how to make configuration settings. Few people wantto spend the time figuring out how to migrate, so one sticks with whatone knows. Windows NT has not been around nearly as long as UNIXhas, but it has widespread acceptance and has managed to entrench itselfamong many businesses as the choice OS.

System administration on a Windows NT network is a fairly straight-forward task. The basics of creating accounts, setting permissions andpolicies, etc., are all made easier by the GUI utilities distributed with theOS (look under Start->Programs->Administrative Tools). Like UNIX,NT is a discretionary access control (DAC) system, whereby individualusers can modify the access control lists (ACLs) on resources, which enu-merate who has permission to access these resources and what type ofpermission they have (read, write, execute, or some combination thereof;to view the ACL on a file, open a command prompt windows and typecacls <filename>). This means that if malefactors can log in using anotherindividual’s credentials, they authenticate themselves to the system witha set of permissions that can be altogether different from someone else’s.And, of course, the one account that hackers want is the administrator’s.Given that NT creates two accounts during installation — Administratorand Guest — half the hacker’s battle is over; that is, the user name is al-ready known. Neither of these built-in accounts can be deleted, so theonly alternative is to disable or rename them. But before one does this,beware — Guest is commonly used by other applications. Disable the ac-count and the applications will not be able to execute as intended. Rath-er, one should ensure that the Guest account has a good password; andwhile one cannot delete the Administrator account, one can rename it tosomething less obvious.

In order for account information to be used by the OS, it has to be per-sistent. Windows NT does what every other OS does to accomplish this— it writes the information to disk; however, the manner in which this isdone and the way information is managed is slightly different from theprevious examples. Windows NT uses a Security Accounts Manager(SAM) database to store sensitive user information (look in the\\WINNT\SYSTEM32\CONFIG directory and one finds the files SAM andSAM.LOG). While the OS is running, the SAM database is locked, andcopying, deleting, or otherwise manipulating it through a user context isnot possible (see Exhibit 7).

Auerbach Publications© 2000 CRC Press LLC

Page 8: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

As with everything else, however, there are utilities for Windows NTthat allow access to the contents of the SAM database. Knowing whatthese utilities are and how they work is extremely important if system ad-ministrators want to have a better understanding of what security risksexist and what steps they can take to improve network security.

EXHIBIT 7 — Trying to Access the SAM Database Files from a WindowsNT (top) and Windows 98 (bottom) Machine while the OS is Running

Auerbach Publications© 2000 CRC Press LLC

Page 9: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

PASSWORD SECURITY: PART 2

Of all the password applications available for Windows NT, perhapsthe most well-known one is a product called L0phtCrack written by L0phtHeavy Indus t r i e s (ava i l ab le fo r download a t h t -tp://www.l0pht.com/l0phtcrack). L0phtCrack allows NT Administratorsto quickly evaluate the security of user passwords, and it can perform dif-ferent types of password attacks (dictionary, hybrid dictionary, or ex-haustive keyspace) based on appropriate configuration settings.

L0phtCrack can obtain NT passwords directly from the registry by look-ing at the contents of the SAM files or by monitoring simple messageblock (SMB) network activity. To perform most of these operations, themalefactor has to be an Administrator on the machine he wishes to attack.This requirement, of course, limits its utility, but it was never intended tobe a “hacking” tool; rather, it serves as an inexpensive ($100) passwordmanagement tool and is a nice complement to double-check that pass-word restrictions configured by the Accounts Policy settings in the UserManager for Domains utility are functioning as desired (see Exhibit 8).

EXHIBIT 8 — Setting Password Restrictions in the Account Policy DialogBox

Auerbach Publications© 2000 CRC Press LLC

Page 10: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

L0phtCrack is as easy to use as PWLTool and its GUI provides a limit-ed selection of menu options that helps keep its operation simple andself-explanatory. Exhibit 9 illustrates L0phtCrack 2.5 running a brute-force attack against a SAM database containing nine user accounts. In amatter of seconds, the application has cracked five passwords, and it iswell on its way to finishing off the remaining four.

The logical question that remains is how, if only an administrator canrun this application, does one who does not have this privilege get a holdof this information? The most common means for accomplishing this isfivefold:

1. Explicitly create an emergency repair disk. This process copies theSAM database to floppy, which can then be expanded and loadedinto L0phtCrack on another machine for further analysis.

2. Look in the \\WINNT\REPAIR subdirectory for the file SAM._. Thisfile, created after a Windows NT installation, will most likely containonly the Administrator and Guest user account information. The fileis compressed and must be expanded by opening a commandprompt window and typing: expand sam._ <destination file>. Appli-cations such as L0phtCrack or PWDUMP can then read the user ac-count information from this file.

3. Use a boot disk on the local machine and copy the SAM database. Bybooting from floppy, the OS will not have the opportunity to lock thefile and cannot prohibit what would ordinarily be unauthorized ac-cess. If the SAM database resides on a FAT partition, this is extremelyeasy to do; an NTFS partition makes things a little more difficult (or-dinarily, one cannot see the contents of an NTFS formatted partition).However, use NTFSDOS, and one can boot the machine in a DOS-like environment and access the contents of an NTFS partition.

4. Mount a drive from a non-Windows OS and access the SAM database.5. Run getadmin.exe and become the administrator. One does not need

to bother with the SAM database; once one logs out and logs back in,one has all the rights of a local administrator.

Windows NT is not without its flaws, but most of what has been dis-cussed here are exploits that have been highly publicized for some timeon numerous “hacker” Web sites. The security-conscious administratorwill take the time to peruse CERT advisories, NTBugTraq (http://www.nt-bugtraq.com), and other Web sites that contain relevant and insightful in-formation, but time is unfortunately a precious commodity that few havelots of. And as one starts to add services (e-mail, FTP, HTTP, etc.) on topof the OS, security becomes infinitely more complex, more cumbersome,and more time-intensive a process than originally anticipated.

Auerbach Publications© 2000 CRC Press LLC

Page 11: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

ack

l#security21.

cations

s LLC

EXHIBIT 9 — Running a Brute-Force Attack with L0phtCr

Source: From http://www.ntfaq.com/ntfaq/security21.htm

Auerbach Publi© 2000 CRC Pres

Page 12: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

DATA SECURITY MANAGEMENT

RECOMMENDATIONSSome of what one can do to enhance network security is delineated inthe bulleted list below. This list is not all-inclusive, but it serves as an ex-cellent foundation to enhance network security and, by its mere length,suggests what is not always obvious to management personnel — secu-rity is a full-time job!

• Utilize a password filter or some other rule-based set. Windows NTallows one to specify password aging (how long a user can keep apassword before having to change it), password length, and a pass-word uniqueness feature that prevents users from using old pass-words. One can also apply a password filter that forces users tochoose characters from a specified character set.

• Explore password generation programs. One can assign passwordsto users or let users pick their own passwords. The former option isnormally only done when a user account is created; opting for thelatter option can lead to problems if weak passwords are chosen.

• Enforce good passwords by trying to crack them. There are plenty ofthird-party password management utilities (other than L0phtCrack)that allow one to do just this (e.g., http://www.netmagic.com). Itmight even be worth it to buy a high-end (Pentium III) machine anduse it solely for this purpose.

• Consider using a biometric device such as a fingerprint scanner orvocal analyzer as an additional security precaution.

• Consider whether a one-time password solution can work.• Monitor logs. Unfortunately, logs become large very quickly (the re-

quest for one Web page is actually a request for all of the objects em-bedded in that page). To get through these logs, one might considerusing a third-party utility that can spot unusual activity, but oneshould do so with extreme caution — nothing should ever replaceone’s personal scrutiny of these important files.

• Train personnel and ensure that if they have access to the Internet,they refrain from using corporate usernames and passwords for ac-cess to Web sites.

• Separate the corporate infrastructure (intranet) from the Internet asmuch as possible. When allowing Internet access, try to do sothrough a proxy server.

• Monitor alerts and warnings (CERT, NTBUGTRAQ) by subscribing toappropriate mailing lists.

• Chart services versus vulnerabilities/scan ports on remote machines.At the very minimum, this will help one see where the weak spotsare and what someone is likely to go after. This identification processallows one to proceed with network vulnerability testing — some-times, the best way to learn about security is to try and break intoone’s own network. One will quickly come to the realization that ser-

Auerbach Publications© 2000 CRC Press LLC

Page 13: Password Security: Part 2 - IT Today · system administrator would become seriously concerned with security. The password information that the user enters is saved to the hard drive

PASSWORD SECURITY: PART 2

vices are the biggest security culprit because software is typicallypoorly tested; and while time and “bug fixes” may make it better byadding more features, it may just as likely introduce new problems.

• Implement Service Packs and hot fixes when they become available.• Implement an Intrusion Detection System (IDES).• Packet sniffers (such as Ethernet cards in promiscuous mode) are a

serious concern that need to be countered. If someone can see ev-erything, then nothing is safe.

• Do not give away too much information. Finger daemons should bedisabled — the less a “hacker” knows about the users of a particularsystem, the more difficult it is for him to break into the system.

• A homogeneous computing environment is far easier and has a lowertotal cost of ownership (TCO) than a heterogenerous one. If at allpossible, seriously consider the migration process and what it wouldtake to get everyone and everything operating in the same type ofenvironment.

Jonathan S. Held is a consultant in the Washington, D.C., area, and actively engaged in E-commerce developmentand security. After graduating from the University of Pennsylvania with a B.A. in mathematics, he served in theUnited States Navy as a cryptologic officer. He holds an M.S. in computer science from the Naval PostgraduateSchool. As a Microsoft Certified Professional in Windows NT Server 4.0, he co-authored the book Data EncryptionTechniques with Basic and C++ and an article for Auerbach entitled “Developing a Client/Server RDBMS UsingJava Servlets.”

Auerbach Publications© 2000 CRC Press LLC